SwiftLint breaking changes

swift

49 curated breaking changes across major versions of SwiftLint. Use this as a migration checklist before bumping dependencies.

49
changes
Breaking changes by transition
  • 0.64.0-rc.1 \u2192 0.63.2breaking

    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, while it still maintains the previous behavior of only checking closures by default. To enable checking for all redundant `self` usages, set the new `only_in_closures` option to `false`. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.63.0 \u2192 0.63.1breaking

    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, while it still maintains the previous behavior of only checking closures by default. To enable checking for all redundant `self` usages, set the new `only_in_closures` option to `false`. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.62.2 \u2192 0.63.0-rc.2breaking

    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)

  • 0.63.0-rc.2 \u2192 0.63.0breaking

    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, while it still maintains the previous behavior of only checking closures by default. To enable checking for all redundant `self` usages, set the new `only_in_closures` option to `false`. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.62.1 \u2192 0.62.2breaking

    SwiftLint now requires a Swift 6 or higher compiler to build. The [Swift Package Manager plugins](https://github.com/SimplyDanny/SwiftLintPlugins) continue to work with all versions down to Swift 5.9. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.62.1 \u2192 0.62.2breaking

    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: ```bash 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 Packa

  • 0.62.1 \u2192 0.62.2breaking

    `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](https://github.com/SimplyDanny)

  • 0.62.0 \u2192 0.62.1breaking

    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: ```bash 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 Packa

  • 0.62.0 \u2192 0.62.1breaking

    SwiftLint now requires a Swift 6 or higher compiler to build. The [Swift Package Manager plugins](https://github.com/SimplyDanny/SwiftLintPlugins) continue to work with all versions down to Swift 5.9. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.62.0 \u2192 0.62.1breaking

    `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](https://github.com/SimplyDanny)

  • 0.61.0 \u2192 0.62.0breaking

    `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](https://github.com/SimplyDanny)

  • 0.61.0 \u2192 0.62.0breaking

    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: ```bash 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 Packa

  • 0.61.0 \u2192 0.62.0breaking

    SwiftLint now requires a Swift 6 or higher compiler to build. The [Swift Package Manager plugins](https://github.com/SimplyDanny/SwiftLintPlugins) continue to work with all versions down to Swift 5.9. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.60.0 \u2192 0.61.0breaking

    If `SWIFTLINT_DISABLE_SOURCEKIT` is set to prohibit loading `libsourcekitdInProc` at runtime, rules requiring SourceKit will be disabled and a warning will be printed once per rule. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.60.0 \u2192 0.61.0breaking

    The `operator_whitespace` rule has been removed and its functionality merged into the `function_name_whitespace` rule. The latter now also checks spacing around the `func` keyword, the function name/operator and its generic parameters while respecting comments. On top of that, it supports autocorrection. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.60.0 \u2192 0.61.0breaking

    Expose only `TestHelpers` and `ExtraRulesTests` as part of Bazel releases. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.59.1 \u2192 0.60.0breaking

    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)

  • 0.59.1 \u2192 0.60.0breaking

    SwiftLint now requires macOS 13 or higher to run. [JP Simard](https://github.com/jpsim)

  • 0.59.1 \u2192 0.60.0breaking

    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)

  • 0.59.1 \u2192 0.60.0breaking

    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)

  • 0.59.1 \u2192 0.60.0breaking

    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)

  • 0.59.0 \u2192 0.59.1breaking

    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)

  • 0.58.2 \u2192 0.59.0breaking

    Remove tracking of correction positions. Print the number of corrections applied instead. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.58.0 \u2192 0.58.1breaking

    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](

  • 0.58.0 \u2192 0.58.1breaking

    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)

  • 0.57.1 \u2192 0.58.0breaking

    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)

  • 0.57.1 \u2192 0.58.0breaking

    The command plugin now requires write permissions so that it works with the `--fix` option without an error. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.57.1 \u2192 0.58.0breaking

    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)

  • 0.57.1 \u2192 0.58.0breaking

    The `inert_defer` and `unused_capture_list` rules have completely been removed after being deprecated for 2 years. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.57.1 \u2192 0.58.0breaking

    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)

  • 0.56.2 \u2192 0.57.0breaking

    The deprecated `anyobject_protocol` rule has now been removed. [Martin Redington](https://github.com/mildm8nnered) [#5769](https://github.com/realm/SwiftLint/issues/5769)

  • 0.56.2 \u2192 0.57.0breaking

    Revert the part of the `non_optional_string_data_conversion` rule that enforces non-failable conversions of `Data` to UTF-8 `String`. This is due to the fact that the data to be converted can be arbitrary and especially doesn't need to represent a valid UTF-8-encoded string. [Sam Rayner](https://github.com/samrayner) [#5263](https://github.com/realm/SwiftLint/issues/5263)

  • 0.55.1 \u2192 0.56.0breaking

    The deprecated `--path` and `--in-process-sourcekit` arguments have now been removed completely. [Martin Redington](https://github.com/mildm8nnered) [SimplyDanny](https://github.com/SimplyDanny) [#5614](https://github.com/realm/SwiftLint/issues/5614)

  • 0.55.1 \u2192 0.56.0breaking

    When SwiftLint corrects violations automatically (`swiftlint lint --fix`) it doesn't report the exact location of the fix any longer. The new format is `<file-path>: Correcting <rule-name>` without line and column numbers. Reason: Correction positions are likely just incorrect, especially when multiple rules apply their rewrites. Fixing that is not trivial and likely not worth the effort also considering that there haven't been any bug reports about wrong correction positions so far. [SimplyDann

  • 0.54.0 \u2192 0.55.0breaking

    The `superfluous_disable_command` rule will now be enabled for the `analyze` command, unless it has been disabled, and will warn about superfluous disablement of analyzer rules. [Martin Redington](https://github.com/mildm8nnered) [#4792](https://github.com/realm/SwiftLint/issues/4792)

  • 0.54.0 \u2192 0.55.0breaking

    With the introduction of the `consider_default_literal_types_redundant` option to the `redundant_type_annotation` rule, `Bool` literals will no longer be considered redundant by default. Set this option to true to preserve the previous behavior. [Garric Nahapetian](https://github.com/garricn)

  • 0.54.0 \u2192 0.55.0breaking

    Rewrite `SwiftLintBuildToolPlugin` using `BUILD_WORKSPACE_DIRECTORY` without relying on the `--config` option. [Garric Nahapetian](https://github.com/garricn)

  • 0.54.0 \u2192 0.55.0breaking

    Introduce SwiftLintCommandPlugin. Rename SwiftLintBuildToolPlugin. Add Swift Package Manager installation instructions. [garricn](https://github.com/garricn)

  • 0.54.0 \u2192 0.55.0breaking

    Fix Code Climate reporter output by having lower case severity values to comply with the Code Climate specification. [waitButY](https://github.com/waitbutY)

  • 0.53.0 \u2192 0.54.0breaking

    SwiftLint now requires Swift 5.9 or higher to build. [SimplyDanny](https://github.com/SimplyDanny) [JP Simard](https://github.com/jpsim)

  • 0.52.4 \u2192 0.53.0breaking

    The options `inlcuded`, `name` and `message` are from now on ignored in the configuration for the `private_unit_test` rule. The option `regex` is still supported but is deprecated. It's recommended to use the list `test_parent_classes` instead which accepts names of parent test classes. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.52.4 \u2192 0.53.0breaking

    Hide all `Reporter`s from SwiftLint's' public interface. [SimplyDanny](https://github.com/SimplyDanny)

  • 0.52.4 \u2192 0.53.0breaking

    Remove support for disable and enable commands in multiline comments. [Martin Redington](https://github.com/mildm8nnered) [#4798](https://github.com/realm/SwiftLint/issues/4798)

  • 0.52.0 \u2192 0.52.1breaking

    The `attributes` rule now expects attributes with arguments to be placed on their own line above the declaration they are supposed to influence. This applies to attributes with any kinds of arguments including single key path arguments which were previously handled in a different way. This behavior can be turned off by setting `attributes_with_arguments_always_on_line_above` to `false. [SimplyDanny](https://github.com/SimplyDanny) [#4843](https://github.com/realm/SwiftLint/issues/4843)

  • 0.52.0 \u2192 0.52.1breaking

    The internal module structure for SwiftLint has changed to split the monolithic `SwiftLintFramework` into new `SwiftLintCore` for core linter infrastructure, `SwiftLintBuiltInRules` for built-in rules and `SwiftLintExtraRules` to add your own native rules to SwiftLint. [JP Simard](https://github.com/jpsim)

  • 0.51.0 \u2192 0.52.0breaking

    The internal module structure for SwiftLint has changed to split the monolithic `SwiftLintFramework` into new `SwiftLintCore` for core linter infrastructure, `SwiftLintBuiltInRules` for built-in rules and `SwiftLintExtraRules` to add your own native rules to SwiftLint. [JP Simard](https://github.com/jpsim)

  • 0.51.0 \u2192 0.52.0breaking

    The `attributes` rule now expects attributes with arguments to be placed on their own line above the declaration they are supposed to influence. This applies to attributes with any kinds of arguments including single key path arguments which were previously handled in a different way. This behavior can be turned off by setting `attributes_with_arguments_always_on_line_above` to `false. [SimplyDanny](https://github.com/SimplyDanny) [#4843](https://github.com/realm/SwiftLint/issues/4843)

  • unknown \u2192 0.51.0breaking

    Deprecate the `unused_capture_list` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [Cyberbeni](https://github.com/Cyberbeni) [#4656](https://github.com/realm/SwiftLint/issues/4656)

  • unknown \u2192 0.51.0breaking

    Deprecate the `inert_defer` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [SimplyDanny](https://github.com/SimplyDanny) [#4615](https://github.com/realm/SwiftLint/issues/4615)

API access

Get this data programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/breaking/swift/SwiftLint
SwiftLint breaking changes — Swift migration guide | DepScope