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

@@ -14,7 +14,8 @@ public class ParameterMustHaveUniqueNameAnalyzer : AnalyzerBase
public ParameterMustHaveUniqueNameAnalyzer()
: base(
"Parameters must have unique names",
"This parameter's name must be unique within the command (comparison IS NOT case sensitive).")
"This parameter's name must be unique within the command (comparison IS NOT case sensitive). " +
"Specified name: '{0}'.")
{
}
@@ -51,7 +52,12 @@ public class ParameterMustHaveUniqueNameAnalyzer : AnalyzerBase
if (string.Equals(parameter.Name, otherParameter.Name, StringComparison.OrdinalIgnoreCase))
{
context.ReportDiagnostic(CreateDiagnostic(propertyDeclaration.GetLocation()));
context.ReportDiagnostic(
CreateDiagnostic(
propertyDeclaration.Identifier.GetLocation(),
parameter.Name
)
);
}
}
}