Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add UseConsistentParameterSetName Rule#2124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
liamjpeters wants to merge1 commit intoPowerShell:main
base:main
Choose a base branch
Loading
fromliamjpeters:#396ParameterSetNameMismatch

Conversation

@liamjpeters
Copy link
Contributor

PR Summary

Add UseConsistentParameterSetName rule to detect potential parameter set issues

Parameter set names are case-sensitive in PowerShell (unlike most other elements), which can lead to runtime errors and unexpected behavior when not handled correctly.

The rule performs five key validations:

  1. Missing DefaultParameterSetName - Warns when parameter sets are defined but no default is specified
  2. Duplicate parameter declarations - Detects parameters declared multiple times in the same parameter set
  3. DefaultParameterSetName case mismatch - Warns when the DefaultParameterSetName matches the text but not case of a defined parameter set.
  4. ParameterSetName case inconsistency - Validates consistent casing across all references to the same parameter set
  5. Invalid characters - Prevents newline characters in parameter set names.

Fixes#396 with the exception ofParameterSets that don't have at least one unique parameter.

This won't help with Dynamic Parameters.

PR Checklist

Comment on lines +18 to +22
1. **Missing DefaultParameterSetName** - Warns when parameter sets are used but no default is specified
2. **Multiple parameter declarations** - Detects when a parameter is declared multiple times in the same parameter set. This is ultimately a runtime exception - this check helps catch it sooner.
3. **Case mismatch between DefaultParameterSetName and ParameterSetName** - Ensures consistent casing
4. **Case mismatch between different ParameterSetName values** - Ensures all references to the same parameter set use identical casing
5. **Parameter set names containing newlines** - Warns against using newline characters in parameter set names

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We need to verify our understanding of parameter sets to review this better, we'll get back to it Liam!

liamjpeters reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@andyleejordanandyleejordanandyleejordan left review comments

@sdwheelersdwheelerAwaiting requested review from sdwheelersdwheeler is a code owner

@michaeltlombardimichaeltlombardiAwaiting requested review from michaeltlombardimichaeltlombardi is a code owner

@bergmeisterbergmeisterAwaiting requested review from bergmeisterbergmeister is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

New Rule Suggestion: ParameterSetName mismatch.

2 participants

@liamjpeters@andyleejordan

[8]ページ先頭

©2009-2025 Movatter.jp