Commit Graph
207 Commits
Author SHA1 Message Date
JP SimardandGitHub 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 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
Danny MöschandGitHub 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
JP SimardandGitHub 81474e36d0 Enforce SourceKitFreeRule contract with fatal error (#6107) 2025-06-20 07:25:01 -04:00
Danny MöschandGitHub 614c0026df Prepare for Swift 6.2 (#6115) 2025-06-20 09:25:59 +00:00
Danny Mösch 125dd161cf Support latest Swift versions 2025-06-15 19:08:16 +02:00
Martin RedingtonandGitHub f72f195ece Fix error reporting (#6061) 2025-05-21 11:34:46 +01:00
Martin RedingtonandGitHub 3ed7579fd2 Allow magic numbers to be configured (#6051) 2025-04-13 21:08:42 +01:00
Danny Mösch e3c0eebe86 Document missing parameters 2025-04-09 21:11:41 +02:00
Danny MöschandGitHub 47335d7f95 Remove tracking of correction positions (#5950)
Report number of corrections per file instead.
2025-04-05 06:04:37 -04:00
Danny MöschandGitHub 2578cb3862 Use SwiftSyntax version 601.0.0 (#6003) 2025-04-03 21:27:57 +02:00
Danny MöschandGitHub 904538487c Support Swift version 6.1 (#6040) 2025-03-31 23:25:25 +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
Martin RedingtonandGitHub 5517d233fd Started to add rationales (#5681) 2025-03-06 10:16:30 +00:00
Danny MöschandGitHub 82736d1925 Add new opaque_over_existential rule (#5915) 2025-02-12 16:46:28 -05:00
Danny MöschandGitHub 82fd3e4058 Ensure that content is complete using an awaitable stream (#5986) 2025-02-10 22:59:43 +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 f045130e3e Remove unused protocol CollectingCorrectableRule (#5951) 2025-01-13 09:43:17 +01:00
Danny MöschandGitHub f796fee241 Enable strict concurrency checks in test code (#5943) 2025-01-07 22:19:25 +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 dd157e2bdf Use task-local variable (#5919) 2024-12-28 10:44:07 +01:00
Danny Mösch ff21ff796c Specify rule properties in attribute 2024-12-26 20:40:29 +01: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 1a54e3e313 Capture console on main actor only 2024-12-23 16:52:10 +01:00
Danny MöschandGitHub cbedb0844e Inline custom visitors (#5909) 2024-12-23 15:18:35 +01:00
Danny Mösch 15e1598d43 Move reusable functionality from SwiftLintBuiltInRules to SwiftLintCore 2024-12-23 12:51:43 +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
Danny MöschandGitHub ebdd23a4ad Support Musl C library (#5899) 2024-12-18 19:53:34 +01:00
Danny MöschandGitHub 010cbd8bc5 Reduce target-specific imports (#5898) 2024-12-18 16:12:52 +01:00
Danny MöschandGitHub 23ba688c88 Combine compact and flat mapping (#5897) 2024-12-15 17:20:18 -05: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
Danny MöschandGitHub 172d85ab7a Add pre-defined internal Swift 6 version (#5872) 2024-11-28 18:00:44 -05:00
Danny Mösch 25f2776977 Release 0.57.1 2024-11-24 16:06:56 +01:00
Danny MöschandGitHub 2c7e7230b0 Support type casting on configuration option values defined by environment variables (#5860) 2024-11-17 15:40:39 +01: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
Danny MöschandGitHub 7385beaaf6 Add validation hook to configuration parsing (#5824) 2024-10-17 23:13:17 +02:00
timesinceandGitHub 5070b8257c Remove unnecessary symbol (#5827) 2024-10-17 22:34:19 +02:00
Martin RedingtonandGitHub 9c2d0d5f86 Fix nested disable commands improved (#5797) 2024-10-15 18:56:39 +01:00
Danny MöschandGitHub 63ee1944bd Keep Swift 5 macOS build for the time being (#5816) 2024-10-01 15:25:03 +00:00
Danny MöschandGitHub c4a732583a Wrap buffer to make it @Sendable (#5815) 2024-09-30 14:35:34 +02:00
Danny MöschandGitHub b903e0bd87 Sync strict concurrency build settings (#5813) 2024-09-29 15:22:07 -04:00