PowerShell / PowerShell/PSScriptAnalyzer

Add Get-ScriptAnalyzerSetting cmdlet to generalize a way of displaying collections of rules

Open
#1,740 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary of the new feature

As a user I want to be able to discover what rules are defined in a PSD1 file, especially those that are included with PSScriptAnalyzer. I would also like to point to any PSD1 file containing rules and get the same output.

Proposed technical implementation details (optional)

Example 1 - Get the settings in the CmdletDesign PSD1 file that is included with PSScriptAnalyer
Get-ScriptAnalyzerSetting -Settings CmdletDesign

The default output should be the same as running Get-ScriptAnalyzerRule on each rule in the PSD1.

Example 2 - Get the settings in the CmdletDesign PSD1 file and show the configuration
Get-ScriptAnalyzerSetting -Settings CmdletDesign -Configuration

Adding the configuration switch should display the rule name and any custom configuration settings for rules that allow configuration.

Example 3 - Get the settings in a user provided PSD1 file
Get-ScriptAnalyzerSetting -Path /path/to/myrules.psd1

The output should be the same and the Path parameter set should also allow the Configuration parameter.

Other considerations

If the PSD1 file can contain both inclusions and exclusions, then the out needs to indicate which rules are included and which are excluded. Consider grouping by include/exclude.

Current version = 1.20.0.

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 by reviewing the existing Get-ScriptAnalyzerRule behavior and the CmdletDesign PSD1 example described in the issue. Define how Get-ScriptAnalyzerSetting should handle the Settings and Path parameter sets, Configuration output, and included versus excluded rules; done means both built-in and user-provided PSD1 files produce consistent, documented output.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.