You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect the above workflow to NOT trigger UseShouldProcessForStateChangingFunctions. Said rule should only apply to functions (not workflows).
Actual behavior
The above workflow definition triggers UseShouldProcessForStateChangingFunctions and it should not. Workflows support the use of certain features of the CmdletBinding attribute, but not "SupportsShouldProcess". As a result, you cannot satisfy the rule while still leveraging the benefits of CmdletBinding attribute (e.g. DefaultParameterSetName).
Environment data
PSVersionTable:
Name
Value
PSVersion
5.1.15063.909
PSEdition
Desktop
PSCompatibleVersions
{1.0, 2.0, 3.0, 4.0...}
BuildVersion
10.0.15063.909
CLRVersion
4.0.30319.42000
WSManStackVersion
3.0
PSRemotingProtocolVersion
2.3
SerializationVersion
1.1.0.1
PSScriptAnalyzerVersion: 1.10.0
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. Since you correctly stated that SupportsShouldProcess is not supported (and not even allowed syntax) for a workflow, I agree that workflows should be excluded from this rule. I created a PR with the fix for it is below.
P.S. You should really update your PSScriptAnalyzer version, many more fixes and features have been added since 1.10 (we are already at 1.16.1 and the upcoming release that will come out soon will contain even much more). ;-)
Steps to reproduce
Expected behavior
I expect the above workflow to NOT trigger
UseShouldProcessForStateChangingFunctions
. Said rule should only apply to functions (not workflows).Actual behavior
The above workflow definition triggers
UseShouldProcessForStateChangingFunctions
and it should not. Workflows support the use of certain features of the CmdletBinding attribute, but not "SupportsShouldProcess". As a result, you cannot satisfy the rule while still leveraging the benefits of CmdletBinding attribute (e.g. DefaultParameterSetName).Environment data
PSVersionTable:
PSScriptAnalyzerVersion: 1.10.0
The text was updated successfully, but these errors were encountered: