GeezerVison is showing github.com — Filter Invoke-ScriptAnalyzer results by diagnostic severity by Copilot · Pull Request #2268 · PowerShell/PSScriptAnalyzer
Conversation
Copilot
AI
commented
Oct 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Invoke-ScriptAnalyzer -Severity filtered rules by their configured severity instead of filtering the diagnostics those rules emitted. This could hide diagnostics whose severity differed from the rule’s severity, including errors from custom rules.
- Filter diagnostics: Apply
-Severity to emitted diagnostic records, including parse errors and suppressed records.
- Run rules independently: Severity no longer determines which rules execute.
For example, -Severity Error now includes an Error diagnostic emitted by a custom rule configured as Warning:
Invoke-ScriptAnalyzer -ScriptDefinition 'Invoke-Something' `
-CustomRulePath ./CustomRule.psm1 `
-Severity Error
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Copilot
AI
changed the title
[WIP] Fix -Severity parameter to filter diagnostics correctly
Filter Invoke-ScriptAnalyzer results by diagnostic severity
Oct 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The severity-filter change lacks regression tests confirming correct filtering and suppression metadata preservation under both -SuppressedOnly and -IncludeSuppressed.
1 open issue
What changed in this PR
Updates Invoke-ScriptAnalyzer -Severity to filter emitted diagnostics rather than select which rules execute, aligning behavior with the documented contract and addressing #2156.
Changes:
- Filters diagnostics by severity, including parse errors and suppressed records.
- Adds a regression test for a custom rule whose diagnostic severity differs from its configured severity.
- Clarifies the severity parameter’s source-code documentation.
| File |
Description |
| Tests/Engine/CustomizedRule.tests.ps1 |
Tests custom-rule diagnostic severity filtering. |
| Engine/ScriptAnalyzer.cs |
Moves severity filtering from rule selection to diagnostic output. |
| Engine/Commands/InvokeScriptAnalyzerCommand.cs |
Corrects the severity property’s documentation comment. |
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🟡 Changes recommended...
Added coverage for both suppression modes, severity filtering, and suppression metadata in 28e40a1.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues were identified for the change aligning severity filtering with its documented behavior.
1 open issue
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues are recorded for the diagnostic-severity filtering change.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
At least 1 approving review is required to merge this pull request.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|