Skip to content

Commit a18446e

Browse files
author
Kapil Borle
committed
Set SuggestedCorrection property in MisleadingBacktick rule
1 parent c8fe6d6 commit a18446e

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

Rules/MisleadingBacktick.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
5656
int lineNumber = ast.Extent.StartLineNumber + i;
5757

5858
ScriptPosition start = new ScriptPosition(fileName, lineNumber, match.Index, line);
59-
ScriptPosition end = new ScriptPosition(fileName, lineNumber, match.Index + match.Length, line);
60-
59+
ScriptPosition end = new ScriptPosition(fileName, lineNumber, match.Index + match.Length, line);
6160
yield return new DiagnosticRecord(
6261
string.Format(CultureInfo.CurrentCulture, Strings.MisleadingBacktickError),
63-
new ScriptExtent(start, end), GetName(), DiagnosticSeverity.Warning, fileName);
62+
new ScriptExtent(start, end),
63+
GetName(),
64+
DiagnosticSeverity.Warning,
65+
fileName,
66+
suggestedCorrection:string.Empty);
6467
}
6568
}
6669
}

Tests/Rules/MisleadingBacktick.tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Describe "Avoid Misleading Backticks" {
88
Context "When there are violations" {
99
It "has 5 misleading backtick violations" {
1010
$violations.Count | Should Be 5
11+
12+
foreach ($violation in $violations)
13+
{
14+
$violation.SuggestedCorrection | Should Not Be $null
15+
$violation.SuggestedCorrection | Should BeNullOrEmpty
16+
}
1117
}
1218
}
1319

0 commit comments

Comments
 (0)