Skip to content

Commit

Permalink
Merge pull request #329 from StefanMaron/ImproveHandlingOnNamespaces
Browse files Browse the repository at this point in the history
Resolve false positive on LC0003/LC0005 with use of namespaces
  • Loading branch information
Arthurvdv authored Nov 13, 2023
2 parents d2ea8b2 + 4703382 commit 6678bbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Design/Rule0003DoNotUseObjectIDsInVariablesOrProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ private void CheckForObjectIDsInVariablesOrProperties(SyntaxNodeAnalysisContext

if (property.PropertyKind != PropertyKind.Permissions && property.PropertyKind != PropertyKind.AccessByPermission)
{
if (ctx.Node.ToString().Trim('"').ToUpper() != property.ValueText.ToUpper())
if (ctx.Node.GetLastToken().ToString().Trim('"').ToUpper() != property.ValueText.ToUpper())
ctx.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.Rule0003DoNotUseObjectIDsInVariablesOrProperties, ctx.Node.GetLocation(), new object[] { ctx.Node.ToString().Trim('"'), property.ValueText }));

if (ctx.Node.ToString().Trim('"') != property.ValueText)
if (ctx.Node.GetLastToken().ToString().Trim('"') != property.ValueText)
ctx.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.Rule0005VariableCasingShouldNotDIfferFromDeclaration, ctx.Node.GetLocation(), new object[] { property.ValueText, "" }));
}
}
Expand Down

0 comments on commit 6678bbc

Please sign in to comment.