Skip to content

🩹 [Patch]: Linting passes on all platforms#25

Open
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
mainfrom
fix/24-psavoidlonglines
Open

🩹 [Patch]: Linting passes on all platforms#25
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
mainfrom
fix/24-psavoidlonglines

Conversation

@MariusStorhaug
Copy link
Copy Markdown
Member

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented May 11, 2026

The Lint-SourceCode and Lint-Module CI jobs now pass on Linux, macOS, and Windows. All PSAvoidLongLines violations that blocked the pipeline after PR #18 was merged have been resolved by extracting long error message strings into local variables and splitting long inline conditionals across multiple lines.

Fixed: Linting no longer fails on any platform

PSScriptAnalyzer reported a PSAvoidLongLines violation (line length > 120 characters) in three source files, causing every platform leg of both Lint-SourceCode and Lint-Module to exit with code 1 and preventing Get-TestResults from completing successfully.

The affected lines were all throw statements with long interpolated error messages and one long inline if/else expression used to set an HMAC key. Each has been reformatted — long messages extracted into a $message variable, and the inline conditional split across multiple lines. No error types, parameter names, function signatures, or observable behaviors changed.

All 31 Pester tests pass locally after the reformatting.

Technical Details

  • New-Jwt.ps1 — 7 violations fixed: throw messages on lines 80, 90, 101, 106, 128, 144 extracted to $message variables; $hmacsha256.Key = if (...) {...} else {...} on line 132 split across multiple lines.
  • Test-Jwt.ps1 — 6 violations fixed: same patterns as New-Jwt.ps1 (lines 78, 88, 103, 121, 125, 154).
  • ConvertTo-Base64UrlString.ps1 — 2 violations fixed: .NOTES comment wrapped at a word boundary (line 24); throw message extracted via an intermediate $type variable to stay within 120 chars (line 51).

@MariusStorhaug Marius Storhaug (MariusStorhaug) added the Patch Small fixes or improvements label May 11, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review May 11, 2026 23:24
Copilot AI review requested due to automatic review settings May 11, 2026 23:24
@github-actions
Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This patch addresses CI lint failures caused by PSScriptAnalyzer’s PSAvoidLongLines rule, ensuring linting succeeds across Linux/macOS/Windows by shortening previously overlong lines without changing functional behavior.

Changes:

  • Refactored long throw messages in New-Jwt and Test-Jwt into intermediate $message variables.
  • Reformatted the inline HS256 key assignment ($hmacsha256.Key = if (...) { ... } else { ... }) into a multi-line if/else expression.
  • Wrapped a long comment-based help .NOTES line and shortened a throw statement in ConvertTo-Base64UrlString.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/functions/public/Test-Jwt.ps1 Breaks up long throw-message lines and reformats HS256 key assignment to satisfy PSAvoidLongLines.
src/functions/public/New-Jwt.ps1 Breaks up long throw-message lines and reformats HS256 key assignment to satisfy PSAvoidLongLines.
src/functions/public/ConvertTo-Base64UrlString.ps1 Wraps long help text and refactors an ArgumentException message to avoid long lines.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

throw [System.ArgumentException]::new("ConvertTo-Base64UrlString requires string or byte array input, received $($InputObject.GetType())")
$type = $InputObject.GetType()
$message = "ConvertTo-Base64UrlString requires string or byte array input, received $type"
throw [System.ArgumentException]::new($message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Patch Small fixes or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix PSAvoidLongLines violations blocking CI in New-Jwt, Test-Jwt, and ConvertTo-Base64UrlString

2 participants