Skip to content

Commit ccfd6e5

Browse files
committed
Change IndexOf() to StartsWith()
1 parent 4ec8e7c commit ccfd6e5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Rules/UseShouldProcessForStateChangingFunctions.cs

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

47-
if (funcName.IndexOf("Get-", StringComparison.OrdinalIgnoreCase) >= 0 ||
48-
funcName.IndexOf("Stop-", StringComparison.OrdinalIgnoreCase) >= 0 ||
49-
funcName.IndexOf("New-", StringComparison.OrdinalIgnoreCase) >= 0 ||
50-
funcName.IndexOf("Set-", StringComparison.OrdinalIgnoreCase) >= 0 ||
51-
funcName.IndexOf("Update-", StringComparison.OrdinalIgnoreCase) >= 0 ||
52-
funcName.IndexOf("Reset-", StringComparison.OrdinalIgnoreCase) >= 0)
47+
if (funcName.StartsWith("Get-", StringComparison.OrdinalIgnoreCase) ||
48+
funcName.StartsWith("Stop-", StringComparison.OrdinalIgnoreCase)||
49+
funcName.StartsWith("New-", StringComparison.OrdinalIgnoreCase) ||
50+
funcName.StartsWith("Set-", StringComparison.OrdinalIgnoreCase) ||
51+
funcName.StartsWith("Update-", StringComparison.OrdinalIgnoreCase) ||
52+
funcName.StartsWith("Reset-", StringComparison.OrdinalIgnoreCase))
5353
{
5454
IEnumerable<Ast> attributeAsts = funcDefAst.FindAll(testAst => testAst is NamedAttributeArgumentAst, true);
5555
if (funcDefAst.Body != null && funcDefAst.Body.ParamBlock != null

0 commit comments

Comments
 (0)