github realm/SwiftLint 0.59.0
0.59.0: Crisp Spring Clean

latest release: 0.59.1
26 days ago

Breaking

  • Remove tracking of correction positions. Print the number of corrections applied instead.
    SimplyDanny

Experimental

  • Introduce swiftlint-dev command line tool that's intended to help to develop SwiftLint by encapsulating repetitive
    tasks. It can already be used to generate templates for new rules including optional configurations and tests. Run
    swift run swiftlint-dev rules template -h to get an overview of the command's usage and the available
    customization options. To register new rules, run swift run swiftlint-dev rules register.
    SimplyDanny

Enhancements

  • Add new option ignores_multiline_strings to line_length rule. It allows to ignore too long
    lines inside of multiline strings.
    thisIsTheFoxe
    #2689

  • Ignore UIColor initializers in no_magic_numbers rule.
    suojae
    hyeffie
    #5183

  • Exclude types with a @Suite attribute and functions annotated with @Test from no_magic_numbers rule.
    Also treat a type as a @Suite if it contains @Test functions.
    SimplyDanny
    #5964

  • Add new opaque_over_existential opt-in rule that triggers when the existential any type of a
    function parameter can be replaced with an opaque some type.
    SimplyDanny

  • Add a new rationale property to rule descriptions, providing a more expansive
    description of the motivation behind each rule.
    Martin Redington
    #5681

  • Add new allowed_types option to legacy_objc_type rule to ignore certain types.
    kapitoshka438
    #3723

  • Add excluded_methods configuration option to unneeded_override to opt out checking methods with a given name.
    For example, this helps avoid a conflict with balanced_xctest_lifecycle where one of setUp/tearDown
    is empty but the other is not.
    jaredgrubb

Bug Fixes

  • Fix issue referencing the Tests package from another Bazel workspace.
    jszumski

  • Fix crash when a disable command is preceded by a unicode character.
    SimplyDanny
    #5945

  • Allow severity of duplicate_imports rule to be configurable.
    SimplyDanny
    #5978

  • Silence no_magic_numbers rule in conditions of #if directives.
    SimplyDanny
    #6000

  • Consider types restricting a protocol to classes in composed inherited types in class_delegate_protocol rule.
    SimplyDanny
    #5982

  • Rewrite type_contents_order rule with SwiftSyntax fixing an issue with experimental availability macros.
    SimplyDanny
    #5999

  • Update file_name rule to consider macro types.
    fraioli
    #6026


Using Bazel

With bzlmod:

// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.59.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 = "e2ddd07deaa0473ba557ce51c3f4fb87f737f43c87fd01d1c05d8f8ac143a876",
    url = "https://github.com/realm/SwiftLint/releases/download/0.59.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.