-
Notifications
You must be signed in to change notification settings - Fork 382
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement -IncludeSuppressions parameter #1701
Changes from all commits
93a0b02
e5c48e5
a2c64a3
c99cf42
8fbbaf7
a450a42
273d0d6
bcf66f9
643ff4c
c50eed5
9548bcd
4ebe0bb
d91a6f3
5465831
ea28d2b
fdaca95
8d09ac0
50bdfa9
6e9e30c
02ccd84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ public class SuppressedRecord : DiagnosticRecord | |
public SuppressedRecord(DiagnosticRecord record, IReadOnlyList<RuleSuppression> suppressions) | ||
{ | ||
Suppression = new ReadOnlyCollection<RuleSuppression>(new List<RuleSuppression>(suppressions)); | ||
IsSuppressed = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this ever be called with a suppression list count of zero? In that case IsSuppressed really true? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very good question. I think the mere wrapping in the |
||
if (record != null) | ||
{ | ||
RuleName = record.RuleName; | ||
|
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.
Is this a bug with the original code? If I read this correctly we will take the action no matter what, but
ShouldProcess
is supposed to notify the user and not take the action in the case of-WhatIf
. this code will fix the script even with-WhatIf
. I get that it's not as big a deal for just the diagnosis part, but the fix part seems wrong.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.
Yeah I saw this and had the same thought. Definitely something we should review. If @bergmeister agrees, I can open an issue to track it so we can fix it beyond this PR.
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.
This goes back to my very first PR in PSSA, where I added the
-Fix
switch and since this is an action that changes state, I implementedShouldProcess
for it and declared that on the cmdlet. Since the-Fix
parameter is only on the-File
parameter set, I did not implement it for the-ScriptDefinition
parameter set. Original commit is here: bfa1c54Therefore I still think it's not really important here, very rarely does one run PSSA where the command would take ages and performing a dry-run would save time. Still happy to have a tracking issue