Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDo not trigger UseShouldProcessForStateChangingFunctions rule for workflows #923
Conversation
| @@ -42,5 +42,11 @@ Function New-{0} () {{ }} | |||
| It "returns no violations" { | |||
| $noViolations.Count | Should -Be 0 | |||
| } | |||
|
|
|||
| It "Workflows should not trigger a warning because they do not allow SupportsShouldProcess" { | |||
This comment has been minimized.
This comment has been minimized.
JamesWTruher
Mar 5, 2018
Member
I think we need to protect this from execution on core, where workflow is not supported. Add '-skip:$IsCore' I think.
This comment has been minimized.
This comment has been minimized.
JamesWTruher
Mar 5, 2018
Member
PS> Invoke-ScriptAnalyzer -ScriptDefinition "workflow foo { 'zap' }"
Invoke-ScriptAnalyzer : Parse error in script definition: Workflow is not supported in PowerShell Core at line 1 column 1.
At line:1 char:1
+ Invoke-ScriptAnalyzer -ScriptDefinition "workflow foo { 'zap' }"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (WorkflowNotSupportedInPowerShellCore:String) [Invoke-ScriptAnalyzer], ParseException
+ FullyQualifiedErrorId : Parse error in script definition: Workflow is not supported in PowerShell Core at line 1 column 1.,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand
This comment has been minimized.
This comment has been minimized.
bergmeister
Mar 5, 2018
•
Author
Collaborator
Good catch, thanks, I should've run the test suite in PSCore as well.
…his case
|
looks good |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

bergmeister commentedMar 5, 2018
PR Summary
Fixes #922
Workflows do not allow SupportsShouldProcess (the parser does not even allow it), therefore do not trigger UseShouldProcessForStateChangingFunctions
As part of this I also update the copyright header and tidied up unused using statements.
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
xbetween the square brackets. Please mark anything not applicable to this PRNA.WIP:to the beginning of the title and remove the prefix when the PR is ready