GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add some necessary contents for diagnostic suppressions. by t-lipingma · Pull Request #1694 · PowerShell/PSScriptAnalyzer Conversation
|
|
tests issue needs to solve before merge: #1695 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1e8aa16 to
2d5c96c
Compare
|
/azp run |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Azure Pipelines successfully started running 1 pipeline(s). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
2d5c96c to
3139f05
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| /// <summary> | ||
| /// ShowAll: Show the suppressed and non-suppressed message | ||
| /// </summary> | ||
| [Parameter(Mandatory = false)] |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This isn't mutually exclusive with SuppressedOnly and probably should be. What should a user expect when both are provided?
Given that -SuppressedOnly already exists and we don't want to remove or otherwise break it, we probably can't move to an enum parameter like -SuppressionPreference <Exclude | Include | SuppressedOnly>.
An alternative might be to put each switch into its own parameter set, but that starts to get complicated. We should discuss this further.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| [Parameter(Mandatory = false)] | |
| [Parameter] |
Mandatory defaults to false
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
correct, if it's not mandatory, that should just be omitted. if SuppressedOnly should not be used with this, then parameter sets should be used (and it does get complicated). Although it doesn't look to complicated at the moment it would mean an additional 2 parameter sets.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
yeah. I totally agree with you guys on that point.
If you decided to change the parameter set, let's discuss more details on the design, I'd like to help.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
From our offline conversation:
If the parameter set change is too complicated, can we check in the current solution firstly?
Yeah I think it's a good idea for us to separate out the suppression combining parts from the new parameter/feature. We can then discuss offline or over a call what the best way forward is.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
To maintain PSSA's existing design, I think we can make '-SuppressedOnly' / '-IncludeSuppressions' exclusive in the short term. What do you think about it? Look forward to your reply.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Btw, ExcludeRule and IncludeRule should also be mutually exclusive.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
make '-SuppressedOnly' / '-IncludeSuppressions' exclusive
Yeah, they should be in different parameter sets.
Btw, ExcludeRule and IncludeRule should also be mutually exclusive.
No, those can be used together to include a non-default rule while excluding a default one.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
To make -SuppressedOnly / -IncludeSuppressions exclusive.
I used the logic below:
Function TestParamSet {
[CmdletBinding(DefaultParameterSetName="File1")]
Param
(
[Parameter(Position = 0,ParameterSetName = 'File1',Mandatory = true)]
[Parameter(Position = 0,ParameterSetName = 'File2',Mandatory = true]
[switch] $Path,
[Parameter(Position = 0,ParameterSetName = 'ScriptDefinition1',Mandatory = true)]
[Parameter(Position = 0,ParameterSetName = 'ScriptDefinition2',Mandatory = true)]
[switch] $ScriptDefinition,
[Parameter(ParameterSetName = 'File1', Mandatory = false)]
[Parameter(ParameterSetName = 'ScriptDefinition1', Mandatory = false)]
[switch] $SuppressedOnly,
[Parameter(ParameterSetName = 'File2', Mandatory = true)]
[Parameter(ParameterSetName = 'ScriptDefinition2', Mandatory = true)]
[switch] $IncludeSuppressions
[Parameter(Position = 0,ParameterSetName = 'File1',Mandatory = false)]
[Parameter(Position = 0,ParameterSetName = 'File2',Mandatory = false]
[switch] $Fix,
)
Process {
#Do Nothing
}
}
so it's to say:
1、Invoke-ScriptAnalyzer C:\build.ps1 --> ParameterSetName==DefaultParameterSetName.
2、Invoke-ScriptAnalyzer -Path C:\build.ps1 --> ParameterSetName==DefaultParameterSetName.
3、Invoke-ScriptAnalyzer -Path C:\build.ps1 -SuppressedOnly --> ParameterSetName=="File1".
4、Invoke-ScriptAnalyzer -Path C:\build.ps1 -IncludeSuppressions --> ParameterSetName=="File2".
5、Invoke-ScriptAnalyzer -ScriptDefinition $tmp --> ParameterSetName=="ScriptDefinition1".
6、Invoke-ScriptAnalyzer -ScriptDefinition $tmp -SuppressedOnly --> ParameterSetName=="ScriptDefinition1"
7、Invoke-ScriptAnalyzer -ScriptDefinition $tmp -IncludeSuppressions -->ParameterSetName=="ScriptDefinition2"
LMK if you have any suggestions, Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| /// <summary> | ||
| /// ShowAll: Show the suppressed and non-suppressed message | ||
| /// </summary> | ||
| [Parameter(Mandatory = false)] |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
correct, if it's not mandatory, that should just be omitted. if SuppressedOnly should not be used with this, then parameter sets should be used (and it does get complicated). Although it doesn't look to complicated at the moment it would mean an additional 2 parameter sets.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Christoph Bergmeister (@bergmeister) could you also please take a look at this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
t-lipingma I've implemented the suppression combination part of this work in #1699. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea. I wonder if it would also be useful to the user if the DiagnosticRecord gets an additional property whether it would've been suppressed so that the user does not need to run pssa twice and do logic on two sets of records.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Add a list of suppressions for each dianostic
There was an error while loading. Please reload this page.