* Add instructions for rule registration
* Add setup steps for coding agent using Bazel
* Make callable workflow so that its environment also applies to subsequent steps
For all first tokens in a line the newline character causing the new
line is part of the leading trivia. The only exception is the very first
token in a file because at the beginning of a file, there is no previous
line that needs to be broken.
## 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
This allows for better reusability and integration. macOS builds still run on Azure due to GitHub's limitation of up to 5 macOS jobs running concurrently.
* Add `RegexConfiguration.ExecutionMode`
To help migrate custom rules to SwiftSyntax. Not wired up yet, just the
configuration parsing and defaults. Will wire it up in the next PR.
The diff looks big, but it's 500+ lines of tests, with ~45 lines of
actually new code.
* Docs
* Address PR feedback
- Add `default` case to ExecutionMode enum instead of using optional
- Change configuration key from `mode` to `execution_mode` for consistency
- Move default execution mode logic to runtime instead of configuration time
- Refactor test functions to use throws instead of do-catch
The protocol will be used to tag rules that may or may not require
SourceKit depending on its configuration. I only expect this to be used
for custom rules as utility to help transition to a fully SwiftSyntax
based approach.
This provides an alternative to getting syntax kinds from SourceKit. The
mappings aren't 100% equivalent, but this should serve as a useful
compatibility layer.
In particular lots of stuff that used to be needed with SourceKit that
we no longer need to keep around.
Identified using Periphery: https://github.com/peripheryapp/periphery
Convert LineLengthRule to use SwiftSyntax instead of SourceKit for
improved performance and better detection accuracy.
The SwiftSyntax implementation:
- Uses ViolationsSyntaxVisitor pattern with line-based validation
- Pre-computes ignored lines using helper visitors for efficiency
- Implements pure SwiftSyntax comment detection without SourceKit
- Correctly handles function declarations, multiline strings
- Maintains all configuration options including URL stripping
- Preserves exact line position reporting for violations