Skip to content

WIP: Fix: PSUseConsistentWhitespace formatting for do-while, unary operators, and native commands #2114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DrSkillIssue
Copy link

@DrSkillIssue DrSkillIssue commented Jun 17, 2025

PR Summary

Fixes multiple whitespace formatting issues in PSUseConsistentWhitespace rule

Issues Fixed:

Changes Made:

Core Fixes:

  • Added FindKeywordAfterBraceViolations to handle keywords following closing braces
  • Enhanced unary operator detection and spacing logic in FindOperatorViolations
  • Fixed FindParameterViolations to skip whitespace inside string literals
  • Added comma pattern detection in FindSeparatorViolations for native command arguments
  • Added the additional keywords to openParenKeywordAllowList: Until, Do, Else, Catch, Finally

Tests Added:

  • Added test-cases for the above-mentioned changes.

PR Checklist

@DrSkillIssue DrSkillIssue changed the title Fix: #2095 - UseConsistentWhitespace formatting for do-while/do-until loops and unary operators WIP: Fix: #2095 - UseConsistentWhitespace formatting for do-while/do-until loops and unary operators Jun 17, 2025
@DrSkillIssue
Copy link
Author

DrSkillIssue commented Jun 17, 2025

These PRs may just need closed as I couldn't reproduce the issues

PRs that were fixed with this PR

PRs that can be fixed in another PR(s) once this one is merged

Opting for multiple PRs as this one is large already.

What's Left

PR is theoretically ready but need second opinions on whether I'm missing anything and/or if I should refactor what's provided by adding a Lazy cache for TokenOperators, Nodes, and Ast lookups.

@DrSkillIssue DrSkillIssue changed the title WIP: Fix: #2095 - UseConsistentWhitespace formatting for do-while/do-until loops and unary operators WIP: Fix: PSUseConsistentWhitespace formatting for do-while, unary operators, and native commands Jun 17, 2025
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