Breaking
-
Configuration.IndentationStylemoved toSwiftLintCore.IndentationStyle.
Rules can now read the globalindentationsetting viaCurrentRule.configuration.
GandaLF2006 -
Remove the deprecated
allow_multiline_funcoption from theopening_brace
rule. Useignore_multiline_function_signaturesinstead.
Brett-Best
Enhancements
-
Speed up the
collection_alignmentrule, which read the whole file's
source lines once per element of a dictionary literal.
Brett-Best -
Compare the two operands of a comparison by walking their token streams in
theidentical_operandsrule instead of rendering both operands to strings,
so differing operands stop at the first mismatching token.
Brett-Best -
Add
#examplesand#correctionsmacros that expand lists and
dictionaries of code strings intoExamples, reducing boilerplate when
defining a rule's triggering/non-triggering examples and corrections. Adopt
them across the built-in rules.
ZevEisenberg -
Add
allow_compact_empty_blocksoption to theno_empty_blockrule to
allow empty blocks written compactly as{}while still flagging empty
blocks with any whitespace or newlines between the braces.
arimu1
#6839
Bug Fixes
-
Add an opt-in
allow_explicit_unsafe_unownedoption to let the
unowned_variable_capturerule accept explicitunowned(unsafe)captures.
Yurii Bakurov
#6817 -
Fix
line_lengthwithignores_urlsenabled incorrectly ignoring property
accesses whose member names are valid top-level domains.
Arthur Liu
#6811 -
Fix baseline writing to store file locations as paths relative to the current working directory,
restoring baseline portability and avoiding absolutefile://paths in generated baseline files.
SimplyDanny
#6812 -
Fix correction behavior of
closure_spacingrule when a closure contains only trivia (e.g. comments).
SimplyDanny
#6798
#6799 -
Fix
closure_end_indentationmoving closing braces to column 1 in files
with CRLF line endings when runningswiftlint --fix.
sjh9714
#6598
0.65.0: Fresh Folded Fixtures
Breaking
- SwiftLint now requires Swift 6.1 or higher for development (to run tests). The
executable can still be built with a Swift 6 compiler. The Swift Package Manager plugins
continue to work with all versions down to Swift 5.9.
SimplyDanny
Enhancements
- SwiftLint now builds with Bazel versions 7 to 9.
SimplyDanny
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.65.1", 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 = "ba76492a67197543419d8a20c0f1d371260e76609acf0a411f5a8af8b15d19ab",
url = "https://github.com/realm/SwiftLint/releases/download/0.65.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