mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
f7f3caa50e
## Summary Convert TrailingWhitespaceRule to use SwiftSyntax instead of SourceKit for improved performance and better handling of trailing whitespace detection, especially within block comments. ## Key Technical Improvements - **Enhanced block comment detection** distinguishing between lines fully covered by block comments vs lines containing block comments with code - **Accurate whitespace detection** using CharacterSet.whitespaces for all Unicode whitespace characters, not just space and tab - **Improved comment handling** with proper detection of line-ending comments and multi-line block comment structures - **Better correction mechanism** using ViolationCorrection ranges instead of manual string reconstruction - **Line-based analysis** maintaining efficiency while providing precise violation positions ## Migration Details - Replaced `CorrectableRule` with `@SwiftSyntaxRule(correctable: true)` - Implemented `ViolationsSyntaxVisitor` pattern for line-based validation - Added `collectLinesFullyCoveredByBlockComments` to properly handle test framework comment wrapping scenarios - Distinguished between three comment scenarios: lines fully within block comments, full-line comments, and lines ending with comments - Maintained all configuration options (ignores_empty_lines, ignores_comments) - Preserved exact violation position reporting with UTF-8 offset calculations