Breaking
- SwiftLint now requires Swift 5.9 or higher to build.
SimplyDanny
JP Simard
Experimental
- None.
Enhancements
-
Add
only
configuration option totodo
rule which allows to specify
whether the rule shall trigger onTODO
s,FIXME
s or both.
gibachan
#5233 -
Make
unneeded_break_in_switch
auto correctable.
KS1019 -
Speed up
closure_parameter_position
rule when there are no violations.
Marcelo Fabri -
Rewrite
cyclomatic_complexity
rule using SwiftSyntax.
Marcelo Fabri -
Rewrite
redundant_void_return
rule using SwiftSyntax.
Also include redundant void return clauses for closures in addition to
functions. This can be disabled by configuring the rule with
include_closures: false
.
Marcelo Fabri
JP Simard -
Rewrite
discouraged_optional_collection
rule using SwiftSyntax, catching
more violations.
JP Simard -
Rewrite
duplicate_imports
rule using SwiftSyntax.
JP Simard -
Handle
viewIsAppearing
in thetype_contents_order
rule.
u-abyss
#5259 -
Rewrite
vertical_parameter_alignment_on_call
rule using SwiftSyntax, fixing
some false positives.
Marcelo Fabri
#3581 -
Rewrite
no_grouping_extension
rule using SwiftSyntax.
Marcelo Fabri
Bug Fixes
-
Fix false positive in
implicit_getter
rule when using unknown accessors.
kabiroberai
#5300 -
Fix correction of
explicit_init
rule by keeping significant trivia.
BB9z
#5289 -
Fix invalid corrections for opaque and existential optionals in
syntactic_sugar
rule.
SimplyDanny
#5277 -
Fix false positive in
unused_import
rule that triggered on
@_exported
imports which could break downstream modules if removed.
jszumski
#5242 -
Fix false positive in
unused_import
rule when using a constructor
defined in a transitive module.
jszumski
#5246
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.54.0", repo_name = "SwiftLint")
Without bzlmod, put this in your WORKSPACE
:
WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_apple",
sha256 = "9e26307516c4d5f2ad4aee90ac01eb8cd31f9b8d6ea93619fc64b3cbc81b0944",
url = "https://github.com/bazelbuild/rules_apple/releases/download/2.2.0/rules_apple.2.2.0.tar.gz",
)
load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)
apple_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
http_archive(
name = "SwiftLint",
sha256 = "3a97a7d225c6a39716c48aea88eee38df052f678bf6dad73f62c746a3d9cc10c",
url = "https://github.com/realm/SwiftLint/releases/download/0.54.0/bazel.tar.gz",
)
load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos")
swiftlint_repos()
load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps")
swiftlint_deps()
Then you can run SwiftLint in the current directory with this command:
bazel run @SwiftLint//:swiftlint -- --help