PowerShell / PowerShell/PSScriptAnalyzer

Rule for unused rule suppressions

Open
#1,894 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Rules Issue-Enhancement Up-for-Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

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

  • Not be able to (easily) work around an issue
  • False positives

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

  • The script issue gets resolved
    e.g. all the Write-Host cmdlet are been replaced which a different cmdlet
  • The script issue doesn't anymore apply
    e.g. a PSReviewUnusedParameter parameter get completely depreciated or a variable gets (also) used in scope
  • PSScriptAnalyzer update
    e.g. a false positive might get fixed in a newer version of PSScriptAnalyzer

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:

  • Someone resolves an analyzer issue (e.g. PSAvoidUsingWriteHost ) in a particular script but forgets to remove the SuppressMessageAttribute from the annotations
  • Someone else updates the same script but unseen reintroduces the analyzer issue (e.g. Write-Host ) again.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by locating how Diagnostics.CodeAnalysis.SuppressMessageAttribute and analyzer diagnostics are handled, then define how obsolete suppressions should be detected and reported for the listed scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.