-
Notifications
You must be signed in to change notification settings - Fork 0
Comparing changes
Open a pull request
base repository: iRon7/PSScriptAnalyzer
base: main
head repository: PowerShell/PSScriptAnalyzer
compare: main
- 7 commits
- 33 files changed
- 6 contributors
Commits on May 4, 2026
-
Improve pipeline indentation handling in UseConsistentIndentation rule (
PowerShell#2173) * Improve pipeline indentation handling in UseConsistentIndentation rule * Fix over-indentation when multiple openers appear on the same line
Configuration menu - View commit details
-
Copy full SHA for d97ddd4 - Browse repository at this point
Copy the full SHA d97ddd4View commit details
Commits on May 7, 2026
-
Prevent duplicate rule ID suppression errors in
-Fixand DSC scenar……ios (PowerShell#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 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 940024a - Browse repository at this point
Copy the full SHA 940024aView commit details -
Settings file creation and validation (PowerShell#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 <[email protected]> * Add Copilot review suggestions --------- Co-authored-by: Sean Wheeler <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9c04a44 - Browse repository at this point
Copy the full SHA 9c04a44View commit details
Commits on May 15, 2026
-
Add new MissingTryBlock rule (PowerShell#2179)
* PowerShell#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 <[email protected]> * Updated tests for MissingTryBlock rule to reflect severity change from Error to Warning. * Update Rules/MissingTryBlock.cs Co-authored-by: Copilot <[email protected]> * Grammar: “which is likely a mistake and result in … error” is ungrammatical. * Update Rules/Strings.resx Co-authored-by: Copilot <[email protected]> * Update Rules/MissingTryBlock.cs Co-authored-by: Copilot <[email protected]> * minor but worthwhile * Update docs/Rules/MissingTryBlock.md Co-authored-by: Sean Wheeler <[email protected]> * 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 <[email protected]> * Update Tests/Rules/MissingTryBlock.tests.ps1 Co-authored-by: Liam Peters <[email protected]> * Update Rules/MissingTryBlock.cs Co-authored-by: Liam Peters <[email protected]> * Update Rules/MissingTryBlock.cs Co-authored-by: Liam Peters <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Sean Wheeler <[email protected]> Co-authored-by: Liam Peters <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 97f30d6 - Browse repository at this point
Copy the full SHA 97f30d6View commit details
Commits on May 18, 2026
-
Add new AvoidUsingArrayList rule (PowerShell#2174)
* Implemented the AvoidUsingArrayList rule to warn when the ArrayList class is used in PowerShell scripts. Added tests for both violations and non-violations of this rule. Updated documentation to include the new rule and its guidelines. * Testing-Commit-CSpell-issue * Apply suggestion from @liamjpeters I clearly used several other rules as a kind of template...🤪 Co-authored-by: Liam Peters <[email protected]> * Update docs/Rules/AvoidUsingArrayList.md Co-authored-by: Liam Peters <[email protected]> * Updated rule help * Changed "unintentionally" * Update Rules/AvoidUsingArrayList.cs Co-authored-by: Liam Peters <[email protected]> * Update Tests/Rules/AvoidUsingArrayList.tests.ps1 Co-authored-by: Liam Peters <[email protected]> * ArrayListName could be null * Resolved camelCase * Remove ComponentModel namespace * Fixed tests * Updated Tests * fixed and tested empty (dynamic) BoundParameter * Robuster Pester tests * Configurable (enable by default) * Fixed ConstantValue null check test and rule * Better UsingStatements handling and disable AvoidUsingArrayList by default * `[ArrayList]::new()` without a `using namespace System.Collections` * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * Resolve Copilot suggestions and resolved `Method not found: ScriptBlockAst.get_UsingStatements()` error --------- Co-authored-by: Liam Peters <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6dadae3 - Browse repository at this point
Copy the full SHA 6dadae3View commit details -
Add new InvalidMultiDotValue rule (PowerShell#2180)
* Add new InvalidMultiDotValue rule * Fixed several issues as commented by Liam. Co-authored-by: Copilot <[email protected]> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * Improved wording based on Copilot suggestions. * Update docs/Rules/InvalidMultiDotValue.md Co-authored-by: Sean Wheeler <[email protected]> * Update docs/Rules/InvalidMultiDotValue.md Co-authored-by: Sean Wheeler <[email protected]> * **opt-in by default.** * Remove dead code and change `PSAvoidExclaimOperator` from documentation --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]> Co-authored-by: Sean Wheeler <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for eb6cebe - Browse repository at this point
Copy the full SHA eb6cebeView commit details -
Add new AvoidDynamicallyCreatingVariableNames rule (PowerShell#2178)
* 1st commit * Avoid dynamic variable names rule implementation and tests * Removed `using System.Linq;` and added some tests * Covering Liam's feedback Co-authored-by: Copilot <[email protected]> * Update docs/Rules/AvoidDynamicallyCreatingVariableNames.md Co-authored-by: Copilot <[email protected]> * Update docs/Rules/AvoidDynamicallyCreatingVariableNames.md Co-authored-by: Copilot <[email protected]> * Update Rules/Strings.resx Co-authored-by: Copilot <[email protected]> * Corrected alphabetical order of rules in README.md * Corrected $ruleMessage in Test Co-authored-by: Copilot <[email protected]> * Changed newVariableAst.Parent.Extent to newVariableAst.Extent * Made rule configurable (disabled) and updated documentation and tests accordingly. Increased number of information tests to 20 in Get-ScriptAnalyzerRule tests. * Change rule name from PSAvoidExclaimOperator to PSAvoidDynamicallyCreatingVariableNames in documentation. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4b0117c - Browse repository at this point
Copy the full SHA 4b0117cView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...main