Commit Graph

17 Commits

Author SHA1 Message Date
Danny Mösch a321566c05 Support protocols and extensions in type body length checking (#6143) 2025-07-11 22:27:47 +02:00
Danny Mösch 092d0c3b62 Keep severity levels unchanged when no options are configured (#6160) 2025-07-11 04:18:28 -04:00
Danny Mösch df96466163 Support deinitializers and subscripts in function body length checking (#6142) 2025-07-09 16:33:49 -04:00
Koichiro Ueki e65767baf8 Add new excluded_paths option to file_name rule (#6092)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-06-25 21:30:32 +02:00
JP Simard ab7d117030 Migrate FileHeaderRule from SourceKit to SwiftSyntax (#6112)
## Summary

Convert FileHeaderRule to use SwiftSyntax instead of SourceKit for
improved performance and better handling of file header comments,
shebangs, and doc comments.

## Key Technical Improvements

- **Enhanced shebang support** properly skipping past `#!/usr/bin/env swift` lines
- **Better comment type discrimination** excluding doc comments from header analysis
- **Accurate position calculation** converting between UTF-8 and UTF-16 offsets for regex matching
- **Improved trivia traversal** for comprehensive header comment collection
- **SwiftLint command filtering** to exclude directive comments from header content

## Migration Details

- Replaced `OptInRule` with `@SwiftSyntaxRule(optIn: true)` annotation
- Implemented `ViolationsSyntaxVisitor` pattern for file-level analysis
- Added logic to start header collection after shebang.endPosition if present
- Distinguished between regular comments and doc comments (///, /** */)
- Maintained UTF-16 offset calculations for NSRegularExpression compatibility
- Added `skipDisableCommandTests: true` for SwiftSyntax disable command behavior
- Removed unnecessary SourceKittenFramework import
2025-06-24 09:48:25 -04:00
JP Simard 5a2cf4b1fe Remove dead code (#6125)
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
2025-06-21 15:19:37 -04:00
Danny Mösch 18403e8604 Harmonize violation positions (#6124) 2025-06-21 17:15:25 +02:00
JP Simard 81474e36d0 Enforce SourceKitFreeRule contract with fatal error (#6107) 2025-06-20 07:25:01 -04:00
Matt Pennig 1e25cf6be6 Migrate VerticalWhitespaceRule from SourceKit to SwiftSyntax (#6103)
* Migrate VerticalWhitespaceRule from SourceKit to SwiftSyntax

* Adds tests for new horizontal whitespace behavior
2025-06-19 17:31:51 -04:00
Kent Kaseda e1ac6f8607 Remove validates_start_with_lowercase option entirely (#6077) 2025-05-15 16:48:00 -04:00
Henry ed20aa593d Add new option ignores_multiline_strings to line_length rule (#6014) 2025-04-03 14:28:41 -04:00
fraioli e68797ebea Respect macro types in file_name rule (#6027)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-03-22 20:55:18 -04:00
Danny Mösch 82fd3e4058 Ensure that content is complete using an awaitable stream (#5986) 2025-02-10 22:59:43 +01:00
Danny Mösch f796fee241 Enable strict concurrency checks in test code (#5943) 2025-01-07 22:19:25 +01:00
Koichiro Ueki fc70594ad2 Ignore TipKit's #Rule macro in empty_count rule (#5918)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-01-07 09:22:10 -05:00
Danny Mösch e53d06b4e5 Remove explicit framework dependency (#5928) 2024-12-30 15:09:10 +01:00
Danny Mösch 15b285527a Separate built-in rule tests from framework tests (#5924)
* Short names for test modules
* Lint plugins and `Package.swift` in integration tests
* Simplify and merge file groups in Bazel
* Move common functions to `TestHelpers`
2024-12-30 12:26:46 +01:00