Commit Graph

93 Commits

Author SHA1 Message Date
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
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 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02:00
Danny Mösch 58be16cd0e Use task-local parser diagnostic toggle (#6273) 2025-10-03 22:34:32 +02:00
Danny Mösch aa67f5ac13 Adopt typed throws where possible (#5922) 2025-09-27 19:11:46 +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
Danny Mösch c1ffdfe891 Enable prefer_condition_list rule (#6163) 2025-07-12 09:41:00 -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 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 Simard 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 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
JP Simard 81474e36d0 Enforce SourceKitFreeRule contract with fatal error (#6107) 2025-06-20 07:25:01 -04:00
Danny Mösch 2578cb3862 Use SwiftSyntax version 601.0.0 (#6003) 2025-04-03 21:27:57 +02:00
Danny Mösch 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ösch b14272d4f2 Rewrite type_contents_order rule with SwiftSyntax (#6002) 2025-03-17 20:15:02 +01:00
Danny Mösch 22e0f42ae1 Fix crash when disable command is preceded by unicode character (#5976) 2025-03-15 23:33:11 +01:00
Keith Bauer 4eb19bef17 Parallelize file grouping (#5983) 2025-02-01 07:10:44 -05:00
Danny Mösch 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ösch a5c9319e13 Fix warnings in Linux build (#5940) 2025-01-06 18:28:20 +01:00
Danny Mösch bef8acfb0e Avoid NSRegularExpression in configurations (#5921) 2024-12-28 12:54:23 -05:00
Danny Mösch 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
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
Martin Redington 23d6a7c3f5 Added lenient command line option (#5801) 2024-10-30 22:03:54 +00:00
Martin Redington 01f5ecd64a Replace description.identifier with identifier (#5837) 2024-10-26 14:46:03 +01:00
Martin Redington 9ea4374145 Fix --only-rule config issues (#5773) 2024-10-25 17:19:17 +01:00
timesince 5070b8257c Remove unnecessary symbol (#5827) 2024-10-17 22:34:19 +02:00
Danny Mösch c4a732583a Wrap buffer to make it @Sendable (#5815) 2024-09-30 14:35:34 +02:00
Martin Redington 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 Rayner 48aaca61f0 Reverse Data -> String conversion rule (#5601) 2024-08-24 10:13:04 +00: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 88191fe58e Enable prefer_key_path rule and fix all violations (#5721) 2024-08-03 14:21:47 +02:00
wanxiangchwng 9309f17825 Fix some typos (#5719)
Signed-off-by: wanxiangchwng <cui.shuang@foxmail.com>
2024-08-01 19:14:16 +02:00
Danny Mösch 4b9c15969d Remove unused conformance (#5704) 2024-07-25 16:43:57 -04:00
Martin Redington 3421f5f46d Enable multiline_parameters rule, and fix all cases (#5664) 2024-07-18 01:48:02 +01:00
Martin Redington b1234e38a5 Add --only-rule command line option (#5666) 2024-07-15 23:52:52 +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 21b7e5ed6b Enabled prefer_self_in_static_references, and fixed all current violations (#5662) 2024-07-10 18:58:27 +01:00
Martin Redington ed10aec5f8 Enable implicit_return and fix all violations (#5658) 2024-07-10 12:15:19 +01:00
Danny Mösch 714bf4c8c2 Document modified configurations used to lint examples (#5402) 2024-07-07 13:11:41 +02:00
Martin Redington e0b9295412 Add update checker (#5613) 2024-07-06 19:32:36 -04:00
Danny Mösch c810459e6a Enforce mandatory trailing comma and fix all violations (#5640) 2024-06-28 05:36:50 +00:00
Martin Redington 8bed208416 Adds baseline and write_baseline config file options (#5552)
* Adds `baseline` and `write_baseline` config file options, so baseline can be used by people who can't pass command line arguments (e.g. plugin users).

* Added PR number

* Fixed change log entry

* Update Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>

* updated

---------

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-06-27 18:40:04 +01:00
Danny Mösch 914fa02e4e Use SwiftSyntax version 600.0.0-prerelease-2024-03-11 (#5527)
We can also switch back to an exact SwiftSyntax version now with the
plugins in a separate repository. In fact, using the plugin, no direct
dependency to SwiftSyntax is required whatsoever.
2024-06-22 11:14:14 +02:00