Skip to content

PR 1/4: Remove trailing whitespace from all script files#28

Open
StrongWind1 wants to merge 1 commit intoCompassSecurity:mainfrom
StrongWind1:fix/trailing-whitespace
Open

PR 1/4: Remove trailing whitespace from all script files#28
StrongWind1 wants to merge 1 commit intoCompassSecurity:mainfrom
StrongWind1:fix/trailing-whitespace

Conversation

@StrongWind1
Copy link

Branch: fix/trailing-whitespace
Base: main

Disclaimer: I used Claude Opus 4.6 to help with this code review and to draft these changes. I reviewed everything before submitting.


Hey there! This is the first of four small PRs to tidy up some things I noticed while running PSScriptAnalyzer against the codebase. I split everything into separate PRs to keep reviews manageable, and this one is the simplest so it can be merged on its own whenever you're ready.

What this does

Removes 695 instances of invisible trailing spaces and tabs from line endings across all 16 .psm1 and .ps1 files. Nothing else changes. The diff is 715 lines in, 715 lines out, all whitespace only.

I used PSScriptAnalyzer's built in auto fix:

Invoke-ScriptAnalyzer -Path ./modules/ -Recurse -IncludeRule PSAvoidTrailingWhitespace -Fix

Super safe change. The tool just strips trailing whitespace and nothing else. No functional code was touched.

PSScriptAnalyzer is Microsoft's official static analysis and linting tool for PowerShell. Think of it as the equivalent of ruff for Python or ESLint for JavaScript. It ships with the VS Code PowerShell extension and checks scripts against 75 built in best practice rules covering code quality, naming conventions, security, compatibility, and formatting.

I ran it with all rules enabled and all severity levels (Error, Warning, Information) to get a full picture. This PR takes care of the most common finding, and the rest are covered in the follow up PRs.

This is PR 1 of 4 and ideally should be merged first. The other three PRs are stacked on top of this one:

  1. This PR removes trailing whitespace (cosmetic, zero risk)
  2. PR 2 addresses PSScriptAnalyzer code quality warnings (null comparisons, dead variables, empty catch blocks, encoding, verb naming)
  3. PR 3 fixes a handful of logic bugs found during the review (wrong variables, missing null checks, uninitialized variables)
  4. PR 4 normalizes file encoding (ASCII with CRLF line endings)

Each PR builds on the previous one, so merging them in order keeps everything clean and conflict free. However, you can cherry pick individual commits if you would like.

Thanks for taking a look!

Run PSScriptAnalyzer with -Fix to automatically remove 695 instances
of trailing whitespace across all .psm1 and .ps1 files.

Rule: PSAvoidTrailingWhitespace (Information)
No functional changes — whitespace-only diff.
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.

1 participant