Fix NRE when custom rules omit optional properties in diagnostics by rjmholt · Pull Request #1715 · PowerShell/PSScriptAnalyzer
PowerShell / PSScriptAnalyzer Public
-
Notifications
You must be signed in to change notification settings - Fork 409
Merged
Conversation
rjmholt
commented
Sep 16, 2021
rjmholt
commented
Contributor
PR Summary
Fixes #1714.
These changes allow custom rules to emit diagnostics (or PSObjects that turn into diagnostics) with optional properties unset.
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
rjmholt added 3 commits
rjmholt
requested review from
JamesWTruher and
bergmeister
bergmeister
approved these changes
bergmeister
left a comment
bergmeister
left a comment
Collaborator
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only suggestion is to replace hard-coded property names with code references using things like e.g. nameof. Also, should we try to make the property query case insensitive for the property name itself as I think at the moment it'd be case sensitive
JamesWTruher
approved these changes
JamesWTruher
merged commit
a42ab5f
into
PowerShell:master
rjmholt
deleted the
customrule-fix-nre
branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment