Skip to content

Commit

Permalink
Merge pull request #323 from StefanMaron/ImproveAnalyzeToolTipPunctua…
Browse files Browse the repository at this point in the history
…tion

Improve Rule0026 for supporting attributes
  • Loading branch information
Arthurvdv authored Nov 7, 2023
2 parents 660ebd2 + a7899a9 commit 79c6141
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Design/Rule0026ToolTipPunctuation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Immutable;
using System.Collections.Immutable;
using Microsoft.Dynamics.Nav.CodeAnalysis;
using Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics;
using Microsoft.Dynamics.Nav.CodeAnalysis.Syntax;
Expand All @@ -18,15 +17,13 @@ private void AnalyzeToolTipPunctuation(SyntaxNodeAnalysisContext ctx)
if (ctx.ContainingSymbol.IsObsoletePending || ctx.ContainingSymbol.IsObsoleteRemoved) return;
if (ctx.ContainingSymbol.GetContainingObjectTypeSymbol().IsObsoletePending || ctx.ContainingSymbol.GetContainingObjectTypeSymbol().IsObsoleteRemoved) return;

PropertySyntax tooltipProperty = ctx.Node.GetProperty("ToolTip");

if (tooltipProperty != null)
{
string tooltipValue = tooltipProperty.Value.GetText().ToString();
if (!tooltipValue.EndsWith(".'"))
ctx.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.Rule0026ToolTipPunctuation, tooltipProperty.GetLocation()));
}
PropertyValueSyntax tooltipProperty = ctx.Node.GetPropertyValue(PropertyKind.ToolTip);
if (tooltipProperty == null)
return;

StringLiteralValueSyntax tooltipLabel = ((LabelPropertyValueSyntax)tooltipProperty).Value.LabelText;
if (!tooltipLabel.Value.ToString().EndsWith(".'"))
ctx.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.Rule0026ToolTipPunctuation, tooltipProperty.GetLocation()));
}
}
}

0 comments on commit 79c6141

Please sign in to comment.