github realm/SwiftLint 0.62.0
0.62.0: Generous Drum Volume

latest release: 0.62.1
one day ago

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 the swiftlint 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

    SimplyDanny

  • 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 detects UIImage(named:) and SwiftUI.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 the identifier_name rule for validation.
    nandhinisubbu
    #6213

Bug Fixes

  • Ignore function, initializer and subscript declarations alike when the
    ignores_function_declarations option is enabled in the line_length rule.
    SimplyDanny
    #6241

  • Individual custom_rules can now be specified in the only_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
    when ignore_swiftui_view_bodies is enabled.
    SimplyDanny
    #3855
    #6255

  • Exclude function types from async_without_await rule analysis. Higher-order function
    objects can be async without containing an await when assigning to them.
    SimplyDanny
    #6253

  • Exclude @concurrent functions from async_without_await rule analysis.
    @concurrent functions requires aysnc 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

Don't miss a new SwiftLint release

NewReleases is sending notifications on new releases.