Skip to content

Commit

Permalink
Fix FunctionInfo fallback AST attribute analysis for UseShouldProcess…
Browse files Browse the repository at this point in the history
…Correctly (#1659)
  • Loading branch information
hubuk authored Apr 23, 2021
1 parent 6bdc6f4 commit 158812b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Rules/UseShouldProcessCorrectly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private bool SupportsShouldProcess(string cmdName)
private bool TryGetShouldProcessValueFromAst(FunctionInfo functionInfo, out bool hasShouldProcessSet)
{
// Get the body of the function
ScriptBlockAst functionBodyAst = (ScriptBlockAst)functionInfo.ScriptBlock.Ast.Find(ast => ast is ScriptBlockAst, searchNestedScriptBlocks: false);
ScriptBlockAst functionBodyAst = (ScriptBlockAst)functionInfo.ScriptBlock.Ast.Find(ast => ast is ScriptBlockAst, searchNestedScriptBlocks: true);

// Go through attributes on the parameter block, since this is where [CmdletBinding()] will be
foreach (AttributeAst attributeAst in functionBodyAst.ParamBlock.Attributes)
Expand Down

0 comments on commit 158812b

Please sign in to comment.