255 Commits

Author SHA1 Message Date
Copilot a6198b7c17 Add support for Swift 6.3.1 (#6627)
Co-authored-by: SimplyDanny <16365760+SimplyDanny@users.noreply.github.com>
2026-05-03 13:13:52 +00:00
Dimitri Dupuis-Latour 65f44a07e7 Add new legacy_uigraphics_function rule (#6269)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2026-04-15 21:26:36 -04:00
Danny Mösch f242859a0a Add new redundant_final rule (#6597)
Co-authored-by: William Laverty <wlaverty13@gmail.com>
2026-04-15 22:01:29 +02:00
Danny Mösch ceef663aaa Track type member declarations optionally (#6596) 2026-04-15 21:58:40 +02:00
Danny Mösch 26cc907ba8 Compare identifier declarations (#6589) 2026-04-10 00:38:46 +02:00
Danny Mösch 0316649724 Base corrections on bytes to avoid range conversions (#6570) 2026-04-07 05:23:58 -04:00
Danny Mösch 99ec4923d8 Use effective ACL in discouraged_default_parameter rule (#6563) 2026-03-27 21:25:37 +01:00
Danny Mösch 29a71dd50d Track variables declared in tuples (#6565) 2026-03-27 19:44:12 +01:00
Danny Mösch b4a04b6ed6 Support Swift version 6.2.4 (#6520) 2026-02-28 09:11:27 +00:00
Danny Mösch b0cd950a35 Keep file content when the file is virtual (#6519)
Virtual files are not stored on disk and can thus also not be read
from there again. Their content needs to stay in memory and be modified
right there.
2026-02-28 09:39:37 +01:00
Danny Mösch 987f3603ae Use start position of closure to check if rule is disabled (#6458) 2026-01-23 20:52:05 +01:00
Danny Mösch 335edded41 Inline dedicated rule test (#6459) 2026-01-23 14:25:19 -05:00
Danny Mösch 8978ae2ccb Add --disable-sourcekit flag to disable SourceKit (#6439) 2026-01-15 20:30:52 +01:00
Danny Mösch faa5859155 Introduce guarded filepath provider for file collection (#6435) 2026-01-14 18:06:13 -05:00
Danny Mösch 21ed830b62 Import implicitly referenced framework (#6430) 2026-01-11 17:53:06 +00:00
Danny Mösch e6b9643965 Support Swift version 6.3 (#6428) 2026-01-11 18:52:10 +01:00
Danny Mösch 779c5ab94c Keep unwrapped self in extensions for optional types (#6396) 2025-12-27 09:39:39 -05:00
Brett Best 5b1b83812a Support Swift version 6.2.3 (#6375) 2025-12-13 09:15:47 +00:00
Danny Mösch 66d4818cd3 Support Swift version 6.2.2 (#6373) 2025-12-10 21:10:39 +00:00
Danny Mösch ac701c088c Improve performance of excluded files filter (#6342)
The current algorithm is like "collect all included files and subtract all excluded files".
Collecting all included and all excluded files relies on the file system. This can become slow
when the patterns used to exclude files resolve to a large number of files.

The new approach only collects all lintable files and checks them against the exclude patterns.
This can be done by in-memory string-regex-match and does therefore not require file system accesses.
The new implementation also no longer traverses directories that already match an exclude pattern.

(cherry picked from commit 152355e36f)
2025-12-07 15:58:23 +01:00
Danny Mösch 32c33c2588 Re-enable redundant_self rule (#6368) 2025-12-07 08:11:08 -05:00
Danny Mösch d1cdf8ce20 Extend redundant_self_in_closure to find all redundant selfs (#6346) 2025-12-07 07:49:50 -05:00
Saleem Abdulrasool 562ec8f369 Correct incorrect handling of file paths (#6355)
`URL.path` is not a usable rendering of the path. `URL.path` represents
the URI path. If the path is meant to be consumable as a file path, the
file system representation (aka FSR) must be retrieved.

This improves the file path handling and makes additional tests now
pass.

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-12-01 22:02:12 +01:00
Danny Mösch 2e87be0398 Infer name of parent rule in configurations (#6363) 2025-12-01 14:15:00 -05:00
Saleem Abdulrasool e526fdef94 Repair GenerationTests on Windows (#6354) 2025-11-28 09:04:17 +01:00
Danny Mösch f59f41b36e Support Swift version 6.2.1 (#6338) 2025-11-09 13:37:43 +01:00
Danny Mösch 9e5a526483 Enable unneeded_throws_rethrows rule (#6335) 2025-11-03 20:24:57 +01:00
Copilot 038135e14d Enable prefer_key_path rule (#6331)
Co-authored-by: SimplyDanny <16365760+SimplyDanny@users.noreply.github.com>
2025-10-31 16:58:41 +00:00
Danny Mösch 7b4335abea Fix correction of sorted_imports rule for leading comments case (#6318) 2025-10-26 08:26:49 +01:00
Danny Mösch 4581152312 Introduce visitor collecting empty lines (#6320) 2025-10-25 07:36:48 -04:00
Nandhini Subramani 6619ca9c10 Add isolation parameter to modifier_order rule (#6316) 2025-10-22 09:40:45 +02:00
Danny Mösch 70a2e6ceac Add new incompatible_concurrency_annotation rule (#6290) 2025-10-20 15:11:10 -04:00
Nandhini Subramani 2c2ca671ed Add ignores_literals option to trailing_whitespace rule (#6309) 2025-10-18 04:31:52 -04:00
Danny Mösch 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02:00
Danny Mösch 9b3b538a18 Add @WorkingDirectory and @TemporaryDirectory macros to be used in tests 2025-10-03 22:41:38 +02:00
Danny Mösch 58be16cd0e Use task-local parser diagnostic toggle (#6273) 2025-10-03 22:34:32 +02:00
Danny Mösch 530bf9d0c5 Let legacy function rules adhere to @SwiftSyntaxRule (#6271) 2025-10-03 08:03:59 -04:00
Danny Mösch aa67f5ac13 Adopt typed throws where possible (#5922) 2025-09-27 19:11:46 +02:00
Danny Mösch b58b8401a0 Improve detection of comment-only lines in file_length rule (#6231) 2025-09-04 10:27:26 +02:00
Danny Mösch b97f63a89d Properly detect comment-only lines (#6230) 2025-09-03 23:42:04 +02:00
Danny Mösch 77050e8c40 Enable a fully statically linked Linux executable (#6211)
If SwiftLint is built from this state using the Swift SDK, we'll get a
large self-contained Linux executable that runs without loading SourceKit.
It can do that by disabling any rule that requires SourceKit.

With `SWIFTLINT_DISABLE_SOURCEKIT` set on a normally (dynamically linked)
binary, the behavior is the same. That's different from the previously
reported more serious warnings.
2025-08-30 10:02:38 -04:00
Danny Mösch ba500d31a2 Remove unused code (#6208)
All the code has a relation to former SourceKit-based rules.
2025-08-30 14:09:07 +02:00
Erik Kerber 69c9e29833 Add Sendable conformance to Rule.Type for building with Swift 6 (#6169) 2025-07-30 09:36:11 +02:00
Danny Mösch c1ffdfe891 Enable prefer_condition_list rule (#6163) 2025-07-12 09:41:00 -04: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 4efdcc7b25 Base visitors on rule configuration (#6159) 2025-07-10 18:13:06 -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 f6c9633087 Add RegexConfiguration.ExecutionMode (#6128)
* 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
2025-06-22 10:19:14 -04:00
JP Simard 3a922d41f9 Add ConditionallySourceKitFree to migrate custom rules to SwiftSyntax (#6127)
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.
2025-06-21 15:54:56 -04:00