This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:
- Downloading the attached
SwiftLint.pkg
installer and launching it - Downloading the attached
portable_swiftlint.zip
archive, extracting it and moving the binary fromportable_swiftlint/swiftlint
to/usr/local/bin
or elsewhere in yourPATH
- Using Mint:
mint install realm/SwiftLint@0.49.0-rc.2
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.49.0-rc.2 && make install
- Docker:
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.49.0-rc.2
- Bazel: See instructions at the bottom
Changes from 0.48.0: 0.48.0...0.49.0-rc.2
Changes from 0.49.0-rc.1: 0.49.0-rc.1...0.49.0-rc.2
Note: The default branch for the SwiftLint git repository will be renamed from
master
to main
on September 1st. Please update any code or automation
accordingly.
Breaking
-
SwiftLint now requires Swift 5.6 or higher to build, and macOS 12
or higher to run.
JP Simard -
Code Climate reports now use SHA256 strings as the issue fingerprint
values.
JP Simard -
Make
comma_inheritance
an opt-in rule.
Steve Madsen
#4027 -
The
autocorrect
command that was deprecated in 0.43.0 has now been
completely removed. Use--fix
instead.
JP Simard -
Remove the
AutomaticTestableRule
protocol. All examples listed in rules are
now tested automatically to make sure they are correct.
SimplyDanny -
Deprecate the
--in-process-sourcekit
command line flag. SwiftLint now always
uses an in-process SourceKit.
JP Simard
Experimental
- None.
Enhancements
-
Make
duplicate_imports
rule correctable. Fixduplicate_imports
rule
reporting redundant violations when more than one duplicate is present.
Timofey Solonin -
Support for building SwiftLint with bazel.
JP Simard -
Support for writing custom private native rules when building with
bazel.
JP Simard
Keith Smiley
#3516 -
Make
comma
rule about 10x faster, finding some previously missed cases and
fixing some previously wrong corrections.
JP Simard -
Make
colon
rule about 7x faster, finding some previously missed cases.
JP Simard -
Make
closure_spacing
rule about 9x faster, finding some previously missed
cases and fixing some previously wrong corrections.
JP Simard
SimplyDanny
#4090 -
Introduce new configuration option
include_compiler_directives
(true
by
default) for theindentation_width
rule that allows to ignore compiler
directives in the indentation analysis. This is especially useful if one (or
a formatter) prefers to have compiler directives always at the very beginning
of a line.
SimplyDanny
#4030 -
Enable (recursive) globs in
included
file paths.
sarastro-nl -
Custom rules are now broken down per rule instead of in aggregate in
--benchmark
.
JP Simard -
The
version
command now has an optional--verbose
flag that prints out the
full version info, notably the build ID, which can be used to determine if two
swiftlint
executables are identical.
JP Simard -
Update documentation for
multiline_arguments_brackets
and
multiline_literal_brackets
to make it immediately obvious that common
examples will trigger.
chrisjf
#4060
Bug Fixes
-
Fix false positive in
self_in_property_initialization
rule when using
closures insidedidSet
and other accessors.
Marcelo Fabri
#4041 -
Fix false positive in
Duplicated Key in Dictionary Literal Violation
rule
when using keys that are generated at runtime with the same source code.
OrEliyahu
#4012 -
Fix false positive in
yoda_condition
rule by basing it on SwiftSyntax.
SimplyDanny
#4081 -
Fix false negatives in
first_where
rule when filtering array of dictionaries
with String keys.
KS1019 -
Fix broken correction for
explicit_init
rule.
KS1019
Using Bazel
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 = "36072d4f3614d309d6a703da0dfe48684ec4c65a89611aeb9590b45af7a3e592",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.0.1/rules_apple.1.0.1.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 = "d34bf123e6380a7527ee78c5f6ec7ede5e00e8c39a9c3b394f590374f566c57d",
url = "https://github.com/realm/SwiftLint/releases/download/0.49.0-rc.2/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