Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Apply AlignAssignmentStatement overhaul from PR #2132#2166

Closed
Copilot wants to merge 3 commits into
mainPowerShell/PSScriptAnalyzer:mainfrom
copilot/fix-build-errorPowerShell/PSScriptAnalyzer:copilot/fix-build-errorCopy head branch name to clipboard
Closed

Apply AlignAssignmentStatement overhaul from PR #2132#2166
Copilot wants to merge 3 commits into
mainPowerShell/PSScriptAnalyzer:mainfrom
copilot/fix-build-errorPowerShell/PSScriptAnalyzer:copilot/fix-build-errorCopy head branch name to clipboard

Conversation

Copilot AI commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Ports the AlignAssignmentStatement rule rewrite from PR #2132 to fix several correctness and performance issues in hashtable alignment, and adds enum member value alignment.

Rule fixes

  • Expression keys with =: e.g. ($Key = 5) = "Value" previously caused Start position cannot be before End position — the rule was finding the wrong = token
  • Inline comments erased: Key <#comment#> = "Value" had the comment stripped during auto-correction
  • Quadratic perf: Per-KVP linear token scan made large files (~1000 hashtables × 100 KVP) take 457s → now ~2s via a single pre-pass token index

New features

  • Enum member value alignment (CheckEnums, IncludeValuelessEnumMembers, AlignEnumMemberWithInterveningComment)
  • AlignHashtableKvpWithInterveningComment setting to opt into aligning KVPs with intervening comments
  • Partial alignment: invalid/multi-line KVPs are now skipped individually rather than bailing on the entire hashtable

Breaking change

All new settings default to $true. Previously CheckHashtable defaulted to $false, so the rule was effectively a no-op by default; enabling it now does something meaningful.

Also fixed

Minor typos in comments and docs (trviallytrivially, it'sits, Enum'sEnums).

Copilot AI and others added 3 commits March 17, 2026 23:07
Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
@andyleejordan

Copy link
Copy Markdown
Member

Copilot bad.

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.