ITADN
realm/SwiftLint

版本发布 8

0.63.0-rc.2: High-Speed Extraction0.63.0-rc.2预发布
? · 2025-12-20

### Breaking * The `redundant_self_in_closure` rule has been renamed to `redundant_self` (with `redundant_self_in_closure` as a deprecated alias) to reflect its now broader scope. [SimplyDanny](https://github.com/SimplyDanny) ### Experimental * None. ### Enhancements * Extend `redundant_self_in_closure` rule to detect all redundant uses of `self`, not just in closures. Initializers (which commonly prefer an explicit `self` prefix) can be ignored by setting `keep_in_initializers` to `true`. [SimplyDanny](https://github.com/SimplyDanny) * Add a `separation` configuration option to the `vertical_whitespace_between_cases` rule to allow customizing blank line separation between switch cases. The default value is `always` (require at least one blank line). Setting it to `never` enforces no blank lines between cases. [SimplyDanny](https://github.com/SimplyDanny) [#6326](https://github.com/realm/SwiftLint/issues/6326) * Rewrite the following rules with SwiftSyntax: * `vertical_whitespace_between_cases` <!-- Keep empty line to have the contributors on a separate line. --> [SimplyDanny](https://github.com/SimplyDanny) * Add new opt-in `unneeded_throws_rethrows` rule that triggers when declarations marked `throws`/`rethrows` never actually throw or call any throwing code. [Tony Ngo](https://github.com/tonyskansf) * Add new `unneeded_escaping` rule that detects closure parameters marked with `@escaping` that are never stored or captured escapingly. [SimplyDanny](https://github.com/SimplyDanny) * Add `multiline_call_arguments` opt-in rule to enforce consistent multiline formatting for function and method call arguments. [GandaLF2006](https://github.com/GandaLF2006) * Improve performance when exclude patterns resolve to a large set of files. [SimplyDanny](https://github.com/SimplyDanny) [#5018](https://github.com/realm/SwiftLint/issues/5018) [#5207](https://github.com/realm/SwiftLint/issues/5207) [#5953](https://github.com/realm/SwiftLint/issues/5953) [#6084](https://github.com/realm/SwiftLint/issues/6084) [#6259](https://github.com/realm/SwiftLint/issues/6259) ### Bug Fixes * Fix `line_length` rule incorrectly ignoring function bodies when `ignores_function_declarations` is enabled. The option should only ignore function declarations, not their implementation. [SimplyDanny](https://github.com/SimplyDanny) [#6347](https://github.com/realm/SwiftLint/issues/6347) * Fix false positives in `vertical_whitespace_between_cases` rule when cases are interleaved with compiler directives like `#if`/`#else`/`#endif`. [SimplyDanny](https://github.com/SimplyDanny) [#6332](https://github.com/realm/SwiftLint/issues/6332) * `override_in_extension` no longer triggers inside `@objc @implementation` extensions. [JaredGrubb](https://github.com/jaredgrubb) * Reinstate handling of access level imports in `sorted_imports` rule. [Brett-Best](https://github.com/Brett-Best) [#6374](https://github.com/realm/SwiftLint/issues/6374) --- ### Using Bazel With bzlmod: ``` // Pending BCR update bazel_dep(name = "swiftlint", version = "0.63.0-rc.2", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "b87c861c7ea2d838e3a6725978f39edf94b1fb3ca5f478fa32dd96f360b9d076", url = "https://github.com/realm/SwiftLint/releases/download/0.63.0-rc.2/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```

0.60.0: Fresh Breeze0.60.0
? · 2025-08-30

### Breaking * Remove support for boolean values in the `validates_start_with_lowercase` option entirely. Use the severity levels `off`, `warning` or `error` instead. [kaseken](https://github.com/kaseken) * SwiftLint now requires macOS 13 or higher to run. [JP Simard](https://github.com/jpsim) * In `SwiftLintBuildToolPlugin`, print the content of the `BUILD_WORKSPACE_DIRECTORY` environment variable only in debug builds. [SimplyDanny](https://github.com/SimplyDanny) [#6135](https://github.com/realm/SwiftLint/issues/6135) * The `redundant_optional_initialization` rule has been replaced by the `implicit_optional_initialization` rule that enforces implicit or explicit initialization of optional variables. Its default style `always` mimics the behavior of the `redundant_optional_initialization` rule by default. `redundant_optional_initialization` is now an alias for `implicit_optional_initialization`. [leo-lem](https://github.com/leo-lem) [#1940](https://github.com/realm/SwiftLint/issues/1940) * The `swiftlint_linux.zip` release archive has been renamed to `swiftlint_linux_amd64.zip` to avoid confusion with the new `swiftlint_linux_arm64.zip` archive. [Bradley Mackey](https://github.com/bradleymackey) [SimplyDanny](https://github.com/SimplyDanny) ### Experimental * None. ### Enhancements * Linting got up to 30% faster due to the praiseworthy performance improvements done in the [SwiftSyntax](https://github.com/swiftlang/swift-syntax) library. * Ignore locally defined `count` identifiers in `empty_count` rule. [SimplyDanny](https://github.com/SimplyDanny) [#5326](https://github.com/realm/SwiftLint/issues/5326) * The `private_swiftui_state` rule now applies to `ViewModifier` types. [mt00chikin](https://github.com/mt00chikin) * Support for ARM64 Linux binaries has been added. The `swiftlint_linux.zip` release archive has been renamed to `swiftlint_linux_amd64.zip`. Next to it, a new `swiftlint_linux_arm64.zip` archive has been added. The `SwiftLintBinary.artifactbundle.zip` now contains both versions of the Linux binary, so that the [binary plugins](https://github.com/SimplyDanny/SwiftLintPlugins) can now be used on Linux and macOS running both AMD64 and ARM64 architectures. [Bradley Mackey](https://github.com/bradleymackey) [SimplyDanny](https://github.com/SimplyDanny) * Add `include_variables` configuration option to `non_optional_string_data_conversion` rule. When enabled, the rule will trigger on variables, properties, and function calls in addition to string literals. Defaults to `false` for backward compatibility. [SimplyDanny](https://github.com/SimplyDanny) [#6094](https://github.com/realm/SwiftLint/issues/6094) * Add Sendable conformance to Rule.Type for building with Swift 6. [erikkerber](https://github.com/erikkerber) * Fix false positives for `Actor`-conforming delegate protocols in the `class_delegate_protocol` rule. [imsonalbajaj](https://github.com/imsonalbajaj) [#6054](https://github.com/realm/SwiftLint/issues/6054) * Support extensions and protocols in `type_body_length` rule. They can be configured using the new `excluded_types` option which by default excludes `extension` and `protocol` types. This means the rule now checks `struct`, `class`, `actor` and `enum` by default. To enable checking of extensions and protocols, set `excluded_types` to an empty array or exclude other types as needed. [SimplyDanny](https://github.com/SimplyDanny) * Exclude explicit system modules from `duplicate_imports` analysis, that is, modules that are part of the system frameworks but need to be imported explicitly due to being declared as `explicit module` in their module map. [SimplyDanny](https://github.com/SimplyDanny) [#6098](https://github.com/realm/SwiftLint/issues/6098) * Ignore various assignment operators like `=`, `+=`, `&=`, etc. with right-hand side ternary expressions otherwise violating the `void_function_in_ternary` rule. [SimplyDanny](https://github.com/SimplyDanny) [#5611](https://github.com/realm/SwiftLint/issues/5611) * Rewrite the following rules with SwiftSyntax: * `accessibility_label_for_image` * `accessibility_trait_for_button` * `closure_end_indentation` * `expiring_todo` * `file_header` * `file_length` * `line_length` * `trailing_whitespace` * `vertical_whitespace` <!-- Keep empty line to have the contributors on a separate line. --> [JP Simard](https://github.com/jpsim) [Matt Pennig](https://github.com/pennig) * Add `excluded_paths` option to the `file_name` rule. It allows to exclude complete file paths from analysis. All entries are treated as regular expressions. A single match in its full path is enough to ignore a file. This is different from the `excluded` option that only accepts and checks against file names. [Ueeek](https://github.com/Ueeek) [#6066](https://github.com/realm/SwiftLint/issues/6066) * Fix false positives of `redundant_discardable_let` rule in `@ViewBuilder` functions, `#Preview` macro bodies and preview providers when `ignore_swiftui_view_bodies` is enabled. [kaseken](https://github.com/kaseken) [#6063](https://github.com/realm/SwiftLint/issues/6063) * Improve `multiline_parameters` rule to correctly support `max_number_of_single_line_parameters` and detect mixed formatting. [GandaLF2006](https://github.com/GandaLF2006) * Add new `prefer_condition_list` rule that triggers when a `guard`/`if`/`while` condition is composed of multiple expressions connected by the `&&` operator. It suggests to use a condition list instead, which is more idiomatic. [SimplyDanny](https://github.com/SimplyDanny) * Add `ignore_coding_keys` parameter to `nesting` rule. Setting this to true prevents `CodingKey` enums from violating the rule. [braker1nine](https://github.com/braker1nine) [#5641](https://github.com/realm/SwiftLint/issues/5641) * Support deinitializers and subscripts in `function_body_length` rule. [SimplyDanny](https://github.com/SimplyDanny) * Extend the `xct_specific_matcher` rule to support identity operators (`===` and `!==`) in addition to the existing equality operators (`==` and `!=`). [SimplyDanny](https://github.com/SimplyDanny) [#5849](https://github.com/realm/SwiftLint/issues/5849) * Add new `implicit_optional_initialization` rule to enforce implicit or explicit initialization of optional variables, configurable via `style: always | never`. It replaces the `redundant_optional_initialization` rule mimicking it with the `style: always` option which is the default. [leo-lem](https://github.com/leo-lem) [#1940](https://github.com/realm/SwiftLint/issues/1940) * Add new `ignore_identity_closures` parameter to `prefer_key_paths` rule to skip conversion of identity closures (`{ $0 }`) to identity key paths (`\.self`). Note that identity key paths are only supported from Swift 6 on, hence this option will be implicitly ignored/set to `true` when SwiftLint detects a Swift <6 compiler to avoid causing compilation errors. [p4checo](https://github.com/p4checo) [#5965](https://github.com/realm/SwiftLint/issues/5965) ### Bug Fixes * Fix `no_extension_access_modifier` rule incorrectly triggering for `nonisolated extension`. The rule now only flags actual access control modifiers (`private`, `public`, `open`, `internal`, `fileprivate`) and ignores isolation modifiers like `nonisolated`. [copilot](https://github.com/copilot) [#6168](https://github.com/realm/SwiftLint/issues/6168) * Improved error reporting when SwiftLint exits, because of an invalid configuration file or other error. [Martin Redington](https://github.com/mildm8nnered) [#6052](https://github.com/realm/SwiftLint/issues/6052) * Keep the default severity levels when neither `warning` nor `error` values are configured. Ensure especially that the `error` level is not set to `nil` when the `warning` level isn't set either. [SimplyDanny](https://github.com/SimplyDanny) --- ### Using Bazel With bzlmod: ``` // Pending BCR update bazel_dep(name = "swiftlint", version = "0.60.0", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "639a2d1719dc3bf63cacf298ac936aece542343155e7847adff5384d4c3807fd", url = "https://github.com/realm/SwiftLint/releases/download/0.60.0/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```

0.59.1: Crisp Spring Clean0.59.1
? · 2025-04-15

### Breaking * Remove `opaque_over_existential` opt-in rule as it causes too many false positives that can even lead to wrong-compilable code when `any` is required by a protocol the type conforms to. In this case, using `some` can be totally valid even though the protocol requirement is not reimplemented for the type causing behavioral changes. [SimplyDanny](https://github.com/SimplyDanny) ### Experimental * None. ### Enhancements * Add new `allowed_numbers` option to the `no_magic_numbers` rule. [Martin Redington](https://github.com/mildm8nnered) ### Bug Fixes * None. --- ### Using Bazel With bzlmod: ``` // Pending BCR update bazel_dep(name = "swiftlint", version = "0.59.1", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "5c7aa164801b766bd19aa0968ee7cf07c8d89c9813a63e8cfb0fec9dbb6cd788", url = "https://github.com/realm/SwiftLint/releases/download/0.59.1/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```

0.59.0: Crisp Spring Clean0.59.0
? · 2025-04-05

### Breaking * Remove tracking of correction positions. Print the number of corrections applied instead. [SimplyDanny](https://github.com/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](https://github.com/SimplyDanny) ### Enhancements * Add new option `ignores_multiline_strings` to `line_length` rule. It allows to ignore too long lines inside of multiline strings. [thisIsTheFoxe](https://github.com/thisisthefoxe) [#2689](https://github.com/realm/SwiftLint/issues/2689) * Ignore `UIColor` initializers in `no_magic_numbers` rule. [suojae](https://github.com/suojae) [hyeffie](https://github.com/hyeffie) [#5183](https://github.com/realm/SwiftLint/issues/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](https://github.com/SimplyDanny) [#5964](https://github.com/realm/SwiftLint/issues/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](https://github.com/SimplyDanny) * Add a new rationale property to rule descriptions, providing a more expansive description of the motivation behind each rule. [Martin Redington](https://github.com/mildm8nnered) [#5681](https://github.com/realm/SwiftLint/issues/5681) * Add new `allowed_types` option to `legacy_objc_type` rule to ignore certain types. [kapitoshka438](https://github.com/kapitoshka438) [#3723](https://github.com/realm/SwiftLint/issues/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](https://github.com/jaredgrubb) ### Bug Fixes * Fix issue referencing the Tests package from another Bazel workspace. [jszumski](https://github.com/jszumski) * Fix crash when a disable command is preceded by a unicode character. [SimplyDanny](https://github.com/SimplyDanny) [#5945](https://github.com/realm/SwiftLint/issues/5945) * Allow severity of `duplicate_imports` rule to be configurable. [SimplyDanny](https://github.com/SimplyDanny) [#5978](https://github.com/realm/SwiftLint/issues/5978) * Silence `no_magic_numbers` rule in conditions of `#if` directives. [SimplyDanny](https://github.com/SimplyDanny) [#6000](https://github.com/realm/SwiftLint/issues/6000) * Consider types restricting a protocol to classes in composed inherited types in `class_delegate_protocol` rule. [SimplyDanny](https://github.com/SimplyDanny) [#5982](https://github.com/realm/SwiftLint/issues/5982) * Rewrite `type_contents_order` rule with SwiftSyntax fixing an issue with experimental availability macros. [SimplyDanny](https://github.com/SimplyDanny) [#5999](https://github.com/realm/SwiftLint/issues/5999) * Update `file_name` rule to consider `macro` types. [fraioli](https://github.com/fraioli) [#6026](https://github.com/realm/SwiftLint/issues/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`: <details> <summary>WORKSPACE</summary> ```python 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 = "f6adf602709d4cb25b0ed421fc07d3596ae7935f3186e8ab0917c40c796cf8f4", 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() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```

0.58.2: New Year’s Fresh Fold0.58.2
? · 2025-01-16

### Breaking * None. ### Experimental * None. ### Enhancements * None. ### Bug Fixes * Fix version being reported by the binary consumed from the Docker image. [SimplyDanny](https://github.com/SimplyDanny) [#5966](https://github.com/realm/SwiftLint/issues/5966) --- ### Using Bazel With bzlmod: ``` // Pending BCR update bazel_dep(name = "swiftlint", version = "0.58.2", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "3377c9115221a14a52fa7533c065e48d7de729114cc534c10dcf61036dc59807", url = "https://github.com/realm/SwiftLint/releases/download/0.58.2/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```

0.58.1: New Year’s Fresh Fold0.58.1
? · 2025-01-15

#### Breaking * If you are referring to the `swiftlint` binary from an Artifact Bundle consumed via Swift Package Manager in an Xcode Run Script Build Phase, make sure to update the path from ```bash "$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*/bin/swiftlint ``` to ```bash "$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*-macos/bin/swiftlint ``` in order to make Xcode use the binary built for macOS. [SimplyDanny](https://github.com/SimplyDanny) [#5954](https://github.com/realm/SwiftLint/issues/5954) * Revert changes to improve performance when exclude patterns resolve to a large set of files. While resolving files indeed got much faster in certain setups, it leads to missed exclusions for nested configurations and when the linted folder is not the current folder. [SimplyDanny](https://github.com/SimplyDanny) [#5953](https://github.com/realm/SwiftLint/issues/5953) #### Experimental * None. #### Enhancements * None. #### Bug Fixes * Fix `redundant_sendable` correction by removing a remaining trailing comma as well when `Sendable` was last. [SimplyDanny](https://github.com/SimplyDanny) [#5952](https://github.com/realm/SwiftLint/issues/5952) * Remove lints for `redundant_sendable` on protocols, where `Sendable` is not redundant. [riley-williams](https://github.com/riley-williams) [#5958](https://github.com/realm/SwiftLint/issues/5958) * Add `ib_segue_action` to default configuration of `type_contents_order` rule on the same level as `ib_action` to define and document a standard position. [SimplyDanny](https://github.com/SimplyDanny) [#5524](https://github.com/realm/SwiftLint/issues/5524) --- ### Using Bazel With bzlmod: ``` // Pending BCR update bazel_dep(name = "swiftlint", version = "0.58.1", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "94b2c63592859e0fc60f53ff4002b9ceb87fb712106ce250548261860d8a9575", url = "https://github.com/realm/SwiftLint/releases/download/0.58.1/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```

0.58.0: New Year’s Fresh Fold0.58.0
? · 2025-01-12

#### Breaking * The command plugin now requires write permissions so that it works with the `--fix` option without an error. [SimplyDanny](https://github.com/SimplyDanny) * The artifact bundle name has changed. `SwiftLintBinary-macos.artifactbundle.zip` is now called `SwiftLintBinary.artifactbundle.zip`. It now includes an AMD64 Linux binary. [Bradley Mackey](https://github.com/bradleymackey) [#5514](https://github.com/realm/SwiftLint/issues/5514) * The `inert_defer` and `unused_capture_list` rules have completely been removed after being deprecated for 2 years. [SimplyDanny](https://github.com/SimplyDanny) * SwiftLint now requires a Swift 5.10 or higher compiler to build. [The Swift Package Manager plugins](https://github.com/SimplyDanny/SwiftLintPlugins) continue to work with Swift 5.9. [SimplyDanny](https://github.com/SimplyDanny) * The `private_unit_test` rule's deprecated `regex` configuration option has been removed after 2 years. [Martin Redington](https://github.com/mildm8nnered) [#5912](https://github.com/realm/SwiftLint/issues/5912) #### Experimental * None. #### Enhancements * Add Xcode command plugin allowing to run SwiftLint from within Xcode. [SimplyDanny](https://github.com/SimplyDanny) * Add new `async_without_await` opt-in rule that checks if an `async` declaration contains at least one `await`. [Jan Kolarik](https://github.com/jkolarik-paylocity) [#5082](https://github.com/realm/SwiftLint/issues/5082) * Support replacing identity expressions with `\.self` in `prefer_key_path` rule from Swift 6 on. [SimplyDanny](https://github.com/SimplyDanny) * Support linting only provided file paths with command plugins. [DanSkeel](https://github.com/DanSkeel) * Add new category for `@IBSegueAction` to `type_contents_order` rule. [dk-talks](https://github.com/dk-talks) [SimplyDanny](https://github.com/SimplyDanny) * Add option to disable `redundant_discardable_let` rule in SwiftUI view bodies. [SimplyDanny](https://github.com/SimplyDanny) [#3855](https://github.com/realm/SwiftLint/issues/3855) * Add new `redundant_sendable` rule that triggers on `Sendable` conformances of types that are implicitly already `Sendable` due to being actor-isolated. It is enabled by default. [SimplyDanny](https://github.com/SimplyDanny) * Improve performance when exclude patterns resolve to a large set of files. [SimplyDanny](https://github.com/SimplyDanny) [#5018](https://github.com/realm/SwiftLint/issues/5018) #### Bug Fixes * Ignore TipKit's `#Rule` macro in `empty_count` rule. [Ueeek](https://github.com/Ueeek) [#5883](https://github.com/realm/SwiftLint/issues/5883) * Ignore super calls with trailing closures in `unneeded_override` rule. [SimplyDanny](https://github.com/SimplyDanny) [#5886](ttps://github.com/realm/SwiftLint/issues/5886) * If violations are detected by `lint` or `analyze`, still perform an update check for new versions of SwiftLint if requested. [Martin Redington](https://github.com/mildm8nnered) [#5904](ttps://github.com/realm/SwiftLint/issues/5904) --- ### Using Bazel With bzlmod: ``` // Pending BCR update bazel_dep(name = "swiftlint", version = "0.58.0", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "7f069bc44c548896f78b80cdf223643f6f6da5093a934e834dd7f68eaf1d1940", url = "https://github.com/realm/SwiftLint/releases/download/0.58.0/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```

0.57.1: Squeaky Clean Cycle0.57.1
? · 2024-11-24

#### 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](https://github.com/jrose-signal) [SimplyDanny](https://github.com/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](https://github.com/BlueVirusX) * Adds a `lenient` configuration file setting, equivalent to the `--lenient` command line option. [Martin Redington](https://github.com/mildm8nnered) [#5801](https://github.com/realm/SwiftLint/issues/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](https://github.com/SimplyDanny) [#5774](https://github.com/realm/SwiftLint/issues/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](https://github.com/kimdv) [SimplyDanny](https://github.com/SimplyDanny) [#5781](https://github.com/realm/SwiftLint/issues/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](https://github.com/jaredgrubb) [#3750](https://github.com/realm/SwiftLint/issues/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](https://github.com/SimplyDanny) [#5793](https://github.com/realm/SwiftLint/issues/5793) #### Bug Fixes * Run command plugin in whole package if no targets are defined in the package manifest. [SimplyDanny](https://github.com/SimplyDanny) [#5787](https://github.com/realm/SwiftLint/issues/5787) * Silence `superfluous_else` rule on `if` expressions with only a single availability condition. [SimplyDanny](https://github.com/SimplyDanny) [#5833](https://github.com/realm/SwiftLint/issues/5833) * Stop triggering the `control_statement` rule on closures being directly called as conditions. [SimplyDanny](https://github.com/SimplyDanny) [#5846](https://github.com/realm/SwiftLint/issues/5846) * Do not trigger `self_in_property_initialization` rule on `self` in key paths expressions. [SimplyDanny](https://github.com/SimplyDanny) [#5835](https://github.com/realm/SwiftLint/issues/5835) * Allow to specify transitive modules to be taken into account by `unused_import` rule. This avoids that required imports are removed. [Paul Taykalo](https://github.com/PaulTaykalo) [SimplyDanny](https://github.com/SimplyDanny) [#5167](https://github.com/realm/SwiftLint/issues/5167) * Only pass cache path and directory paths to commands that accept these arguments in the command plugin. [SimplyDanny](https://github.com/SimplyDanny) [#5848](https://github.com/realm/SwiftLint/issues/5848) * Do not throw deprecation warning if deprecated property is not presented in configuration. [chipp](https://github.com/chipp) [#5791](https://github.com/realm/SwiftLint/issues/5791) * The `prefer_type_checking` rule will no longer trigger for non-optional type casting (`as`), or for comparisons to optional types. [Martin Redington](https://github.com/mildm8nnered) [#5802](https://github.com/realm/SwiftLint/issues/5802) * Fixes an issue where the `superfluous_disable_command` rule could generate false positives for nested disable commands for custom rules. [Martin Redington](https://github.com/mildm8nnered) [#5788](https://github.com/realm/SwiftLint/issues/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](https://github.com/mildm8nnered) [#5711](https://github.com/realm/SwiftLint/issues/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`: <details> <summary>WORKSPACE</summary> ```python 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() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```