Skip to content

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

Draft
Dr. Skill Issue (DrSkillIssue) wants to merge 5 commits into
PowerShell:mainfrom
DrSkillIssue:format-miss-keywords
Draft

WIP: Fix: PSUseConsistentWhitespace formatting for do-while, unary operators, and native commands#2114
Dr. Skill Issue (DrSkillIssue) wants to merge 5 commits into
PowerShell:mainfrom
DrSkillIssue:format-miss-keywords

Conversation

@DrSkillIssue

@DrSkillIssueDr. Skill Issue (DrSkillIssue) commented Jun 17, 2025

Copy link
Copy Markdown

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

@DrSkillIssueDr. Skill Issue (DrSkillIssue) changed the title Fix: #2095 - UseConsistentWhitespace formatting for do-while/do-until loops and unary operatorsWIP: Fix: #2095 - UseConsistentWhitespace formatting for do-while/do-until loops and unary operatorsJun 17, 2025
@DrSkillIssue

Dr. Skill Issue (DrSkillIssue) commented Jun 17, 2025

Copy link
Copy Markdown
Author

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.

@DrSkillIssueDr. Skill Issue (DrSkillIssue) changed the title WIP: Fix: #2095 - UseConsistentWhitespace formatting for do-while/do-until loops and unary operatorsWIP: Fix: PSUseConsistentWhitespace formatting for do-while, unary operators, and native commandsJun 17, 2025
@bergmeister

Copy link
Copy Markdown
Collaborator

Dr. Skill Issue (@DrSkillIssue) Can you please resolve merge conflict and re-test please. This is due to PR #2140 , which tweaked the logic of the same area of the rule you modify

Sign up for freeto 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

@DrSkillIssue@bergmeister