Breaking
-
The structure of
SwiftLintBinary.artifactbundle.zip
is now simpler. Internal paths no
longer contain version numbers, especially. So in an Xcode Run Script build phase,
you can refer to theswiftlint
binary like this:SWIFT_PACKAGE_DIR="${BUILD_DIR%Build/*}SourcePackages/artifacts" SWIFTLINT_CMD="$SWIFT_PACKAGE_DIR/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/macos/swiftlint"
All other consumers of the artifact bundle do not need to change anything. Swift Package
Manager resolves the new paths automatically.
SimplyDanny -
SwiftLint now requires a Swift 6 or higher compiler to build. The
Swift Package Manager plugins continue
to work with all versions down to Swift 5.9.
SimplyDanny -
sorted_imports
rule's behavior changed in that it now treats imports directly adjacent
to each other as a group that is sorted together. Imports separated by at least one
non-import statement or empty line(s) are treated as separate groups. Comments are
considered part of the import group they are attached to and do not break it.
SimplyDanny
Experimental
- None.
Enhancements
-
Rewrite the following rules with SwiftSyntax:
modifier_order
sorted_imports
-
Add new
prefer_asset_symbols
rule that suggests using asset symbols over
string-based image initialization to avoid typos and enable compile-time
checking. This rule detectsUIImage(named:)
andSwiftUI.Image(_:)
calls
with string literals and suggests using asset symbols instead.
danglingP0inter
#5939 -
Exclude integer generic parameters from
generic_type_name
rule.
Include integer generic parameters in theidentifier_name
rule for validation.
nandhinisubbu
#6213
Bug Fixes
-
Ignore function, initializer and subscript declarations alike when the
ignores_function_declarations
option is enabled in theline_length
rule.
SimplyDanny
#6241 -
Individual
custom_rules
can now be specified in theonly_rule
configuration
setting and the--only-rule
command line option without having to specify
custom_rules
as well. Additionally, violations of custom rules are now reported
in a deterministic order, sorted by the rule's identifier.
Martin Redington
#6029
#6058 -
Ignore
redundant_discardable_let
rule violations in nested SwiftUI scopes as well
whenignore_swiftui_view_bodies
is enabled.
SimplyDanny
#3855
#6255 -
Exclude function types from
async_without_await
rule analysis. Higher-order function
objects can beasync
without containing anawait
when assigning to them.
SimplyDanny
#6253 -
Exclude
@concurrent
functions fromasync_without_await
rule analysis.
@concurrent
functions requiresaysnc
in any case.
nandhinisubbu
#6283 -
swiftlint-static
, the experimental fully-static Linux binary, now uses 512 KiB
as thread stack size matching Darwin’s size to prevent stack exhaustion.
ainame
#6287
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.62.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 = "de95fe7a9cebdeb1620b860b965b9cb60db4db4282d1efe4c1e26614beb599e3",
url = "https://github.com/realm/SwiftLint/releases/download/0.62.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