17 Commits

Author SHA1 Message Date
Danny Mösch 0316649724 Base corrections on bytes to avoid range conversions (#6570) 2026-04-07 05:23:58 -04:00
Danny Mösch 987f3603ae Use start position of closure to check if rule is disabled (#6458) 2026-01-23 20:52:05 +01:00
Danny Mösch 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02: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 2cc1acb683 Check at the violation position if a correction can be applied (#5682) 2024-07-20 23:22:54 +02:00
Danny Mösch 9f8a3f5662 Fix some typos (#5683) 2024-07-20 11:22:32 -04:00
Danny Mösch 238415b4f7 Place corrections optionally into violations (#5680)
This avoids maintaining two lists of objects.
2024-07-20 16:24:17 +02:00
Danny Mösch cc4b569c54 Enable unused_parameter rule and fix all violations (#5673) 2024-07-14 11:20:50 -04:00
Martin Redington c6a7dd2ecd Fix implicit return rewriting (#5661) 2024-07-10 13:24:09 +01:00
Danny Mösch 4078e41f1b Let all rewriters have a configuration by default (#5467) 2024-02-11 15:13:24 +01:00
Danny Mösch fc2a18e4aa Preprocess syntax tree before running corrections (#5428) 2024-01-18 20:25:34 +01:00
Danny Mösch 4c0f33782c Check disabled regions for all syntax types in parent rewriter class (#5292) 2023-10-23 15:34:51 -04:00
Danny Mösch 57632017e4 Introduce parent class for rewriters (#5282) 2023-10-17 18:55:02 +02:00
Danny Mösch 58928b7e40 Enforce any on existential types (#5273)
This makes syntactically clear which types are rather expensive.
2023-10-12 08:37:23 +02:00
Danny Mösch be83b486ca Generalize alternative way to rewrite code (#5163) 2023-08-31 17:00:07 -04:00
Martin Redington 0693d547b0 Add new unneeded_synthesized_initializer rule (#4812) 2023-06-21 22:15:02 +02: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