You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Clean diagnostic rules
Move the following diagnostics into static readonly fields: GD0101, GD0102, GD0103, GD0104, GD0105, GD0106, GD0107, GD0201, GD0202, GD0203, GD0301, GD0302, GD0303, GD0401, GD0402. To be more consistent, the titles for the following diagnostics were modified: GD0101, GD0105, GD0106, GD0302, GD0303, GD0401, GD0402. A subsequent update of the documentation repo is needed. Tests for the following diagnostics were created: GD0201, GD0202, GD0203.
This commit is contained in:
@@ -136,7 +136,11 @@ namespace Godot.SourceGenerators
|
||||
{
|
||||
if (!signalDelegateSymbol.Name.EndsWith(SignalDelegateSuffix))
|
||||
{
|
||||
Common.ReportSignalDelegateMissingSuffix(context, signalDelegateSymbol);
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
Common.SignalDelegateMissingSuffixRule,
|
||||
signalDelegateSymbol.Locations.FirstLocationWithSourceTreeOrDefault(),
|
||||
signalDelegateSymbol.ToDisplayString()
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -154,21 +158,32 @@ namespace Godot.SourceGenerators
|
||||
{
|
||||
if (parameter.RefKind != RefKind.None)
|
||||
{
|
||||
Common.ReportSignalParameterTypeNotSupported(context, parameter);
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
Common.SignalParameterTypeNotSupportedRule,
|
||||
parameter.Locations.FirstLocationWithSourceTreeOrDefault(),
|
||||
parameter.ToDisplayString()
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
var marshalType = MarshalUtils.ConvertManagedTypeToMarshalType(parameter.Type, typeCache);
|
||||
|
||||
if (marshalType == null)
|
||||
{
|
||||
Common.ReportSignalParameterTypeNotSupported(context, parameter);
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
Common.SignalParameterTypeNotSupportedRule,
|
||||
parameter.Locations.FirstLocationWithSourceTreeOrDefault(),
|
||||
parameter.ToDisplayString()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (!methodSymbol.ReturnsVoid)
|
||||
{
|
||||
Common.ReportSignalDelegateSignatureMustReturnVoid(context, signalDelegateSymbol);
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
Common.SignalDelegateSignatureMustReturnVoidRule,
|
||||
signalDelegateSymbol.Locations.FirstLocationWithSourceTreeOrDefault(),
|
||||
signalDelegateSymbol.ToDisplayString()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user