Commit Graph

96 Commits

Author SHA1 Message Date
Danny Mösch 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02:00
Danny Mösch a6247c24e4 Rewrite sorted_imports rule with SwiftSyntax (#6280) 2025-10-05 17:00:27 +02:00
Danny Mösch aa67f5ac13 Adopt typed throws where possible (#5922) 2025-09-27 19:11:46 +02:00
Rodion Ivashkov 91b26549c4 Add function_name_whitespace rule to validate and autocorrect spacing around function names (#6156)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-08-30 10:40:44 -04:00
André Pacheco Neves fe099492f2 Allow prefer_key_paths to ignore identity closures ({ $0 }) (#6068)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-08-15 00:30:10 +03:00
Leopold Lemmermann 2677d5ee6e Add new implicit_optional_initialization replacing redundant_optional_initialization (#6165)
The new rule covers both cases, initialization with `= nil` and without, consistently.

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-08-13 10:08:49 +00:00
Copilot 8bb69b064a Add include_variables option to non_optional_string_data_conversion rule (#6172)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-08-02 17:49:58 -04:00
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
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
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
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
Martin Redington 3ed7579fd2 Allow magic numbers to be configured (#6051) 2025-04-13 21:08:42 +01:00
Henry ed20aa593d Add new option ignores_multiline_strings to line_length rule (#6014) 2025-04-03 14:28:41 -04:00
Jared Grubb 63fea48d83 Add excluded_methods option to unneeded_override rule (#6010) 2025-03-22 21:40:05 +01:00
Eduard Miniakhmetov d2d1aacaac Add new allowed_types option to legacy_objc_type rule (#6012) 2025-03-10 09:28:04 +00:00
Danny Mösch 9b22cda361 Add ib_segue_action to default configuration (#5956) 2025-01-14 21:50:11 +01:00
Danny Mösch ae8aeb3995 Add option to disable redundant_discardable_let in SwiftUI view bodies (#5929) 2025-01-03 19:30:35 +01:00
Danny Mösch bef8acfb0e Avoid NSRegularExpression in configurations (#5921) 2024-12-28 12:54:23 -05:00
Danny Mösch 03f8c83d0d Add new redundant_sendable rule (#5902) 2024-12-25 23:05:02 +01:00
Martin Redington deaacf6f69 Fixed PrivateUnitTestRule deprecations (#5912) 2024-12-25 19:43:27 +00:00
Dinesh Sharma 8e3b50fa61 Add new category for @IBSegueAction to type_contents_order rule (#5524)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-12-14 18:02:54 -05:00
fraioli b9d33e43ec Update file_name rule to allow fully-qualified names of nested types (#5841) 2024-11-26 21:47:49 +01:00
Kim de Vos 2a723d0042 Add new option max_number_of_single_line_parameters to multiline_parameters rule (#5781)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-11-24 14:14:08 +00:00
Danny Mösch 025b1e7f73 Allow inherited isolation parameter to be first in function signatures (#5859) 2024-11-17 09:35:09 -05:00
Jared Grubb fb3ce5adb2 Add ignore_properties option to redundant_type_annotation rule (#5839) 2024-11-12 19:27:59 +00:00
Leonardo de Sousa Rodrigues 3bb8014782 Add options to opening_brace rule that silence it on multiline statements and types (#5521)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-08-24 05:44:33 -04:00
Danny Mösch 9d0711070d Trigger on empty closure blocks in no_empty_block rule (#5763) 2024-08-20 22:28:30 +02:00
Danny Mösch 78b665d536 Unroll parsing code to make Version a struct (#5730) 2024-08-05 21:48:50 +00:00
Danny Mösch b67e82a832 Extract new contrasted_opening_brace rule from opening_brace rule (#5723) 2024-08-03 18:03:41 +02: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 a657438caf Add new prefer_key_path rule (#5548) 2024-08-02 22:05:28 +00:00
Danny Mösch e44bf9adb6 Add new brace_on_new_line option to opening_brace rule (#5708) 2024-07-30 22:23:01 +02:00
Martin Redington 6ee4623565 Fix deprecation warnings (#5695) 2024-07-24 19:30:36 +02:00
Danny Mösch 98cf87ab8d Rename macros to something more descriptive (#5686) 2024-07-23 20:14:29 +02:00
Koichiro Ueki b9f38435de Make no_empty_block rule opt-in and add configurations (#5685) 2024-07-22 18:34:20 +02:00
Martin Redington 3421f5f46d Enable multiline_parameters rule, and fix all cases (#5664) 2024-07-18 01:48:02 +01: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
woxtu 6642d45a2d Rewrite missing_docs rule with SwiftSyntax (#5048)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-07-02 20:09:19 +02:00
Danny Mösch c810459e6a Enforce mandatory trailing comma and fix all violations (#5640) 2024-06-28 05:36:50 +00:00
Garric G. Nahapetian 16c0213027 Add option to redundant_type_annotation rule to consider default literal types redundant (#4756) 2024-05-01 21:15:35 +02:00
Danny Mösch 1b7fbc4bcd Make postprocessors non-throwing (#5539)
Failing immediately when a property is invalid is too strict. It feels
sufficient to allow to report an issue but otherwise continue with a default
value instead of stopping execution completely.
2024-04-23 16:45:59 -04:00
Marceau TONELLI b3dd89088e Rewrite redundant_type_annotation with SwiftSyntax (#5389)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-04-21 17:46:29 +02:00
Danny Mösch ccd50e8c68 Merge duplicated issues 2024-03-24 09:36:18 +01:00
Danny Mösch 82cad0bfff Allow to infer option names (#5505)
This allows to infer names of options from their names in a configuration. CamelCase is translated into snake_case automatically when `apply` is triggered.

* Don't have all `RuleConfiguration`s conform to `InlinableOptionType`. Mark types that must have this capability explicitly. Same for `AcceptableByConfigurationElement`.
* A type being an `InlinableOptionType` doesn't mean it's automatically inlined. This also doesn't depend on the fact of having a name for its key configured any longer. Instead, an `inline` attribute must explicitly be set to `true` in `@ConfigurationElement`.
* Key name inference is optional and can be overwritten by specifying a key name in the attribute.
* Inlined configurations only fail in `apply` when they are really sure that something is odd. Otherwise, they accept to not being updated.
2024-03-23 18:54:39 +01:00