Skip to content

Commit dc1f5b9

Browse files
author
Kapil Borle
committed
Mark only the function name in violation extent
1 parent 3e48146 commit dc1f5b9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Rules/UseIdenticalMandatoryParametersDSC.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
110110
Strings.UseIdenticalMandatoryParametersDSCError,
111111
paramName,
112112
funcDefnAst.Name),
113-
funcDefnAst.Extent,
113+
Helper.Instance.GetScriptExtentForFunctionName(funcDefnAst),
114114
GetName(),
115115
DiagnosticSeverity.Error,
116116
fileName);

Tests/Rules/UseIdenticalMandatoryParametersForDSC.tests.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Describe "UseIdenticalMandatoryParametersForDSC" {
1818
$violations.Count | Should Be 1
1919
}
2020

21-
# todo add a test to check violation extent
21+
It "Should mark only the function name" {
22+
$violations[0].Extent.Text | Should Be 'Get-TargetResource'
23+
}
2224
}
2325
}

0 commit comments

Comments
 (0)