Skip to content

Releases: realm/SwiftLint

0.46.0: Detergent Container

21 Jan 20:59
17779cb
Compare
Choose a tag to compare

Breaking

  • The weak_delegate rule has been deprecated due to its high false
    positive rate. The identifier will become invalid in a future
    release.
    JP Simard
    #2786

Experimental

  • None.

Enhancements

Bug Fixes

0.45.1: Clothes Drying Hooks

29 Nov 21:52
9534937
Compare
Choose a tag to compare

Breaking

  • None.

Experimental

  • None.

Enhancements

  • Update Rule list documentation to distinguish between opt-in and
    on-by-default rules.
    Benny Wong

  • Add opt-in prefer_self_in_static_references rule to warn if the
    type name is used to reference static members the same type.
    Prefer using Self instead which is not affected by renamings.
    SimplyDanny

  • Add support for running SwiftLint as a
    pre-commit hook.
    Jesse Crocker
    Hannes Ljungberg

Bug Fixes

  • Fix unused_import rule incorrectly considering SwiftShims as a
    used import.
    JP Simard

  • Fix false positives on large_tuple rule when using async closures.
    Kaitlin Mahar
    #3753

  • Fix false positive on legacy_objc_type rule when using
    types with names that start with a legacy type name.
    Isaac Ressler
    #3555

0.45.0: Effectful Apparel

18 Oct 15:58
99465e6
Compare
Choose a tag to compare

Breaking

  • SwiftLint now requires Swift 5.4 or higher to build.
    JP Simard

Experimental

  • None.

Enhancements

  • Add self_in_property_initialization rule to catch uses of self
    inside an inline closure used for initializing a variable. In this case,
    self refers to the NSObject.self method and likely won't be what you
    expect. You can make the variable lazy to be able to refer to the current
    instance with self or use MyClass.self if you really want to reference
    the method.
    Marcelo Fabri

  • Exclude id from identifier_name by default.
    Artem Garmash
    #3651

  • Handle get async and get throws (introduced in Swift 5.5) in the
    implicit_getter rule.
    Marcelo Fabri
    #3684

  • Speed up explicit type interface rule.
    PaulTaykalo
    #3745

  • Speed up analyzer rules.
    PaulTaykalo
    #3747

Bug Fixes

  • Fix a bug with the missing_docs rule where
    excludes_inherited_types would not be set.
    Ben Fox

  • Fix redundant_optional_initialization autocorrect broken
    in case observer's brace exists.
    Naruki Chigira
    #3718

  • Fix a false positive in the unneeded_break_in_switch rule when
    using do/catch.
    Marcelo Fabri
    #3724

  • Speed up Computed Accessors Order rule.
    PaulTaykalo
    #3727

  • [Colon Rule] Fix case when comment is used in function call.
    PaulTaykalo
    #3740

0.44.0: Travel Size Lint Roller

09 Sep 22:00
e820e75
Compare
Choose a tag to compare

Breaking

  • SwiftLint now requires Swift 5.3 or higher to build.
    JP Simard

Experimental

  • None.

Enhancements

  • Add configuration options to missing_docs rule:

    • excludes_extensions defaults to true to skip reporting violations
      for extensions with missing documentation comments.
    • excludes_inherited_types defaults to true to skip reporting
      violations for inherited declarations, like subclass overrides.
      Ben Fox
  • Fix false negative on redundant_optional_initialization rule when variable
    has observers.
    Isaac Ressler
    #3621

  • Make test_case_accessibility rule identify invalid test functions
    with parameters.
    Keith Smiley
    #3612

  • Add duplicated_key_in_dictionary_literal rule to warn against duplicated
    keys in dictionary literals.
    Marcelo Fabri

  • Fix the rule name from "Colon" to "Colon Spacing" to improve phrasing.
    Radu
    #3587

  • Add discouraged_none_name opt-in rule to discourage naming cases and
    static/class members "none", which can conflict with Swift's
    Optional<T>.none when checking equality.
    Kane Cheshire
    #3624

  • Improve language and positioning of file_length warnings when
    ignore_comment_only_lines: true.
    Steven Grosmark
    #3654

  • Add anonymous_argument_in_multiline_closure opt-in rule to validate that
    named arguments are used in closures that span multiple lines.
    Marcelo Fabri

Bug Fixes

  • Fix false positives in empty_enum_arguments rule when comparing values
    with a static member (e.g. if number == .zero).
    Marcelo Fabri
    #3562

  • Fix the regex for expiring-todos.
    namolnad
    #3597

  • Fix type_contents_order initializer detection.
    StevenMagdy

  • Fix autocorrect when there's no space between the tuple the in keyword
    on unneeded_parentheses_in_closure_argument rule.
    p-x9
    #3633

  • Fix unused_capture_list, empty_enum_arguments, implicit_return and
    explicit_type_interface rules when using Swift 5.4.
    Marcelo Fabri
    #3615
    #3685

  • Fix Xcode build logs with spaces in paths preventing analyze from running.
    adamawolf

0.43.1: Laundroformat

15 Mar 16:03
180d941
Compare
Choose a tag to compare

Breaking

  • None.

Experimental

  • None.

Enhancements

  • None.

Bug Fixes

  • Fix the File Length rule name.
    onato
    #3560

  • Re-add --format flag to reformat Swift files using SourceKit.
    Only applied with --fix/--autocorrect.
    JP Simard
    #3571

0.43.0: Clothes Line Interface

03 Mar 21:02
Compare
Choose a tag to compare

Breaking

  • The command line syntax has slightly changed due to migrating from the
    Commandant command line parsing library to swift-argument-parser.
    For the most part the breaking changes are all to make the syntax more
    unix compliant and intuitive to use. For example, commands such as
    swiftlint --help or swiftlint -h now work as expected.
    The help output from various commands has greatly improved as well.
    Notably: swiftlint autocorrect was removed in favor of
    swiftlint --fix.
    Previous commands should continue to work temporarily to help with the
    transition. Please let us know if there's a command that no longer
    works and we'll attempt to add a bridge to help with its transition.
    JP Simard

  • Configuration files now consistently have their included/excluded
    relative file paths applied relative to their location in the file
    system. Previously the root configuration file applied these relative
    to the current working directory, but nested configurations applied
    these to their location in the file system.
    Frederick Pietschmann
    JP Simard

  • The discarded_notification_center_observer is now opt-in due to some
    difficult to resolve false positives, such as
    #3498.
    JP Simard

Experimental

  • None.

Enhancements

  • Added allows_single_line option in multiline_parameters rule
    configuration. Defaults to true. This enforces parameters in a method
    with multiple parameters to always be in different lines.
    Otavio Cordeiro

  • Support relative paths in compilation databases for SwiftLint analyzer
    rules.
    JP Simard

  • Add opt-in rule discouraged_assert to encourage the use of
    assertionFailure() and/or preconditionFailure() over
    assert(false).
    Otavio Cordeiro

  • Adds balanced_xctest_lifecycle opt-in rule to enforce balanced setUp
    and tearDown methods in a test class.
    Otavio Cordeiro
    #3452

  • Tweak the auto-correction result console output for clarity.
    mokagio
    #3522

  • Allow configuring related USRs to skip in UnusedDeclarationRule by
    specifying a list of USRs in the related_usrs_to_skip key.
    For example you might have custom source tooling that does something
    with types conforming to a procotol even if that type is never
    explicitly referenced by other code.
    JP Simard

  • Make strong_iboutlet rule correctable.
    MaxHaertwig

  • Add legacy_objc_type opt-in rule to warn against using
    bridged Objective-C reference types instead of Swift value types.
    Blake
    #2758

  • Support Swift Playground control comments in the comment_spacing
    rule.
    Thomas Goyne

  • [Internal] Integrate OS Signposts to help profile SwiftLint
    performance.
    jpsim

  • Update CodeClimateReporter to produce relative paths.
    bmwalters

  • Add Bool violation reporting in redundant_type_annotation.
    Artem Garmash
    #3423

  • Add a new capture_variable analyzer rule to warn about listing a
    non-constant (var) variable in a closure's capture list. This
    captures the variable's value at closure creation time instead of
    closure call time, which may be unexpected.
    Laszlo Kustra

  • Log references to a specified module when running the unused_import
    by setting the SWIFTLINT_LOG_MODULE_USAGE=<module-name> environment
    variable when running analyze.
    jpsim

  • Add opt-in rule private_subject rule which warns against
    public Combine subjects.
    Otavio Cordeiro

Bug Fixes

  • Fix custom_rules merging when the parent configuration is based on
    only_rules.
    Frederick Pietschmann
    #3468

  • Fix misleading warnings about rules defined in the custom_rules not
    being available (when using multiple configurations).
    Frederick Pietschmann
    #3472

  • Fix bug that prevented the reconfiguration of a custom rule in a child
    config.
    Frederick Pietschmann
    #3477

  • Fix typos in configuration options for file_name rule.
    advantis

  • Fix issue that prevented the inclusion of a configuration file from a
    parent folder.
    Frederick Pietschmann
    #3485

  • Fix violation location and misplaced corrections for some function
    references in explicit_self rule.
    JP Simard

  • Fix false positives with result builders in unused_declaration.
    JP Simard

  • Find more unused declarations in unused_declaration.
    JP Simard

  • Fix parsing xcode logs for analyzer rules for target names with
    spaces.
    JP Simard
    #3021

0.43.0-rc.4: Clothes Line Interface

26 Feb 20:09
65b07ec
Compare
Choose a tag to compare
Pre-release

This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:

  • Downloading the attached SwiftLint.pkg installer and launching it
  • Downloading the attached portable_swiftlint.zip archive, extracting it and moving the binary from portable_swiftlint/swiftlint to /usr/local/bin or elsewhere in your PATH
  • Using Mint: mint install realm/[email protected]
  • Cloning and building from source: git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.4 && make install

Changes from 0.43.0-rc.3: 0.43.0-rc.3...0.43.0-rc.4

Breaking

  • The command line syntax has slightly changed due to migrating from the
    Commandant command line parsing library to swift-argument-parser.
    For the most part the breaking changes are all to make the syntax more
    unix compliant and intuitive to use. For example, commands such as
    swiftlint --help or swiftlint -h now work as expected.
    The help output from various commands has greatly improved as well.
    Notably: swiftlint autocorrect was removed in favor of
    swiftlint --fix.
    Previous commands should continue to work temporarily to help with the
    transition. Please let us know if there's a command that no longer
    works and we'll attempt to add a bridge to help with its transition.
    JP Simard

  • Configuration files now consistently have their included/excluded
    relative file paths applied relative to their location in the file
    system. Previously the root configuration file applied these relative
    to the current working directory, but nested configurations applied
    these to their location in the file system.
    Frederick Pietschmann
    JP Simard

  • The discarded_notification_center_observer is now opt-in due to some
    difficult to resolve false positives, such as
    #3498.
    JP Simard

Experimental

  • None.

Enhancements

  • Added allows_single_line option in multiline_parameters rule
    configuration. Defaults to true. This enforces parameters in a method
    with multiple parameters to always be in different lines.
    Otavio Cordeiro

  • Support relative paths in compilation databases for SwiftLint analyzer
    rules.
    JP Simard

  • Add opt-in rule discouraged_assert to encourage the use of
    assertionFailure() and/or preconditionFailure() over
    assert(false).
    Otavio Cordeiro

  • Add opt-in rule private_subject rule which warns against
    public Combine subjects.
    Otavio Cordeiro

  • Tweak the auto-correction result console output for clarity.
    mokagio
    #3522

  • Allow configuring related USRs to skip in UnusedDeclarationRule by
    specifying a list of USRs in the related_usrs_to_skip key.
    For example you might have custom source tooling that does something
    with types conforming to a procotol even if that type is never
    explicitly referenced by other code.
    JP Simard

  • Make strong_iboutlet rule correctable.
    MaxHaertwig

  • Add legacy_objc_type opt-in rule to warn against using
    bridged Objective-C reference types instead of Swift value types.
    Blake
    #2758

  • Support Swift Playground control comments in the comment_spacing
    rule.
    Thomas Goyne

  • [Internal] Integrate OS Signposts to help profile SwiftLint
    performance.
    jpsim

  • Update CodeClimateReporter to produce relative paths.
    bmwalters

  • Add Bool violation reporting in redundant_type_annotation.
    Artem Garmash
    #3423

  • Log references to a specified module when running the unused_import
    by setting the SWIFTLINT_LOG_MODULE_USAGE=<module-name> environment
    variable when running analyze.
    jpsim

Bug Fixes

  • Fix custom_rules merging when the parent configuration is based on
    only_rules.
    Frederick Pietschmann
    #3468

  • Fix misleading warnings about rules defined in the custom_rules not
    being available (when using multiple configurations).
    Frederick Pietschmann
    #3472

  • Fix bug that prevented the reconfiguration of a custom rule in a child
    config.
    Frederick Pietschmann
    #3477

  • Fix typos in configuration options for file_name rule.
    advantis

  • Fix issue that prevented the inclusion of a configuration file from a
    parent folder.
    Frederick Pietschmann
    #3485

  • Fix violation location and misplaced corrections for some function
    references in explicit_self rule.
    JP Simard

  • Fix false positives with result builders in unused_declaration.
    JP Simard

0.43.0-rc.3: Clothes Line Interface

17 Feb 20:49
c9ef906
Compare
Choose a tag to compare
Pre-release

This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:

  • Downloading the attached SwiftLint.pkg installer and launching it
  • Downloading the attached portable_swiftlint.zip archive, extracting it and moving the binary from portable_swiftlint/swiftlint to /usr/local/bin or elsewhere in your PATH
  • Using Mint: mint install realm/[email protected]
  • Cloning and building from source: git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.3 && make install

Changes from 0.43.0-rc.2: 0.43.0-rc.2...0.43.0-rc.3

Breaking

  • The command line syntax has slightly changed due to migrating from the
    Commandant command line parsing library to swift-argument-parser.
    For the most part the breaking changes are all to make the syntax more
    unix compliant and intuitive to use. For example, commands such as
    swiftlint --help or swiftlint -h now work as expected.
    The help output from various commands has greatly improved as well.
    Notably: swiftlint autocorrect was removed in favor of
    swiftlint --fix.
    Previous commands should continue to work temporarily to help with the
    transition. Please let us know if there's a command that no longer
    works and we'll attempt to add a bridge to help with its transition.
    JP Simard

Experimental

  • None.

Enhancements

  • Added allows_single_line option in multiline_parameters rule
    configuration. Defaults to true. This enforces parameters in a method
    with multiple parameters to always be in different lines.
    Otavio Cordeiro

  • Support relative paths in compilation databases for SwiftLint analyzer
    rules.
    JP Simard

  • Add opt-in rule discouraged_assert to encourage the use of
    assertionFailure() and/or preconditionFailure() over
    assert(false).
    Otavio Cordeiro

  • Add opt-in rule private_subject rule which warns against
    public Combine subjects.
    Otavio Cordeiro

  • Allow configuring related USRs to skip in UnusedDeclarationRule by
    specifying a list of USRs in the related_usrs_to_skip key.
    For example you might have custom source tooling that does something
    with types conforming to a procotol even if that type is never
    explicitly referenced by other code.
    JP Simard

Bug Fixes

  • Fix typos in configuration options for file_name rule.
    advantis

  • Fix violation location and misplaced corrections for some function
    references in explicit_self rule.
    JP Simard

0.43.0-rc.2: Clothes Line Interface

29 Jan 20:26
b3b6515
Compare
Choose a tag to compare
Pre-release

This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:

  • Downloading the attached SwiftLint.pkg installer and launching it
  • Downloading the attached portable_swiftlint.zip archive, extracting it and moving the binary from portable_swiftlint/swiftlint to /usr/local/bin or elsewhere in your PATH
  • Using Mint: mint install realm/[email protected]
  • Cloning and building from source: git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.2 && make install

Changes from 0.43.0-rc.1: 0.43.0-rc.1...0.43.0-rc.2

Breaking

  • The command line syntax has slightly changed due to migrating from the
    Commandant command line parsing library to swift-argument-parser.
    For the most part the breaking changes are all to make the syntax more
    unix compliant and intuitive to use. For example, commands such as
    swiftlint --help or swiftlint -h now work as expected.
    The help output from various commands has greatly improved as well.
    Notably: swiftlint autocorrect was removed in favor of
    swiftlint --fix.
    Previous commands should continue to work temporarily to help with the
    transition. Please let us know if there's a command that no longer
    works and we'll attempt to add a bridge to help with its transition.
    JP Simard

Experimental

  • None.

Enhancements

  • Support relative paths in compilation databases for SwiftLint analyzer
    rules.
    JP Simard

  • Add opt-in rule discouraged_assert to encourage the use of
    assertionFailure() and/or preconditionFailure() over
    assert(false).
    Otavio Cordeiro

Bug Fixes

  • Fix typos in configuration options for file_name rule.
    advantis

  • Fix violation location and misplaced corrections for some function
    references in explicit_self rule.
    JP Simard

0.43.0-rc.1: Clothes Line Interface

22 Jan 18:54
0f543b3
Compare
Choose a tag to compare
Pre-release

This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:

  • Downloading the attached SwiftLint.pkg installer and launching it
  • Downloading the attached portable_swiftlint.zip archive, extracting it and moving the binary from portable_swiftlint/swiftlint to /usr/local/bin or elsewhere in your PATH
  • Using Mint: mint install realm/[email protected]
  • Cloning and building from source: git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.1 && make install

Breaking

  • The command line syntax has slightly changed due to migrating from the
    Commandant command line parsing library to swift-argument-parser.
    For the most part the breaking changes are all to make the syntax more
    unix compliant and intuitive to use. For example, commands such as
    swiftlint --help or swiftlint -h now work as expected.
    The help output from various commands has greatly improved as well.
    Notably: swiftlint autocorrect was removed in favor of
    swiftlint --fix.
    Previous commands should continue to work temporarily to help with the
    transition. Please let us know if there's a command that no longer
    works and we'll attempt to add a bridge to help with its transition.
    JP Simard

Experimental

  • None.

Enhancements

  • Support relative paths in compilation databases for SwiftLint analyzer
    rules.
    JP Simard

Bug Fixes

  • Fix typos in configuration options for file_name rule.
    advantis