Commit Graph

6476 Commits

Author SHA1 Message Date
JP Simard 42c1359918 Publish a multi-platform Docker image
Addresses https://github.com/realm/SwiftLint/issues/4531
2023-11-16 14:34:46 -05:00
Martin Redington 33e3593c86 Skip simple tuples in no_magic_numbers rule (#5327) 2023-11-15 20:33:59 +01:00
Danny Mösch 9fbc04ecba Rewrite void_return rule with SwiftSyntax (#5351) 2023-11-15 07:13:36 +01:00
Danny Mösch fb4ef951ee Print invalid keys when configuration parsing fails (#5350) 2023-11-14 23:43:38 +01:00
Jerry Zhang 9b25efaf7a Update README_CN with macro validation skipping instructions (#5346) 2023-11-12 08:25:52 +01:00
Danny Mösch 7557ebd8cc Fix some styling issues in changelog (#5345) 2023-11-11 14:55:03 +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
Danny Mösch 779f6f0910 Add missing subscript declaration 2023-11-11 14:06:06 +01:00
Danny Mösch 3a03e7a31f Extract method that checks if a declaration shall be skipped 2023-11-11 14:06:06 +01:00
JP Simard bfe576ec3a Add new changelog section 2023-11-10 17:03:53 -05:00
JP Simard f17a4f9dfb release 0.54.0 0.54.0 2023-11-10 15:54:29 -05:00
JP Simard 60374cae8c Update Bazel dependencies (#5342) 2023-11-10 20:29:48 +00:00
Vladimir 3a6503212d Set the excluded files list once when getting lint files (#5330) 2023-11-10 15:04:07 -05:00
Takuhiro Muta 17b5880550 Update CryptoSwift to 1.8.0 (#5341) 2023-11-10 16:42:34 +00:00
Danny Mösch d36d5f0b68 Update SwiftSyntax to version 509.0.2 (#5299) 2023-11-10 11:22:36 -05:00
Marcelo Fabri ed8ed010f1 Revert "Trigger superfluous_disable_command for custom_rules (#4755)" (#5339)
This reverts commit 7499896199.
2023-11-09 04:11:48 -05: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 7499896199 Trigger superfluous_disable_command for custom_rules (#4755)
Fixes #4754
2023-11-07 04:11:58 -05:00
Marcelo Fabri 020a0e119a Rewrite vertical_parameter_alignment_on_call using SwiftSyntax (#5332) 2023-11-07 01:09:45 -08:00
Marcelo Fabri 5987582f93 Rewrite no_grouping_extension rule with SwiftSyntax (#5328) 2023-11-05 23:45:36 -08:00
Slava Karpenko 91c0240fd5 Explicitely disable cache for SwiftLintPlugin runs on Xcode Cloud (#5287)
In Xcode Cloud environment, SwiftLint’s cache cannot be written. When using the SwiftLintPlugin, there is no way to disable the cache. Previously, a solution was made for the SwiftLint CLI itself where it looks at a set of environment variables (#4485). This solution offers a cleaner approach where the plugin itself decides whether it needs to enable or disable the cache based on the `CI_XCODE_CLOUD` environment variable.

In the long run, SwiftLint should get rid of `isLikelyXcodeCloudEnvironment` entirely. The caller should always decide if caching is possible or not, while SwiftLint itself should be platform-agnostic.
2023-11-05 14:04:22 +01:00
Danny Mösch e7460339d4 Declare ConfigurationElement as Equatable right away 2023-11-05 00:24:42 +01:00
Danny Mösch 45e19610be Use _modify accessor to allow ConfigurationElement to be a struct type 2023-11-05 00:24:42 +01:00
JP Simard 6e3bfc1a45 Fix more strict concurrency warnings (#5324)
These aren't enough to enable `-strict-concurrency=complete` for more
modules, but they address some warnings with that flag on and reduces
the scope of what remains to be migrated.
2023-11-01 12:41:54 -04:00
JP Simard 7a0cf40d51 [OSSCheck] Remove the Swift project (#5321) 2023-11-01 11:46:31 -04:00
JP Simard bda090b9c0 Update SwiftPM dependencies (#5322) 2023-11-01 15:35:13 +00: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
JP Simard 55c18c5877 Update rules_xcodeproj (#5323) 2023-11-01 11:20:10 -04:00
JP Simard 7086457548 Run buildifier (#5319) 2023-11-01 09:56:43 -04:00
uabyss 6dc4b86f98 Added viewIsAppearing in viewLifecycleMethodNames (#5316) 2023-11-01 08:48:49 -04:00
JP Simard 48604d35e3 Update Sourcery to 2.1.2 (#5318) 2023-10-31 20:34:49 +00:00
JP Simard c4ae9026cb Rewrite DuplicateImportsRule with SwiftSyntax (#5317) 2023-10-31 17:23:25 +00:00
JP Simard 0c635e447f Rewrite DiscouragedOptionalCollectionRule with SwiftSyntax (#5313) 2023-10-30 18:11:49 -04:00
JP Simard bc7d3c0228 Remove unused SubstitutionCorrectableASTRule protocol (#5312)
Last use was removed in https://github.com/realm/SwiftLint/pull/4192.
2023-10-30 14:11:38 -04:00
Marcelo Fabri 686dc3dd32 Rewrite RedundantVoidReturnRule with SwiftSyntax (#4192)
Also include redundant void return clauses for closures in addition to
functions. This can be disabled by configuring the rule with
`include_closures: false`.

Co-authored-by: JP Simard <jp@jpsim.com>
2023-10-30 13:41:31 -04:00
Marcelo Fabri 715198ae3f Rewrite cyclomatic_complexity with SwiftSyntax (#5308) 2023-10-29 11:17:45 -07:00
Marcelo Fabri 5466f96818 Conform BlanketDisableCommandRule to SourceKitFreeRule (#5306) 2023-10-28 23:39:14 -07:00
Marcelo Fabri 491cf5e227 Conform InvalidSwiftLintCommandRule to SourceKitFreeRule (#5304) 2023-10-28 21:57:59 -07:00
Marcelo Fabri 8e34619576 Speed up closure_parameter_position when there are no violations (#5302) 2023-10-27 08:55:46 -07:00
Marcelo Fabri 2b53369fdd [oss-check] Fix rules path (#5303)
So that oss-check can run only the rules that have changed
2023-10-27 05:43:24 -04:00
BB9z cb3001bca2 Keep trailing trivia in explicit_init rule correction (#5296) 2023-10-23 15:41:10 -04: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
Marcelo Fabri ee02f19cfc Fix CocoaPods job + Swift 5.9.1 (#5298) 2023-10-23 10:13:44 +00:00
Danny Mösch b87467fb2c Fail with diagnostic on non-boolean macro arguments 2023-10-19 21:35:57 +02:00
Danny Mösch 3ce2d60938 Move and rename macro errors 2023-10-19 21:35:57 +02:00
Danny Mösch 5ee0ff9535 Inline constants 2023-10-19 21:35:57 +02:00
Danny Mösch ca045a236b Use enums for macro implementations 2023-10-19 21:35:57 +02:00
Slava Karpenko d1e5810b27 Update README with macro validation skipping instructions (#5286)
Xcode 15 introduces an additional security check that requires macros to be explicitly enabled:

> Target 'SwiftLintCoreMacros' must be enabled before it can be used.

In CI environments, this is normally not possible. Fortunately, there is a user defaults key to bypass this.
2023-10-18 09:15:45 +02:00
JP Simard 7d09c6b627 Improve Danger comment when CI jobs are canceled (#5285)
This often happens when pushing a new commit to a PR while the Danger
job for a previous commit is still running.
2023-10-17 15:41:04 -04:00