Commit Graph
98 Commits
Author SHA1 Message Date
Danny Mösch 539bd28d86 Use URL for file paths throughout the code base 2025-12-28 08:46:16 +01:00
Roman LavrovandDanny Mösch 4160c3ad9b revert absolutePathStandardized change 2025-12-23 15:08:35 +01:00
Roman LavrovandDanny Mösch e9a8f797a5 correct handling in PR 6355 for buildkite 2025-12-23 15:08:35 +01:00
Danny MöschandGitHub 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öschandGitHub 32c33c2588 Re-enable redundant_self rule (#6368) 2025-12-07 08:11:08 -05:00
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
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öschandGitHub 7b4335abea Fix correction of sorted_imports rule for leading comments case (#6318) 2025-10-26 08:26:49 +01:00
Danny MöschandGitHub 4581152312 Introduce visitor collecting empty lines (#6320) 2025-10-25 07:36:48 -04:00
Nandhini SubramaniandGitHub 6619ca9c10 Add isolation parameter to modifier_order rule (#6316) 2025-10-22 09:40:45 +02:00
Danny MöschandGitHub 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02:00
Danny MöschandGitHub 58be16cd0e Use task-local parser diagnostic toggle (#6273) 2025-10-03 22:34:32 +02:00
Danny MöschandGitHub aa67f5ac13 Adopt typed throws where possible (#5922) 2025-09-27 19:11:46 +02:00
Danny MöschandGitHub 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öschandGitHub ba500d31a2 Remove unused code (#6208)
All the code has a relation to former SourceKit-based rules.
2025-08-30 14:09:07 +02:00
Danny MöschandGitHub c1ffdfe891 Enable prefer_condition_list rule (#6163) 2025-07-12 09:41:00 -04:00
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öschandGitHub 599e51a5a2 Format code (#6151) 2025-07-02 17:50:53 -04:00
JP SimardandGitHub 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
JP SimardandGitHub d22e7335ab Add SwiftSyntaxKindBridge to help migrate custom rules to SwiftSyntax (#6126)
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.
2025-06-21 15:27:21 -04:00
JP SimardandGitHub 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
JP SimardandGitHub 81474e36d0 Enforce SourceKitFreeRule contract with fatal error (#6107) 2025-06-20 07:25:01 -04:00
Danny MöschandGitHub 2578cb3862 Use SwiftSyntax version 601.0.0 (#6003) 2025-04-03 21:27:57 +02:00
Danny MöschandGitHub 043f9cac5b Introduce internal CLI to simplify development tasks (#6032)
Start with a command that generates a template for a new SwiftSyntax
rule. This tool could remain separate or be merged into the official
binary under a `dev` sub-command at a later point in time.
2025-03-23 01:21:41 +01:00
Danny MöschandGitHub b14272d4f2 Rewrite type_contents_order rule with SwiftSyntax (#6002) 2025-03-17 20:15:02 +01:00
Danny MöschandGitHub 22e0f42ae1 Fix crash when disable command is preceded by unicode character (#5976) 2025-03-15 23:33:11 +01:00
Keith BauerandGitHub 4eb19bef17 Parallelize file grouping (#5983) 2025-02-01 07:10:44 -05:00
Danny MöschandGitHub fcdc98a52d Revert "Improve performance of excluded files filter" (#5962)
This reverts commit 152355e36f from #5157.

# Conflicts:
#	tools/oss-check
2025-01-15 19:15:44 +01:00
Danny MöschandGitHub a5c9319e13 Fix warnings in Linux build (#5940) 2025-01-06 18:28:20 +01:00
Danny MöschandGitHub bef8acfb0e Avoid NSRegularExpression in configurations (#5921) 2024-12-28 12:54:23 -05:00
Danny MöschandGitHub 152355e36f Improve performance of excluded files filter (#5157)
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.
2024-12-25 17:33:33 -05:00
Danny Mösch ec35f95786 Fix strict concurrency warnings in SwiftLintCore 2024-12-23 16:52:10 +01:00
Danny Mösch a6c4fd98bc Move files from SwiftLintCore to SwiftLintFramework
Ideally, SwiftLintCore would some day only contain components
that are needed to define rules. Consequently, it would be the
only bundle required to import for (external) rule development.
2024-12-23 12:51:43 +01:00
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
Martin RedingtonandGitHub 23d6a7c3f5 Added lenient command line option (#5801) 2024-10-30 22:03:54 +00:00
Martin RedingtonandGitHub 01f5ecd64a Replace description.identifier with identifier (#5837) 2024-10-26 14:46:03 +01:00
Martin RedingtonandGitHub 9ea4374145 Fix --only-rule config issues (#5773) 2024-10-25 17:19:17 +01:00
timesinceandGitHub 5070b8257c Remove unnecessary symbol (#5827) 2024-10-17 22:34:19 +02:00
Danny MöschandGitHub c4a732583a Wrap buffer to make it @Sendable (#5815) 2024-09-30 14:35:34 +02:00
06e4e3cc07 Fix superfluous_disable_command for custom_rules (#5670)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-09-07 23:15:21 +02:00
Sam RaynerandGitHub 48aaca61f0 Reverse Data -> String conversion rule (#5601) 2024-08-24 10:13:04 +00:00
Danny MöschandGitHub 9d0711070d Trigger on empty closure blocks in no_empty_block rule (#5763) 2024-08-20 22:28:30 +02:00
Danny MöschandGitHub 88191fe58e Enable prefer_key_path rule and fix all violations (#5721) 2024-08-03 14:21:47 +02:00
wanxiangchwngandGitHub 9309f17825 Fix some typos (#5719)
Signed-off-by: wanxiangchwng <cui.shuang@foxmail.com>
2024-08-01 19:14:16 +02:00
Danny MöschandGitHub 4b9c15969d Remove unused conformance (#5704) 2024-07-25 16:43:57 -04:00
Martin RedingtonandGitHub 3421f5f46d Enable multiline_parameters rule, and fix all cases (#5664) 2024-07-18 01:48:02 +01:00
Martin RedingtonandGitHub b1234e38a5 Add --only-rule command line option (#5666) 2024-07-15 23:52:52 +01:00
Danny MöschandGitHub cc4b569c54 Enable unused_parameter rule and fix all violations (#5673) 2024-07-14 11:20:50 -04:00
Martin RedingtonandGitHub 21b7e5ed6b Enabled prefer_self_in_static_references, and fixed all current violations (#5662) 2024-07-10 18:58:27 +01:00
Martin RedingtonandGitHub ed10aec5f8 Enable implicit_return and fix all violations (#5658) 2024-07-10 12:15:19 +01:00