Note: The default branch for the SwiftLint git repository was renamed from
master
to main
on September 1st. Please update any code or automation
accordingly.
Breaking
- None.
Experimental
- None.
Enhancements
-
Add new
self_binding
opt-in rule to enforce thatself
identifiers are
consistently re-bound to a common identifier name. Configurebind_identifier
to the name you want to use. Defaults toself
.
JP Simard
#2495 -
Add
--output
option to lint and analyze commands to write to a file instead
of to stdout.
JP Simard
#4048 -
Add
--progress
flag to lint and analyze commands to show a live-updating
progress bar instead of each file being processed.
JP Simard -
--fix
now works with--use-stdin
, printing the output to to STDOUT instead
of crashing.
SimplyDanny
#4127
Bug Fixes
-
Migrate
empty_xctest_method
rule to SwiftSyntax fixing some false positives.
SimplyDanny
#3647
#3691 -
Fix false positives in
redundant_discardable_let
when using
async let
.
Martin Hosna
#4142 -
Consistently print error/info messages to stderr instead of stdout,
which wasn't being done for errors regarding remote configurations.
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 = "f003875c248544009c8e8ae03906bbdacb970bc3e5931b40cd76cadeded99632",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.0/rules_apple.1.1.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 = "7c454ff4abeeecdd9513f6293238a6d9f803b587eb93de147f9aa1be0d8337c4",
url = "https://github.com/realm/SwiftLint/releases/download/0.49.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