Skip to content

Commit 158812b

Browse files
authored
Fix FunctionInfo fallback AST attribute analysis for UseShouldProcessCorrectly (#1659)
1 parent 6bdc6f4 commit 158812b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Rules/UseShouldProcessCorrectly.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ private bool SupportsShouldProcess(string cmdName)
350350
private bool TryGetShouldProcessValueFromAst(FunctionInfo functionInfo, out bool hasShouldProcessSet)
351351
{
352352
// Get the body of the function
353-
ScriptBlockAst functionBodyAst = (ScriptBlockAst)functionInfo.ScriptBlock.Ast.Find(ast => ast is ScriptBlockAst, searchNestedScriptBlocks: false);
353+
ScriptBlockAst functionBodyAst = (ScriptBlockAst)functionInfo.ScriptBlock.Ast.Find(ast => ast is ScriptBlockAst, searchNestedScriptBlocks: true);
354354

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

0 commit comments

Comments
 (0)