PowerShell / PowerShell/PSScriptAnalyzer
Diagnostics.CodeAnalysis.SuppressMessageAttribute should take an array of category names
Open
@kapilmb is already working on this.
Since Mar 7, 2016.
Issue - Enhancement
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
The attribute needs to take an array of categories. I shouldn't have to add a new instance of the attribute for each category I want to suppress.
Having to write a separate line for every rule I need to suppress is extremely frustrating and verbose. Take for example this 2 line internal function:
function New-PSCredential {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword")] # It's encoded, leave me alone
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPasswordParams")] # That's the whole point of this function
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSProvideCommentHelp")] # No point for a constructor function with parameters this simple
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSProvideDefaultParameterValue")] # No point for internal functions
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseOutputTypeCorrectly")] # No point for internal functions
param([string]$UserName, [string]$EncodedPassword)
New-Object PSCredential $UserName, (ConvertTo-SecureString $EncodedPassword)
}
Seriously?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.