Commit Graph

20 Commits

Author SHA1 Message Date
Danny Mösch 951d03cf00 Silence prefer_self_in_static_references on generics lists in classes and extensions (#6676) 2026-05-28 23:50:38 +02:00
itsybitsybootsy a6c4fccb3f Surface violations of prefer_self_in_static_references inside extensions (#6639)
Co-authored-by: itsybitsybootsy <lammlu19>
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:45:45 -04:00
theamodhshetty ef026db5af Fix prefer_self_in_static_references for shadowed nested types (#6552)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2026-04-19 09:35:59 -04:00
Danny Mösch ff21ff796c Specify rule properties in attribute 2024-12-26 20:40:29 +01: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
Kishikawa Katsumi 0d54c2a10d Rewrite opening_brace rule with SwiftSyntax (#5164) 2023-12-02 12:21:50 +01:00
JP Simard 3eb3772022 Compile with -strict-concurrency=complete (#5320)
* Compile with `-strict-concurrency=complete`

Only in Bazel for now, because this is considered an unsafe flag in
SwiftPM which would lead to warnings for downstream consumers of
SwiftLint using SwiftPM.

Some imports of SwiftSyntax need the `@preconcurrency` annotation until
https://github.com/apple/swift-syntax/pull/2322 is available in a
release.

The following SwiftLint libraries have `-strict-concurrency=complete`
applied:

* SwiftLintCoreMacros
* SwiftLintBuiltInRules
* SwiftLintExtraRules

The following SwiftLint libraries don't have the flag applied and need
to be migrated:

* SwiftLintCore
* swiftlint (CLI target)

So really the rules and macros are now being compiled with
`-strict-concurrency=complete`, but the core infrastructure of SwiftLint
is not.

Still, given that Swift 6 will eventually make these warnings errors by
default, it's good to prevent issues from creeping in earlier rather
than later.

* Add CI job to build with strict concurrency
2023-11-01 15:20:40 +00:00
Danny Mösch 40bd97038a Support arbitrary configurations in @SwiftSyntaxRule (#5275)
Almost all rules based on SwiftSyntax can be set up now by just adding
`@SwiftSyntaxRule` to the rule struct.
2023-10-16 19:34:43 +02:00
Danny Mösch 2ed1fc2f27 Let all rules be configurable (#5274) 2023-10-12 17:30:45 +02:00
Danny Mösch 6438c77b96 Harmonize rule extensions (#5272) 2023-10-11 19:39:38 +02:00
JP Simard 591154091e Introduce @SwiftSyntaxRule & @Fold macros (#5253)
These macros remove some of the boilerplate involved when writing rules.

This change also adds test infrastructure for the macros used within
SwiftLint.
2023-10-02 18:43:16 -04:00
Danny Mösch be83b486ca Generalize alternative way to rewrite code (#5163) 2023-08-31 17:00:07 -04:00
Danny Mösch b281a8d33a Update SwiftSyntax (#5168) 2023-08-30 22:57:10 +02:00
Danny Mösch 205e5a90d3 Ignore initializers of computed properties in prefer_self_in_static_references rule (#5119) 2023-07-14 22:44:44 +02:00
Kasra Babaei 488182ae1b Do not trigger prefer_self_in_static_references on classes used as generics (#5084) 2023-07-04 21:40:57 +02:00
Danny Mösch f12b8d66d3 Do not trigger prefer_self_in_static_references rule on collection types (#5055) 2023-06-12 16:40:45 -04:00
Danny Mösch 3f039f26d5 Connect configs with their referencing rules to have some context in error logging (#5017)
With the binding of configurations to their associated rule types
"unknown configuration" errors can be made more specific mentioning
also the rule's identifier in the printed message.
2023-05-19 20:58:24 +02:00
Danny Mösch c0ea9d1925 Do not trigger prefer_self_in_static_references rule on typealias in classes (#5012) 2023-05-15 14:07:21 -04:00
JP Simard a7bc9e20c7 Move built-in rules to new SwiftLintBuiltInRules module (#4950) 2023-04-27 11:16:01 -04:00