Skip to content

Bump PSScriptAnalyzer to 1.25.0 - #32

Merged
stefanvacareanu7 merged 1 commit into
masterfrom
chore/automated-tool-update
Jul 30, 2026
Merged

Bump PSScriptAnalyzer to 1.25.0#32
stefanvacareanu7 merged 1 commit into
masterfrom
chore/automated-tool-update

Conversation

@stefanvacareanu7

Copy link
Copy Markdown

Summary

  • Bumps psscriptanalyzer.version from 1.24.0 to 1.25.0 (latest release, confirmed present on both the PowerShell Gallery and the upstream GitHub tag PowerShell/PSScriptAnalyzer/archive/1.25.0.tar.gz).
  • Regenerates docs/patterns.json and docs/description/* via scripts/generateDocs.sh/install.ps1:
    • 5 new rules added, all landing enabled: false (none are security-sensitive, so left disabled per existing policy — no rule was added to $enabledRules/subcategory arrays in install.ps1): psavoidreservedwordsasfunctionnames, psuseconsistentparametersetname, psuseconsistentparameterskind, psuseconstrainedlanguagemode, psusesinglevaluefrompipelineparameter.
    • No rules removed.
    • A handful of existing rule descriptions refreshed with upstream wording/typo fixes.
  • Fixed a generator gap in install.ps1: upstream's Get-ScriptAnalyzerRule now returns descriptions over 500 characters for AvoidUsingCmdletAliases and AvoidUsingInvokeExpression, which broke codacy-plugins-test's "descriptions must be ≤500 chars" check. Added truncation (to 497 chars + ...) for any description over the limit, since this constraint isn't currently enforced anywhere else in the generator and would otherwise silently break future updates too.
  • Left the base image (mcr.microsoft.com/powershell:lts-7.4-alpine-3.17) and CircleCI orb versions unchanged — 1.25.0 requires PowerShell Core ≥ 7.4.6, and the current base image tag already resolves to 7.4.7, so no bump needed there.

Validation

  • docker build -f Dockerfile -t codacy-psscriptanalyzer . — succeeds.
  • codacy-plugins-test run locally against the freshly built image:
    • sbt "runMain codacy.plugins.DockerTest json codacy/codacy-psscriptanalyzer:latest" — all tests passed (this initially failed on the two overlong descriptions above; passed after the install.ps1 truncation fix).
    • sbt "runMain codacy.plugins.DockerTest pattern codacy/codacy-psscriptanalyzer:latest" — all tests passed.
    • sbt "runMain codacy.plugins.DockerTest multiple codacy/codacy-psscriptanalyzer:latest" — all tests passed (run_multiple_tests: true, matching what CI runs).

Test plan

  • docker build succeeds
  • codacy-plugins-test JsonTests pass
  • codacy-plugins-test PatternTests pass
  • codacy-plugins-test MultipleTests pass
  • CI checks green

🤖 Generated with Claude Code

Regenerates docs/patterns.json and docs/description/* via scripts/generateDocs.sh
against the new module version, adding 5 new rules (disabled by default,
matching current policy for non-security rules) and refreshing upstream rule
descriptions/docs.

Also truncates rule descriptions over 500 chars in install.ps1: upstream's
Get-ScriptAnalyzerRule now returns longer text for AvoidUsingCmdletAliases and
AvoidUsingInvokeExpression, which broke codacy-plugins-test's description
length check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR successfully updates PSScriptAnalyzer to version 1.25.0 and incorporates five new rules, correctly configured as disabled by default. While the code is up to standards according to Codacy, there is a potential runtime error in the install.ps1 script due to a missing null check when processing rule descriptions. Additionally, minor typos in the documentation examples should be corrected to maintain quality. The proposed truncation logic for long descriptions is a good addition but requires validation as noted in the test plan.

Test suggestions

  • Verify that rule descriptions exceeding 500 characters are correctly truncated with an ellipsis in description.json
  • Confirm that all 5 new rules are initialized with 'enabled': false in patterns.json
  • Validate that the tool version in patterns.json matches the content of psscriptanalyzer.version
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that rule descriptions exceeding 500 characters are correctly truncated with an ellipsis in description.json
2. Confirm that all 5 new rules are initialized with 'enabled': false in patterns.json
3. Validate that the tool version in patterns.json matches the content of psscriptanalyzer.version

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread install.ps1
$title = getTitle $patternNameCamelCased ;
if($title -eq $patternNameCamelCased) { Write-Output "$patternNameCamelCased"; $count = $count+1;}
$description = $pat.Description ;
if($description.Length -gt 500) { $description = $description.Substring(0, 497) + '...' } ;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Accessing the .Length property on $description without a null check will cause a runtime error if a rule lacks a description. This might be a simple fix:

Suggested change
if($description.Length -gt 500) { $description = $description.Substring(0, 497) + '...' } ;
if ($description -and $description.Length -gt 500) { $description = $description.Substring(0, 497) + '...' }

Comment on lines +47 to +48
# Inorrect
function f([Parameter()]$FirstParam) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ LOW RISK

Nitpick: There is a typo in the documentation: 'Inorrect' should be 'Incorrect'.

Suggested change
# Inorrect
function f([Parameter()]$FirstParam) {
# Incorrect

@stefanvacareanu7
stefanvacareanu7 merged commit a420f4c into master Jul 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants