Commit Graph

39 Commits

Author SHA1 Message Date
Danny Mösch c1ffdfe891 Enable prefer_condition_list rule (#6163) 2025-07-12 09:41:00 -04:00
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 4efdcc7b25 Base visitors on rule configuration (#6159) 2025-07-10 18:13:06 -04:00
Danny Mösch df96466163 Support deinitializers and subscripts in function body length checking (#6142) 2025-07-09 16:33:49 -04:00
Chris Brakebill c97cf24797 Add ignore_codingkeys parameter in nesting rule (#5650)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-07-09 15:09:38 -04:00
Danny Mösch 599e51a5a2 Format code (#6151) 2025-07-02 17:50:53 -04:00
JP Simard 4ecae5b252 Migrate LineLengthRule from SourceKit to SwiftSyntax (#6111)
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
2025-06-21 14:47:19 -04:00
Danny Mösch 286e67ff23 Report more specific target types (#6123) 2025-06-21 17:17:55 +02:00
Danny Mösch 18403e8604 Harmonize violation positions (#6124) 2025-06-21 17:15:25 +02:00
Danny Mösch 5a3c8c9ba3 Inline rule-specific parts of BodyLengthVisitor (#6121)
Main goal is to bring implementations, rules and examples closer together.
Another advantage is that the rule's layouts are in line with other
`@SwiftSyntaxRule`s.

After the refactoring, violation messages can be
better adapted to the object causing the issue. Violation positions
should be harmonized and more cases for protocols, subscripts and
deinitializers can be added.
2025-06-21 14:02:28 +02:00
Danny Mösch 573ac4da7d Report warning threshold (#6122) 2025-06-21 01:40:06 +02:00
Danny Mösch 7e0ea598ce Let large_tuple rule adhere to common style (#6120) 2025-06-20 22:23:29 +00:00
JP Simard d1687859fe Migrate FileLengthRule from SourceKit to SwiftSyntax (#6100)
Convert FileLengthRule to use SwiftSyntax instead of SourceKit for
improved performance and fewer false positives.

The SwiftSyntax implementation:
- Uses ViolationsSyntaxVisitor pattern with token traversal
- Correctly handles multiline tokens by counting all spanned lines
- Properly excludes comment-only and whitespace-only lines
- Accurately attributes trivia to correct line positions
- Extracts common line range logic to reduce code duplication
2025-06-18 22:17:47 +00:00
Henry ed20aa593d Add new option ignores_multiline_strings to line_length rule (#6014) 2025-04-03 14:28:41 -04:00
Martin Redington 5517d233fd Started to add rationales (#5681) 2025-03-06 10:16:30 +00:00
Danny Mösch ff21ff796c Specify rule properties in attribute 2024-12-26 20:40:29 +01:00
Danny Mösch 15e1598d43 Move reusable functionality from SwiftLintBuiltInRules to SwiftLintCore 2024-12-23 12:51:43 +01:00
Danny Mösch 88191fe58e Enable prefer_key_path rule and fix all violations (#5721) 2024-08-03 14:21:47 +02:00
Danny Mösch 2442e10f13 Avoid needless indentation in examples (#5675) 2024-07-16 13:57:05 -04:00
Danny Mösch cc4b569c54 Enable unused_parameter rule and fix all violations (#5673) 2024-07-14 11:20:50 -04:00
Martin Redington ed10aec5f8 Enable implicit_return and fix all violations (#5658) 2024-07-10 12:15:19 +01:00
Danny Mösch c810459e6a Enforce mandatory trailing comma and fix all violations (#5640) 2024-06-28 05:36:50 +00:00
Danny Mösch 2d28166d21 Enable upcoming feature "Concise Magic File" (#5637) 2024-06-22 11:22:55 +02:00
Hayashi Tatsuya 6d38558bd4 Rewrite nesting rule with SwiftSyntax (#5439) 2024-02-07 15:35:38 -05:00
Kasra Babaei 77bae5429c Allow line_length rule to ignore certain lines based on regex patterns (#5437) 2024-01-26 09:40:59 +01:00
m.a 443cbd7fce Add new option ignore_typealiases_and_associatedtypes to nesting rule (#5433) 2024-01-21 12:28:23 -05:00
Marcelo Fabri 715198ae3f Rewrite cyclomatic_complexity with SwiftSyntax (#5308) 2023-10-29 11:17:45 -07:00
Danny Mösch 40bd97038a Support arbitrary configurations in @SwiftSyntaxRule (#5275)
Almost all rules based on SwiftSyntax can be set up now by just adding
`@SwiftSyntaxRule` to the rule struct.
2023-10-16 19:34:43 +02:00
Danny Mösch 2ed1fc2f27 Let all rules be configurable (#5274) 2023-10-12 17:30:45 +02:00
Danny Mösch 075017cba5 Merge modifier extensions into one (#5234) 2023-09-24 23:50:10 +02:00
Danny Mösch b281a8d33a Update SwiftSyntax (#5168) 2023-08-30 22:57:10 +02:00
Danny Mösch 1f65377f9c Remove more superfluous newline characters from examples (#5159) 2023-08-06 23:44:52 +02:00
Danny Mösch f10fc3056b Remove superfluous newline characters from examples (#5158) 2023-08-06 12:23:26 -04:00
Danny Mösch 85c4a3a03d Revert "Allow to initialize Examples by string literals (#5154)" (#5155)
This reverts commit 56461c3ab4.
2023-08-04 00:03:26 +02:00
Danny Mösch 56461c3ab4 Allow to initialize Examples by string literals (#5154) 2023-08-03 23:03:41 +02:00
Danny Mösch a2ba0a0626 Omit "Rule" in configuration names (#5024) 2023-05-20 04:39:04 -04:00
Danny Mösch 3f039f26d5 Connect configs with their referencing rules to have some context in error logging (#5017)
With the binding of configurations to their associated rule types
"unknown configuration" errors can be made more specific mentioning
also the rule's identifier in the printed message.
2023-05-19 20:58:24 +02:00
Danny Mösch d938b2d3c3 Specify default options in configurations only (#5020) 2023-05-18 17:21:30 +02:00
JP Simard a7bc9e20c7 Move built-in rules to new SwiftLintBuiltInRules module (#4950) 2023-04-27 11:16:01 -04:00