PowerShell / PSScriptAnalyzer

Download ScriptAnalyzer from PowerShellGallery
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
MIT License
1.8k stars 365 forks source link

Rule for unused rule suppressions #1894

Open iRon7 opened 1 year ago

iRon7 commented 1 year ago

Currently there are quiet some reason to suppress a certain rule as e.g.:

There are also a few reasons a rule suppression might get obsolete, e.g.:

In all the situations I would like to be warned that there is a Diagnostics.CodeAnalysis.SuppressMessageAttribute that is no longer required.

This will avoid a scenario were:

bergmeister commented 1 year ago

Good idea, I wonder if this can be part of the command log in general because in theory it should be possible to annotate whether a suppression entry caused a suppression and if not call that out. A rule would need to make assumptions or reverse engineer the suppression logic, therefore I'd rather do this as part of the suppression logic itself