Skip to content

Commit

Permalink
Measure-AutomaticVariableAlias: Improving the syntax and wording of u…
Browse files Browse the repository at this point in the history
…ser messages
  • Loading branch information
BenedekFarkas committed Nov 23, 2022
1 parent d3f0ae4 commit 87e060a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ function Measure-AutomaticVariableAlias
$automaticVariableAliasToken.Extent.EndLineNumber
$automaticVariableAliasToken.Extent.StartColumnNumber
$automaticVariableAliasToken.Extent.EndColumnNumber
"`$PSItem"
"Replaced the usage of the alias of the automatic variable '`$_' with its full content '`$PSItem'."
'$PSItem'
'Replaced the usage of the alias of the automatic variable ''$_'' with its full name ''$PSItem''.'
)

$suggestedCorrections = New-Object System.Collections.ObjectModel.Collection[$correctionTypeName]
$suggestedCorrections.add($correctionExtent) | Out-Null

$results += [Microsoft.Windows.Powershell.ScriptAnalyzer.Generic.DiagnosticRecord]@{
"Extent" = $automaticVariableAliasToken.Extent
"Message" = "'`$_' is an alias of '`$PSItem'. Alias can introduce possible problems" +
" and make scripts hard to maintain. Please consider changing alias to its full content."
"Message" = '''$_'' is an alias of the automatic variable ''$PSItem''. Please consider using the full name of this' +
' variable for consistency.'
"RuleName" = "PSAvoidUsingAutomaticVariableAlias"
"RuleSuppressionID" = "PSAvoidUsingAutomaticVariableAlias"
"Severity" = "Warning"
Expand Down

0 comments on commit 87e060a

Please sign in to comment.