PowerShell / PowerShell/PSScriptAnalyzer

Make custom rule name consistent

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

Nobody has claimed this yet.

Area - Rules Consider - 2.0
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Apologies if I am repeating something or if this has been discussed already. This is mostly an re-iteration of https://github.com/PowerShell/PSScriptAnalyzer/issues/1140#issuecomment-488251888

As of now, custom rule names are inconsistent across various places.

  • At first, there are no indication about function name in the ScriptRuleDocumention.md . But PSSA is completely depends on $MyInvocation.InvocationName for rule/violation name
  • I can not really have a customized rule name, it should be the name of the PS function. That gives me a weird naming of rules like Measure-Something. On the other I can ship the violation with whatever name I like which has no value and can break things.
  • While suppressing a custom rule, I will have to provide <ModuleName>\<RuleName>. That would end up something like, FooBar\Measure-Something
    • I really do not like this convention as I do not want the developer to be aware of the module name or the function name.
  • It gets worst further, While filtering a rule, I can not follow the same convention, it has to be the name whatever the function name.
Invoke-ScriptAnalyzer -IncludeRule Measure-Something -ExcludeRule Measure-SomethingElse

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

Start with ScriptRuleDocumentation.md and the Invoke-ScriptAnalyzer IncludeRule/ExcludeRule and suppression behavior described here; review the linked issue discussion for prior context. Done means the naming convention for custom rules is decided and applied consistently across documentation, violation names, suppression, and filtering.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.