Add UseConsistentParametersKind rule by Haimasker · Pull Request #2149 · PowerShell/PSScriptAnalyzer
Conversation
-
Consistent function parameters definition
-
Rule is disabled by default
-
Possible types of preferred function parameters are: "Inline", "ParamBlock"
PR Summary
This PSScriptAnalyzer rule enforces uniform parameter definitions ("Inline" or "ParamBlock") across functions, improving code readability and maintainability.
Key Benefits:
- Consistency: Standardizes parameter style project-wide, making code easier to read and extend.
- Advanced Attributes: param block provides CmdletBinding(), OutputType(), and other advanced attributes. On the other hand, these attributes can be blocked by using inline parameters.
PR Checklist
- PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- Summarized changes
- Change is not breaking
- Make sure all
.cs,.ps1and.psm1files have the correct copyright header - Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
- This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:to the beginning of the title and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution and sorry for late review. I added Andy as well as he is the main code owner.
The rule might be a bit controversial as for some folks there is no 'correct' kind, therefore I suggest to name rule UseConsistentParametersKind for consistency with other rule names
Haimasker
changed the title
Add UseCorrectParametersKind rule
Add UseConsistentParametersKind rule
* Consistent function parameters definition * Rule is disabled by default * Possible types of preferred function parameters are: "Inline", "ParamBlock"
@Haimasker Already pinged @andyleejordan internally a couple weeks ago as he is main maintainer, it's on his list, please be patient.