Improve analyzer diagnostics

This commit is contained in:
Oleksii Holub
2022-04-17 00:01:34 +00:00
committed by GitHub
parent 41cb8647b5
commit ed3e4f471e
21 changed files with 92 additions and 28 deletions

View File

@@ -37,7 +37,9 @@ public class OptionMustHaveValidValidatorsAnalyzer : AnalyzerBase
// Value passed to the validator must be assignable from the property type
if (validatorValueType is null || !validatorValueType.IsAssignableFrom(property.Type))
{
context.ReportDiagnostic(CreateDiagnostic(propertyDeclaration.GetLocation()));
context.ReportDiagnostic(
CreateDiagnostic(propertyDeclaration.Identifier.GetLocation())
);
// No need to report multiple identical diagnostics on the same node
break;