PowerShell / PowerShell/PSScriptAnalyzer
UseShouldProcessForStateChangingFunctions should prove that a function changes system state.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
Right now, the UseShouldProcessForStateChangingFunctions rule only looks at the name of the function (the verb) in order to determine that the function changes system state.
I think the rule should look at the body of the function and see if the function uses other functions that changes system state before it issues a warning.
If not, then I think that functions with the "New" verb should not be considered as functions that change system state. A lot of functions from the community with the "New" verb do not change system state, but are actually just different forms of "New-Object". See, for example, the ShowUI module.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the UseShouldProcessForStateChangingFunctions rule and trace how it currently uses function names to issue warnings. Investigate how the rule could inspect function bodies and calls, including whether New-verb functions should be excluded when they do not change system state. Done means the rule distinguishes state-changing functions from object-construction functions without relying only on the verb.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100