Commit Graph

96 Commits

Author SHA1 Message Date
Danny Mösch dfe19ac7fc Respect comments before opening braces in opening_brace rule (#5582) 2024-05-15 23:06:59 +02:00
Martin Redington 7623f1e730 Enable more rules in SwiftLint's own .swiftlint.yml (#5532) 2024-04-27 18:43:08 +02:00
deterclosed 082adfaed7 Fix some typos (#5504) 2024-03-23 15:25:16 +01:00
Danny Mösch 5bfe329d09 Update SwiftSyntax to version 510.0.0 (#5479) 2024-03-09 15:46:45 -05:00
Kotaro Suto d9c6888287 Make trailing_closure rule correctable (#5453) 2024-03-05 21:16:45 +01:00
Danny Mösch c730047176 Enable superfluous_else rule (#5412) 2024-03-03 16:30:44 +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 7c29ae4f3e Add new shorthand_argument rule (#5451) 2024-02-06 23:36:28 +00:00
Danny Mösch 6bb9944050 Support continue, break and throw in superfluous_else rule (#5425) 2024-01-17 21:05:57 +01:00
Danny Mösch c1a422bfa1 Rename variables referring to if statements (#5423) 2024-01-16 18:49:29 +00:00
Danny Mösch 2057d607b7 Refine violation positions of superfluous_else rule (#5420) 2024-01-16 19:33:43 +01:00
Danny Mösch 1c605a597a Refine violation position of trailing_closure rule (#5419) 2024-01-16 13:16:04 -05:00
Kotaro Suto 6af9419e09 Rewrite trailing_closure rule with SwiftSyntax (#5414) 2024-01-15 10:10:03 +01:00
Oleg Kohtenko f4fa852752 Compare case-insensitively in sorted_enum_cases rule (#5405) 2024-01-09 22:25:54 +01:00
Danny Mösch 31eb218b08 Rewrite if expressions also in other code blocks (#5413) 2024-01-07 14:32:44 -05:00
Danny Mösch 8b98d859a3 Make superfluous_else rule auto-correctable (#5411) 2024-01-07 18:55:42 +01:00
Marceau TONELLI 902ac305bf Add option to switch_case_alignment rule to ignore switch statements written on a single line (#5390) 2024-01-03 22:43:37 +01:00
Danny Mösch 078d33310a Add example (#5381) 2023-12-10 08:39:21 +00:00
Kishikawa Katsumi 0d54c2a10d Rewrite opening_brace rule with SwiftSyntax (#5164) 2023-12-02 12:21:50 +01:00
Danny Mösch 8cb2cf9f85 Rewrite let_var_whitespace rule with SwiftSyntax (#5367) 2023-11-29 22:45:06 +01:00
Marcelo Fabri ff1e966e3a Rewrite multiline_literal_brackets using SwiftSyntax (#5333) 2023-11-19 20:23:26 +00:00
Danny Mösch efddde68ac Allow to configure more operators in identifier_name rule (#5362) 2023-11-19 15:59:54 +01:00
Danny Mösch 09d1ef9d1d Harmonize violation positions (#5360)
Marks the violating identifiers directly.
2023-11-19 13:51:53 +01:00
Danny Mösch eab0af851c Rewrite identifier_name rule with SwiftSyntax (#5354) 2023-11-19 12:47:41 +01:00
Danny Mösch 9fbc04ecba Rewrite void_return rule with SwiftSyntax (#5351) 2023-11-15 07:13:36 +01:00
Danny Mösch 1603f4ab55 Remove filter that is assuming classes cannot be nested inside of extensions (#5344) 2023-11-11 14:28:16 +01:00
Kabir Oberai 92679e230d Fix implicit_getter false positive in case of unknown accessors (#5300) 2023-11-09 09:14:16 +01:00
Marcelo Fabri da597eaeca Add example for #3581 (#5334)
Fixes #3581
2023-11-07 09:26:15 +00:00
Marcelo Fabri 020a0e119a Rewrite vertical_parameter_alignment_on_call using SwiftSyntax (#5332) 2023-11-07 01:09:45 -08: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
uabyss 6dc4b86f98 Added viewIsAppearing in viewLifecycleMethodNames (#5316) 2023-11-01 08:48:49 -04:00
Marcelo Fabri 8e34619576 Speed up closure_parameter_position when there are no violations (#5302) 2023-10-27 08:55:46 -07: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 5ec1de0312 Generate makeRewriter optionally (#5281) 2023-10-17 15:19:19 -04:00
Danny Mösch 57632017e4 Introduce parent class for rewriters (#5282) 2023-10-17 18:55:02 +02: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 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 6438c77b96 Harmonize rule extensions (#5272) 2023-10-11 19:39:38 +02:00
Danny Mösch f6e5f778fc Configure expression folding by argument of @SwiftSyntaxRule macro (#5255) 2023-10-03 07:16:33 -04: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 2433e7b5bf Make use of macros to generate configuration parsing code (#5250) 2023-10-02 22:35:24 +02:00
Danny Mösch 68b27d8310 Inline conditional examples requiring Swift 5.9 (#5249) 2023-09-30 09:56:54 -04:00
Danny Mösch 075017cba5 Merge modifier extensions into one (#5234) 2023-09-24 23:50:10 +02:00
Danny Mösch d6b3f69804 Support switch expressions in switch_case_alignment rule (#5229)
The position of the closing brace now defines the alignment.
2023-09-20 17:43:01 -04:00
Danny Mösch 35a78815d1 Update SwiftSyntax (#5198) 2023-09-14 22:49:55 +02:00
Kishikawa Katsumi 05818b5375 Respect grapheme clusters in the collection_alignment rule (#5173)
Do so by counting characters. Solves (to some extent) the problem of apparent character counts not matching the UTF-8-based offsets returned by SwiftSyntax.
2023-09-11 19:45:53 +02:00
Danny Mösch 02640a3415 Rewrite implicit_return rule using SwiftSyntax (#5166) 2023-09-02 14:32:37 +02:00
Danny Mösch e82fad944d Avoid monospaced rendering of description (#5202) 2023-09-02 05:52:28 -04:00
Danny Mösch 7504d54acd Use general rewrite infrastructure (#5201) 2023-09-02 05:28:16 -04:00