Skip to content

0.57.1: Squeaky Clean Cycle

Latest
Compare
Choose a tag to compare
@SimplyDanny SimplyDanny released this 24 Nov 15:10
· 24 commits to main since this release

Breaking

  • None.

Experimental

  • None.

Enhancements

  • Suggest failable String(bytes:encoding:) initializer in
    optional_data_string_conversion rule as it accepts all Sequence
    types.
    Jordan Rose
    SimplyDanny

  • Support reading files to lint from Input File Lists provided
    by Run Script Build Phases in Xcode using the command-line
    argument --use-script-input-file-lists.
    BlueVirusX

  • Adds a lenient configuration file setting, equivalent to the --lenient
    command line option.
    Martin Redington
    #5801

  • Support type casting on configuration option values defined by environment variables.
    Without a cast, these values would always be treated as strings leading to a potentially
    invalid configuration.
    SimplyDanny
    #5774

  • Add new option max_number_of_single_line_parameters that allows only the specified maximum
    number of parameters to be on one line when allows_single_line = true. If the limit is
    exceeded, the rule will still trigger. Confusing option combinations like allows_single_line = false
    together with max_number_of_single_line_parameters > 1 will be reported.
    kimdv
    SimplyDanny
    #5781

  • The redundant_type_annotation rule gains a new option,
    ignore_properties, that skips enforcement on members in a
    type declaration (like a struct). This helps the rule coexist with
    the explicit_type_interface rule that requires such redundancy.
    jaredgrubb
    #3750

  • Allow inherited isolation parameter to be first in function signatures
    depending on the new option ignore_first_isolation_inheritance_parameter
    which is true by default.
    SimplyDanny
    #5793

Bug Fixes

  • Run command plugin in whole package if no targets are defined in the
    package manifest.
    SimplyDanny
    #5787

  • Silence superfluous_else rule on if expressions with only a single
    availability condition.
    SimplyDanny
    #5833

  • Stop triggering the control_statement rule on closures being directly
    called as conditions.
    SimplyDanny
    #5846

  • Do not trigger self_in_property_initialization rule on self in
    key paths expressions.
    SimplyDanny
    #5835

  • Allow to specify transitive modules to be taken into account by
    unused_import rule. This avoids that required imports are removed.
    Paul Taykalo
    SimplyDanny
    #5167

  • Only pass cache path and directory paths to commands that accept these arguments
    in the command plugin.
    SimplyDanny
    #5848

  • Do not throw deprecation warning if deprecated property is not
    presented in configuration.
    chipp
    #5791

  • The prefer_type_checking rule will no longer trigger for non-optional
    type casting (as), or for comparisons to optional types.
    Martin Redington
    #5802

  • Fixes an issue where the superfluous_disable_command rule could generate
    false positives for nested disable commands for custom rules.
    Martin Redington
    #5788

  • Fixes the --only-rule command line option, when a default .swiftlint.yml
    is absent. Additionally rules specified with --only-rule on the command
    line can now be disabled in a child configuration, to allow specific
    directories to be excluded from the rule (or from being auto-corrected by
    the rule), and --only-rule can now be specified multiple times
    to run multiple rules.
    Martin Redington
    #5711


Using Bazel

With bzlmod:

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