0.62.1: Generous Drum Volume
Bug Fixes
- Remove trailing comma making the code base again compilable with at least Swift 6.0.
SimplyDanny
0.62.0: Generous Drum Volume
Breaking
-
The structure of
SwiftLintBinary.artifactbundle.zipis now simpler. Internal paths no
longer contain version numbers, especially. So in an Xcode Run Script build phase,
you can refer to theswiftlintbinary 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_importsrule'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_ordersorted_imports
-
Add new
prefer_asset_symbolsrule 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_namerule.
Include integer generic parameters in theidentifier_namerule for validation.
nandhinisubbu
#6213
Bug Fixes
-
Ignore function, initializer and subscript declarations alike when the
ignores_function_declarationsoption is enabled in theline_lengthrule.
SimplyDanny
#6241 -
Individual
custom_rulescan now be specified in theonly_ruleconfiguration
setting and the--only-rulecommand line option without having to specify
custom_rulesas 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_letrule violations in nested SwiftUI scopes as well
whenignore_swiftui_view_bodiesis enabled.
SimplyDanny
#3855
#6255 -
Exclude function types from
async_without_awaitrule analysis. Higher-order function
objects can beasyncwithout containing anawaitwhen assigning to them.
SimplyDanny
#6253 -
Exclude
@concurrentfunctions fromasync_without_awaitrule analysis.
@concurrentfunctions requiresaysncin 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.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 = "34bfe2982ee913d9d1f698f0ea84615536f3ee8f19d43e6bdb19c676fa8647a3",
url = "https://github.com/realm/SwiftLint/releases/download/0.62.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