Skip to content

Commit ecc11da

Browse files
committed
Add check for ShouldProcess value attribute being omitted
1 parent ccfd6e5 commit ecc11da

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Rules/UseShouldProcessForStateChangingFunctions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
6363

6464
foreach (NamedAttributeArgumentAst attributeAst in attributeAsts)
6565
{
66-
if (attributeAst.ArgumentName.Equals(supportsShouldProcess, StringComparison.OrdinalIgnoreCase) && attributeAst.Argument.Extent.Text.Equals(trueString, StringComparison.OrdinalIgnoreCase))
66+
if (attributeAst.ArgumentName.Equals(supportsShouldProcess, StringComparison.OrdinalIgnoreCase))
6767
{
68-
hasShouldProcessAttribute = true;
68+
if((attributeAst.Argument.Extent.Text.Equals(trueString, StringComparison.OrdinalIgnoreCase)) && !attributeAst.ExpressionOmitted ||
69+
attributeAst.ExpressionOmitted)
70+
{
71+
hasShouldProcessAttribute = true;
72+
}
6973
}
7074
}
7175

0 commit comments

Comments
 (0)