Skip to content

Commit 27e3c77

Browse files
committed
Migrate VerticalWhitespaceOpeningBracesRule to SwiftSyntax
## Summary Convert VerticalWhitespaceOpeningBracesRule to use SwiftSyntax instead of SourceKit for improved performance and better detection of empty lines after opening braces. ## Key Technical Improvements - **Enhanced trivia analysis** for accurate empty line detection after opening braces - **Proper handling of closure "in" keywords** with context-aware detection - **Improved correction logic** handling all newline types (LF, CR, CRLF) consistently - **SwiftSyntax visitor pattern** replacing regex-based detection for better accuracy - **Comprehensive token analysis** supporting all opening brace types (`{`, `[`, `(`) - **Accurate position tracking** for violation start and end positions ## Migration Details - Replaced `CorrectableRule, OptInRule` with `@SwiftSyntaxRule(correctable: true, optIn: true)` - Implemented `ViolationsSyntaxVisitor` for detecting violations in token trailing trivia - Implemented `ViolationsSyntaxRewriter` for correcting violations across different syntax contexts - Added proper handling of closures, code blocks, arrays, and tuples - Maintained exact position reporting for violation locations - Preserved all existing test cases and rule behavior
1 parent 81474e3 commit 27e3c77

File tree

2 files changed

+367
-42
lines changed

2 files changed

+367
-42
lines changed

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,48 @@
2929
* Migrate `vertical_whitespace` rule from SourceKit to SwiftSyntax for improved performance.
3030
[Matt Pennig](https://github.com/pennig)
3131

32+
* Migrate `file_header` rule from SourceKit to SwiftSyntax for improved
33+
* Migrate `closure_end_indentation` rule from SourceKit to SwiftSyntax for improved
34+
* Migrate `accessibility_label_for_image` rule from SourceKit to SwiftSyntax for improved
35+
performance and fewer false positives.
36+
[JP Simard](https://github.com/jpsim)
37+
38+
* Migrate `accessibility_trait_for_button` rule from SourceKit to SwiftSyntax for improved
39+
performance and fewer false positives.
40+
[JP Simard](https://github.com/jpsim)
41+
42+
* Migrate `expiring_todo` rule from SourceKit to SwiftSyntax for improved performance
43+
and fewer false positives.
44+
[JP Simard](https://github.com/jpsim)
45+
46+
* Migrate `closure_end_indentation` rule from SourceKit to SwiftSyntax for improved
47+
performance and fewer false positives.
48+
[JP Simard](https://github.com/jpsim)
49+
50+
* Migrate `file_header` rule from SourceKit to SwiftSyntax for improved
51+
performance and fewer false positives.
52+
[JP Simard](https://github.com/jpsim)
53+
54+
* Migrate `line_length` rule from SourceKit to SwiftSyntax for improved
55+
performance and fewer false positives.
56+
[JP Simard](https://github.com/jpsim)
57+
58+
* Migrate `statement_position` rule from SourceKit to SwiftSyntax for improved
59+
performance and fewer false positives.
60+
[JP Simard](https://github.com/jpsim)
61+
62+
* Migrate `trailing_whitespace` rule from SourceKit to SwiftSyntax for improved
63+
performance and fewer false positives.
64+
[JP Simard](https://github.com/jpsim)
65+
66+
* Migrate `vertical_whitespace_closing_braces` rule from SourceKit to SwiftSyntax for improved
67+
performance and fewer false positives.
68+
[JP Simard](https://github.com/jpsim)
69+
70+
* Migrate `vertical_whitespace_opening_braces` rule from SourceKit to SwiftSyntax for improved
71+
performance and fewer false positives.
72+
[JP Simard](https://github.com/jpsim)
73+
3274
### Bug Fixes
3375

3476
* Improved error reporting when SwiftLint exits, because of an invalid configuration file

0 commit comments

Comments
 (0)