github realm/SwiftLint 0.65.1
0.65.1: Fresh Folded Fixtures

2 hours ago

Breaking

  • Configuration.IndentationStyle moved to SwiftLintCore.IndentationStyle.
    Rules can now read the global indentation setting via CurrentRule.configuration.
    GandaLF2006

  • Remove the deprecated allow_multiline_func option from the opening_brace
    rule. Use ignore_multiline_function_signatures instead.
    Brett-Best

Enhancements

  • Speed up the collection_alignment rule, 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
    the identical_operands rule instead of rendering both operands to strings,
    so differing operands stop at the first mismatching token.
    Brett-Best

  • Add #examples and #corrections macros that expand lists and
    dictionaries of code strings into Examples, 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_blocks option to the no_empty_block rule 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_unowned option to let the
    unowned_variable_capture rule accept explicit unowned(unsafe) captures.
    Yurii Bakurov
    #6817

  • Fix line_length with ignores_urls enabled 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 absolute file:// paths in generated baseline files.
    SimplyDanny
    #6812

  • Fix correction behavior of closure_spacing rule when a closure contains only trivia (e.g. comments).
    SimplyDanny
    #6798
    #6799

  • Fix closure_end_indentation moving closing braces to column 1 in files
    with CRLF line endings when running swiftlint --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

Don't miss a new SwiftLint release

NewReleases is sending notifications on new releases.