Skip to content

Commit b43f772

Browse files
committed
Change the string error messages.
Change the check. Replace "Get-" to "Restart". Get won't modify system status.
1 parent 123b054 commit b43f772

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

Rules/Strings.Designer.cs

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rules/Strings.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@
658658
<value>Use ShouldProcess For State Changing Functions</value>
659659
</data>
660660
<data name="UseShouldProcessForStateChangingFunctionsDescrption" xml:space="preserve">
661-
<value>Functions that have verbs like New, Start, Stop, Set, Reset that change system state should support 'ShouldProcess'.</value>
661+
<value>Functions that have verbs like New, Start, Stop, Set, Reset, Restart that change system state should support 'ShouldProcess'.</value>
662662
</data>
663663
<data name="UseShouldProcessForStateChangingFunctionsError" xml:space="preserve">
664664
<value>Function ’{0}’ has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.</value>

Rules/UseShouldProcessForStateChangingFunctions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
4444
string funcName = funcDefAst.Name;
4545
bool hasShouldProcessAttribute = false;
4646

47-
if (funcName.StartsWith("Get-", StringComparison.OrdinalIgnoreCase) ||
47+
if (funcName.StartsWith("Restart-", StringComparison.OrdinalIgnoreCase) ||
4848
funcName.StartsWith("Stop-", StringComparison.OrdinalIgnoreCase)||
4949
funcName.StartsWith("New-", StringComparison.OrdinalIgnoreCase) ||
5050
funcName.StartsWith("Set-", StringComparison.OrdinalIgnoreCase) ||
@@ -76,7 +76,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
7676
if (!hasShouldProcessAttribute)
7777
{
7878
yield return
79-
new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture,Strings.UseShouldProcessForStateChangingFunctionsError, funcName),funcDefAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
79+
new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture,Strings.UseShouldProcessForStateChangingFunctionsError, funcName),funcDefAst.Extent, GetName(), DiagnosticSeverity.Warning, fileName);
8080
}
8181
}
8282
}

0 commit comments

Comments
 (0)