Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PowerShell/PSScriptAnalyzer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.25.0
Choose a base ref
...
head repository: PowerShell/PSScriptAnalyzer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 6 commits
  • 30 files changed
  • 6 contributors

Commits on Mar 20, 2026

  1. Configuration menu
    Copy the full SHA
    9b55ac2 View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2026

  1. Sync docs edits from docs repo (#2170)

    * Sync docs edits from docs repo
    
    * Apply suggestions from code review
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    sdwheeler and Copilot authored Apr 2, 2026
    Configuration menu
    Copy the full SHA
    a143b9f View commit details
    Browse the repository at this point in the history

Commits on May 4, 2026

  1. Improve pipeline indentation handling in UseConsistentIndentation rule (

    #2173)
    
    * Improve pipeline indentation handling in UseConsistentIndentation rule
    
    * Fix over-indentation when multiple openers appear on the same line
    liamjpeters authored May 4, 2026
    Configuration menu
    Copy the full SHA
    d97ddd4 View commit details
    Browse the repository at this point in the history

Commits on May 7, 2026

  1. Prevent duplicate rule ID suppression errors in -Fix and DSC scenar…

    …ios (#2181)
    
    * Enhance suppression error handling in ScriptAnalyzer and add tests for unapplied suppression errors
    
    * Skip new -Fix suppression test under Library Usage harness
    
    The `Library Usage` describe block in `LibraryUsage.tests.ps1` (only
    active on Windows PowerShell 5.1, since it's gated `-Skip:$IsCoreCLR`)
    re-runs `RuleSuppression.tests.ps1` against a hand-rolled
    `Invoke-ScriptAnalyzer` wrapper that drives the analyzer as a .NET
    library. That wrapper plugs in `PesterTestOutputWriter`, whose
    `WriteError` is intentionally a no-op:
    
        public void WriteError(ErrorRecord error)
        {
            // We don't write errors to avoid misleading
            // error messages in test output
        }
    
    So the unapplied-suppression `ErrorRecord` we now emit during the final
    `-Fix` pass never reaches `-ErrorVariable`, and `$fixErr | Should
    -HaveCount 1` fails with "Expected a collection with size 1, but got an
    empty collection". The behaviour itself is correct - the assertion is
    just unobservable through this test harness.
    
    Mark the new `It` block `-Skip:$testingLibraryUsage`, matching the
    existing pattern already used by the `Bad Rule Suppression` and
    `External Rule Suppression` contexts in the same file for the same
    reason. The regular pwsh and WinPS runs of `RuleSuppression.tests.ps1`
    (which `[+]` in the failing CI log) continue to exercise the assertion.
    
    The new `UseDSCResourceFunctions.tests.ps1` test isn't dot-sourced by
    `LibraryUsage.tests.ps1`, so it doesn't need the same guard.
    
    Drafted by Copilot (Claude Opus 4.7).
    
    * Add copilot review suggestions
    
    ---------
    
    Co-authored-by: Andy Jordan <2226434+andyleejordan@users.noreply.github.com>
    liamjpeters and andyleejordan authored May 7, 2026
    Configuration menu
    Copy the full SHA
    940024a View commit details
    Browse the repository at this point in the history
  2. Settings file creation and validation (#2176)

    * Add RuleOptionInfo class and update RuleInfo to include options for configurable rules
    
    * Add Test and New Cmdlets for PSScriptAnalyzer Settings Management
    
    - Implemented `New-ScriptAnalyzerSettingsFile` cmdlet to create a new PSScriptAnalyzer settings file, with options for presets and overwriting existing files.
    - Added `Test-ScriptAnalyzerSettingsFile` cmdlet to validate settings files, checking for parseability, rule existence, and valid options.
    - Created comprehensive tests for both cmdlets to ensure functionality and error handling.
    - Updated module manifest to export the new cmdlets.
    - Added documentation for both cmdlets, including usage examples and parameter descriptions.
    - Enhanced error messages in the strings resource file for better clarity during validation failures.
    
    * Enhance ScriptAnalyzer settings file validation and documentation
    
    - Update Helper.cs to return null for empty output paths instead of an empty array.
    - Add new error message for invalid option types in Strings.resx.
    - Extend tests for New-ScriptAnalyzerSettingsFile to check for new keys: CustomRulePath, IncludeDefaultRules, and RecurseCustomRulePath.
    - Modify Test-ScriptAnalyzerSettingsFile tests to validate output and error handling for various scenarios, including type mismatches and invalid values.
    - Improve documentation for New-ScriptAnalyzerSettingsFile and Test-ScriptAnalyzerSettingsFile to clarify behavior and parameters, including handling of custom rules and output format.
    
    * Apply docs suggestions from Sean's review
    
    Co-authored-by: Sean Wheeler <sean.wheeler@microsoft.com>
    
    * Add Copilot review suggestions
    
    ---------
    
    Co-authored-by: Sean Wheeler <sean.wheeler@microsoft.com>
    liamjpeters and sdwheeler authored May 7, 2026
    Configuration menu
    Copy the full SHA
    9c04a44 View commit details
    Browse the repository at this point in the history

Commits on May 15, 2026

  1. Add new MissingTryBlock rule (#2179)

    * #2098 Add new MissingTryBlock rule
    
    * Changed severity level of MissingTryBlock rule from Error to Warning in the rule definition and resolved copy-pasta in the rule description.
    
    Co-authored-by: Copilot <copilot@github.com>
    
    * Updated tests for MissingTryBlock rule to reflect severity change from Error to Warning.
    
    * Update Rules/MissingTryBlock.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Grammar: “which is likely a mistake and result in … error” is ungrammatical.
    
    * Update Rules/Strings.resx
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update Rules/MissingTryBlock.cs
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * minor but worthwhile
    
    * Update docs/Rules/MissingTryBlock.md
    
    Co-authored-by: Sean Wheeler <sean.wheeler@microsoft.com>
    
    * Applied feedback from @andrewconnell to add a note about the rule not being enabled by default, and to add a note about potential false positives with functions named "catch" or "finally". Also added a test context for when the rule is disabled. Updated the rule implementation to inherit from ConfigurableRule and set Enable to false in the constructor. Updated the AnalyzeScript method to be an override, and added overrides for GetCommonName, GetDescription, GetName, GetSeverity, and GetSourceName.
    
    * Update docs/Rules/MissingTryBlock.md
    
    Co-authored-by: Liam Peters <liamjpeters@gmail.com>
    
    * Update Tests/Rules/MissingTryBlock.tests.ps1
    
    Co-authored-by: Liam Peters <liamjpeters@gmail.com>
    
    * Update Rules/MissingTryBlock.cs
    
    Co-authored-by: Liam Peters <liamjpeters@gmail.com>
    
    * Update Rules/MissingTryBlock.cs
    
    Co-authored-by: Liam Peters <liamjpeters@gmail.com>
    
    ---------
    
    Co-authored-by: Copilot <copilot@github.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: Sean Wheeler <sean.wheeler@microsoft.com>
    Co-authored-by: Liam Peters <liamjpeters@gmail.com>
    5 people authored May 15, 2026
    Configuration menu
    Copy the full SHA
    97f30d6 View commit details
    Browse the repository at this point in the history
Loading