836 Commits

Author SHA1 Message Date
Danny Mösch 3c4fe314b3 Prepare 0.63.2 release 2026-01-26 19:12:08 +00:00
Danny Mösch 71396cc146 Prepare 0.63.1 release 2026-01-15 19:47:12 +00:00
Danny Mösch 8d3ed07cc5 Prepare 0.63.0 release 2026-01-03 12:23:31 +00:00
Danny Mösch f72d03c84a Prepare 0.63.0-rc.2 release 2025-12-20 11:28:50 +00:00
Danny Mösch 32c33c2588 Re-enable redundant_self rule (#6368) 2025-12-07 08:11:08 -05:00
Danny Mösch 069a7f9cb9 Prepare 0.62.2 release 2025-10-28 16:57:24 +00:00
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 58be16cd0e Use task-local parser diagnostic toggle (#6273) 2025-10-03 22:34:32 +02: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 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 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 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
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
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
github-actions[bot] 0c7d009839 Prepare 0.58.0 release 2025-01-12 12:23:29 +00: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
JP Simard a7bc9e20c7 Move built-in rules to new SwiftLintBuiltInRules module (#4950) 2023-04-27 11:16:01 -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
JP Simard 3a2bb15ca3 Make some SwiftLintFramework declarations public (#4945)
* Make some SwiftLintFramework declarations public

If built-in rules depend on them.

This will allow separating the rules from the core infrastructure in
separate modules in an upcoming PR.

It also helps formalize the API contract for what should be accessible
to rule implementations.

* Exclude extensions from jazzy
2023-04-26 16:37:25 -04:00
JP Simard a7e3909c6a Improve StyleViolation reason formatting validation (#4946)
So it checks violations for all rules in the registry, not just the
built-in rules.
2023-04-26 18:54:44 +00:00
JP Simard 9c414932d8 Add more documentation comments (#4942)
In preparation for these declarations to become public.
2023-04-26 14:18:13 -04:00
JP Simard 603fff9a82 Make Correction and CorrectableRule declarations public (#4937)
The CLI target shouldn't be importing SwiftLintFramework with
`@_spi(TestHelper)`. If the CLI target needs to access something in
SwiftLintFramework, that declaration should be `public`.
2023-04-26 12:17:10 -04:00
JP Simard 165172e0fa Introduce a "rule registry" concept
This will allow for registering rules that aren't compiled as part of
SwiftLintFramework.

Specifically this will allow us to split the built-in and extra rules
into separate modules, leading to faster incremental compilation when
working on rules since the rest of the framework won't need to be
rebuilt on every compilation.
2023-04-25 12:28:50 -04:00
JP Simard 1b0f37c6f6 Pin Sourcery version to 2.0.2 (#4888)
By adding a `tools/sourcery` script that downloads and runs Sourcery via
Bazel.

Previously, unrelated changes might include modifications to the
generated comment headers because contributors' local versions of
Sourcery would be used, which we don't control.

Also move the CI job to Buildkite where the bazel server is usually
already warmed up and running.
2023-04-13 20:09:26 +00:00
Danny Mösch 6d4bc78cb4 Add new superfluous_else rule (#4696) 2023-04-02 12:32:40 +02:00
Kim de Vos b0cbb440c3 Add new sorted_enum_cases rule (#4845) 2023-04-02 11:33:20 +02:00
Martin Redington 7dad240ea7 Add a reporters subcommand (#4836) 2023-03-31 08:09:01 +02:00
JP Simard eb85125a5f release 0.51.0 2023-03-27 11:44:47 -04:00
JP Simard efc5afd5d5 Apply small formatting fixes (#4840)
* Trim excess trailing and vertical whitespace
* Move `SwiftyTextTable` dependency into `frameworkDependencies`
* Adjust wording in README around analyzer rules in the `opt_in_rules`
  section, since analyzer rules can only go in the `analyzer_rules`
  section.
2023-03-26 16:09:43 -04:00
Martin Redington 31510b662e Use all optin rules facility for SwiftLint's own .swiftlint.yml (#4800) 2023-03-11 11:59:05 +01:00
Martin Redington 0bd8a7aba6 Add new blanket_disable_command rule (#4731) 2023-03-07 21:43:53 +01:00
Martin Redington 228d53787b Stopsuperfluous_disable_command from firing when disabled (#4791) 2023-03-05 19:21:35 +01:00
1in1 4fee8e6a0c Add new duplicate_conditions rule (#4771) 2023-03-05 11:05:23 +01:00
Martin Redington 1c3c62e422 Add new invalid_swiftlint_command rule (#4546) 2023-03-04 13:53:27 +01:00
Danny Mösch 393318d903 Add new direct_return opt-in rule (#4717) 2023-02-19 13:09:41 +01:00
Danny Mösch 5eed8fe91b Enable if_let_shadowing rule and fix all violations (#4247) 2023-01-31 22:31:38 +01:00
Danny Mösch 693e504258 Use basic NSRegularExpression type with caching (#4683) 2023-01-11 20:28:16 +01:00
kyounh12 5ec6112ba1 Interpret strings in excluded option of *_name rules as regex (#4655) 2023-01-10 23:29:04 +01:00