This is a prerelease version. It won't be published to Homebrew, CocoaPods or bzlmod. 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.51.0-rc.1
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.51.0-rc.1 && make install
- Docker:
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.51.0-rc.1
- Bazel: See instructions at the bottom
Changes from 0.50.3: 0.50.3...0.51.0-rc.1
Breaking
-
Deprecate the
unused_capture_list
rule in favor of the Swift compiler
warning. At the same time, make it an opt-in rule.
Cyberbeni
#4656 -
Deprecate the
inert_defer
rule in favor of the Swift compiler warning.
At the same time, make it an opt-in rule.
SimplyDanny
#4615
Experimental
- None.
Enhancements
-
Add local links to rule descriptions to every rule listed
inRule Directory.md
.
kattouf -
Make forceExclude work with directly specified files.
jimmya
#issue_number -
Separate analyzer rules as an independent section in the rule directory of
the reference.
Ethan Wong
#4664 -
Add rule identifier to output of Emoji reporter.
SimplyDanny
#4707 -
Interpret strings in
excluded
option ofidentifier_name
,
type_name
andgeneric_type_name
rules as regex.
Moly
#4655 -
Add new
direct_return
rule that triggers onreturn
statements returning
variables that have been declared in the statement before only.
SimplyDanny -
Add
period_spacing
opt-in rule that checks periods are not followed
by 2 or more spaces in comments.
Julioacarrettoni
#4624 -
Allow to pass a rule identifier to the
swiftlint docs
command to open its
specific documentation website, e.g.swiftlint docs for_where
.
SimplyDanny
#4707 -
Allow new Quick APIs
aroundEach
andjustBeforeEach
for
quick_discouraged_call
.
David Steinacher
#4626 -
Add
relative-path
reporter to generate reports with relative file paths.
Roya1v
#4660 -
Let
number_separator
rule trigger on misplaced separators, e.g.10_00
.
SimplyDanny
#4637 -
Rewrite
multiline_arguments
rule using SwiftSyntax, ignoring trailing
closures.
Marcelo Fabri
#3399
#3605 -
Speed up linting by up to 6% updating to use a newer version of
SwiftSyntax
.
JP Simard -
Catch more valid
legacy_multiple
violations.
JP Simard -
Catch more valid
no_magic_numbers
violations.
JP Simard
Bug Fixes
-
Report violations in all
<scope>_length
rules when the error threshold is
smaller than the warning threshold.
SimplyDanny
#4645 -
Consider custom attributes in
attributes
rule.
SimplyDanny
#4599 -
Stop triggering
strict_fileprivate
rule on symbols implementing a protocol
in the same file.
SimplyDanny
#4692 -
Fix false positives on
private_subject
rule when using
subjects inside functions.
Marcelo Fabri
#4643 -
Fix for compiler directives masking subsequent
opening_brace
violations.
Martin Redington
#3712 -
Rewrite
explicit_type_interface
rule with SwiftSyntax fixing a
false-positive in if-case-let statements.
SimplyDanny
#4548 -
Ensure that negative literals in initializers do not trigger
no_magic_numbers
rule.
SimplyDanny
#4677 -
Fix caching of
indentation_width
rule.
SimplyDanny
#4121 -
Updated JUnit reporter to output error count and warning count.
patricks
#4725 -
Fix correction on
lower_acl_than_parent
rule foropen
declarations.
Marcelo Fabri
#4753 -
Fix
void_return
rule to support async and async throws functions.
Mathias Schreck
#4772 -
Fix false positives in
attributes
rule when using property wrappers
with keypath arguments.
JP Simard
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 = "43737f28a578d8d8d7ab7df2fb80225a6b23b9af9655fcdc66ae38eb2abcf2ed",
url = "https://github.com/bazelbuild/rules_apple/releases/download/2.0.0/rules_apple.2.0.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 = "f44b1e1c9aac0b4febbfae8479fc4e60df099066076fb10dfc0f42fd83731170",
url = "https://github.com/realm/SwiftLint/releases/download/0.51.0-rc.1/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