Commit Graph

3359 Commits

Author SHA1 Message Date
Danny Mösch 23d218c0a8 Prepare 0.62.1 release 2025-10-13 20:57:16 +00:00
Danny Mösch fb030b9cf1 Prepare 0.62.0 release 2025-10-13 18:19:32 +00:00
Danny Mösch 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02:00
Danny Mösch bae9a2a351 Remove deprecated connectivity check (#6278) 2025-10-04 11:35:34 +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
Martin Redington 13c0c235eb only rule should work for individual custom rules (#6057) 2025-09-18 10:21:47 +01:00
Danny Mösch 292343c31c Prepare 0.61.0 release 2025-09-06 14:09:41 +00: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 21942bd3cc Prepare 0.60.0 release 2025-08-30 11:27:51 +00:00
Danny Mösch 7624586c18 Maintain SourceKit-mode as long as custom rules don't support SwiftSyntax (#6212) 2025-08-30 09:42:52 +02:00
Danny Mösch c1ffdfe891 Enable prefer_condition_list rule (#6163) 2025-07-12 09:41:00 -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
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 6d5af5f924 Enable async_without_await rule (#6104) 2025-06-19 15:01:42 -04:00
Martin Redington f72f195ece Fix error reporting (#6061) 2025-05-21 11:34:46 +01:00
Danny Mösch b35a96e5b6 Prepare 0.59.1 release 2025-04-15 15:19:16 +00:00
Danny Mösch e7d1f4fce7 Prepare 0.59.0 release 2025-04-05 11:32:37 +00:00
Danny Mösch 47335d7f95 Remove tracking of correction positions (#5950)
Report number of corrections per file instead.
2025-04-05 06:04:37 -04:00
Danny Mösch 9710148f76 Replace Sourcery with internal implementation (#6034)
Tasks we perform with Sourcery are rather simple and can be replaced
with a basic collection of files and the generation of lists in the
new `swiftlint-dev` command. This spares contributors from installing
either Sourcery or Bazel.
2025-03-26 20:38:53 +00:00
Martin Redington 5517d233fd Started to add rationales (#5681) 2025-03-06 10:16:30 +00:00
Keith Bauer 4eb19bef17 Parallelize file grouping (#5983) 2025-02-01 07:10:44 -05:00
Keith Bauer 0460a6c1c6 Avoid reading files before checking the cache (#5973)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-01-29 15:53:13 -05:00
Keith Bauer 010028acfa Parallelize SwiftLintFile construction for a modest speedup (#5967) 2025-01-29 16:33:32 +01:00
github-actions[bot] 81229e5554 Prepare 0.58.2 release 2025-01-16 22:10:28 +00:00
github-actions[bot] a9b49d90a9 Prepare 0.58.1 release 2025-01-15 18:22:57 +00: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
github-actions[bot] 0c7d009839 Prepare 0.58.0 release 2025-01-12 12:23:29 +00:00
Danny Mösch 7321f2bbd0 Warn about implicit overrides (#5936) 2025-01-04 11:29:26 -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
Martin Redington 88787fd9bb Still check for updates if we have violations (#5905) 2024-12-23 11:11:03 +00:00
Danny Mösch 2cf298bf15 Remove exit helper workaround (#5900)
Introduced in 4fb5ebe19b due to
https://github.com/swiftlang/swift/issues/59961.
2024-12-19 12:57:18 -05:00
Danny Mösch ebdd23a4ad Support Musl C library (#5899) 2024-12-18 19:53:34 +01: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
BlueVirusX e87efff39b Support Xcode input file lists (#5790)
Adds the option `--use-script-input-file-lists` and parsing for `.xcfilelist` files.
2024-10-25 06:57:41 -04:00
Danny Mösch 88c2e4c1ce Enable strict concurrency in built-in rules module (#5817) 2024-10-04 15:29:29 +02:00
Danny Mösch ab699f98ae Use async/await for URL session (#5814) 2024-09-29 21:19:23 +02:00
Danny Mösch 1ec3fdc58d Pass options to visitor (#5811) 2024-09-29 14:23:17 -04:00
Danny Mösch 246643fe55 Keep only command-line related functions in swiftlint module (#5806)
Swift 6 doesn't allow importing executable targets. So we need to
move testable logic into a framework.
2024-09-29 17:23:46 +02:00
JP Simard a7bc9e20c7 Move built-in rules to new SwiftLintBuiltInRules module (#4950) 2023-04-27 11:16:01 -04:00
JP Simard eaf34d7204 Move extra rules into its own module (#4949)
This will decouple building extra rules from built-in rules so that
making changes in one of those modules doesn't rebuild the other.
2023-04-27 10:37:30 -04:00
JP Simard 86d60400c1 Move core SwiftLint functionality to new SwiftLintCore module
Over the years, SwiftLintFramework had become a fairly massive monolith,
containing over 400 source files with both core infrastructure and
rules.

Architecturally, the rules should rely on the core infrastructure but
not the other way around. There are two exceptions to this:
`custom_rules` and `superfluous_disable_command` which need special
integration with the linter infrastructure.

Now the time has come to formalize this architecture and one way to do
that is to move the core SwiftLint functionality out of
SwiftLintFramework and into a new SwiftLintCore module that the rules
can depend on.

Beyond enforcing architectural patterns, this also has the advantage of
speeding up incremental compilation by skipping rebuilding the core
functionality when iterating on rules.

Because the core functionality is always useful when building rules, I'm
opting to import SwiftLintCore in SwiftLintFramework as `@_exported` so
that it's implicitly available to all files in SwiftLintFramework
without needing to import it directly.

In a follow-up I'll also split the built-in rules and the extra rules
into their own modules. More modularization is possible from there, but
not planned.

The bulk of this PR just moves files from `Source/SwiftLintFramework/*`
to `Source/SwiftLintCore/*`. There are some other changes that can't be
split up into their own PRs:

* Change jazzy to document the SwiftLintCore module instead of
  SwiftLintFramework.
* Change imports in unit tests to reflect where code was moved to.
* Update `sourcery` make rule to reflect where code was moved to.
* Create a new `coreRules` array and register those rules with the
  registry. This allows the `custom_rules` and
  `superfluous_disable_command` rule implementations to remain internal
  to the SwiftLintCore module, preventing more implementation details
  from leaking across architectural layers.
* Move `RuleRegistry.registerAllRulesOnce()` out of the type declaration
  and up one level so it can access rules defined downstream from
  SwiftLintCore.
2023-04-26 21:10:19 -04:00
JP Simard 740572f049 Move Version.swift to SwiftLintCore 2023-04-26 21:10:19 -04:00