Repository navigation
Avoid dropping inline comments in control_statement fixes - #6545
theamodhshetty wants to merge 1 commit into
Conversation
Generated by 🚫 Danger |
|
Why not remove the parentheses while keeping the comment as is? |
|
Thanks, that makes sense. I pushed I also checked the same trivia path for Validation rerun:
|
SimplyDanny
left a comment
There was a problem hiding this comment.
Let's have a few more test cases. Quite a few cases are currently not covered.
ba5b107 to
7a59172
Compare
|
@SimplyDanny Could you re-review this when you have time? Head |
control_statementautocorrection could delete comments while removing parentheses, or drop a line-comment newline so that a following brace/elsebecame part of the comment.This preserves comments before and after conditions, around statement keywords and parentheses, and at the end of a condition list. It also visits nested statements and
else ifbranches during correction. Parentheses are still removed rather than skipping commented cases.Correction coverage now includes
if,guard,while,switch, andcatch; block and line comments; multiple conditions; and nested statements. The branch is rebased onto currentmain, uses current example macros, and places the changelog entry under Main with the requested Markdown line break.Validation:
swift test --filter ControlStatementRuleGeneratedTestspasses. Both affected rule suites also pass in a temporary combined checkout (swift test --filter 'ControlStatementRuleGeneratedTests|VerticalParameterAlignmentOnCallRuleGeneratedTests'). Strict lint passes, and a manualswiftlint lint --fix --only-rule control_statementreproduction preserves each comment and the newline beforeelse. Whitespace checks pass with Markdown hard-break trailing spaces allowed. Full platform validation remains with CI.Closes #6207.