Skip to content

Releases: realm/SwiftLint

0.25.0: Cleaning the Lint Filter

12 Feb 06:23
Compare
Choose a tag to compare

Breaking

  • None.

Enhancements

Bug Fixes

  • Fix some cases where colon rule wouldn't be autocorrected.
    Manabu Nakazawa

  • Fix false positives in explicit_acl rule when declaring functions and
    properties in protocols or implementing deinit.
    Marcelo Fabri
    #2014

  • Fix false negatives in unneeded_parentheses_in_closure_argument rule
    when using _ as one of the closure arguments.
    Marcelo Fabri
    #2017

  • Fix several rules that use attributes when linting with a Swift 4.1 toolchain.
    Marcelo Fabri
    #2019

  • Don't trigger violations in let_var_whitespace rule when using local
    variables when linting with a Swift 4.1 toolchain.
    Marcelo Fabri
    #2021

  • Improve type_name rule violations to be positioned on the type name.
    Marcelo Fabri
    #2021

  • Use SourceKit to validate associatedtype and typealias in type_name rule
    when linting with Swift 4.1.
    Marcelo Fabri
    #2021

  • Fix some cases where violations would still be triggered when using the
     ignores_function_declarations configuration of line_length rule.
     Manabu Nakazawa

  • Fix false positive in empty_enum_arguments rule when using closures.
    Marcelo Fabri
    #2041

  • Fix false positives in force_unwrapping rule when declaring functions that
    return implicitly unwrapped collections (for example [Int]! or
    [AnyHashable: Any]!).
    Marcelo Fabri
    #2042

  • Fix directories with a .swift suffix being treated as files.
    Jamie Edge
    #1948

0.24.2: Dented Tumbler

10 Jan 18:15
7bf3234
Compare
Choose a tag to compare

Breaking

  • None.

Enhancements

  • None.

Bug Fixes

  • No longer log if the indentation key isn't set in the configuration file.
    JP Simard
    #1998

0.24.1: Dented Tumbler

Breaking
  • None.
Enhancements
  • Invalidate cache when Swift patch version changes.
    Norio Nomura

  • Add private_action opt-in rule which warns against public
    @IBAction methods.
    Ornithologist Coder
    #1931

  • Add yoda_condition opt-in rule which warns when Yoda conditions are used.
    That is, when the constant portion of the expression is on the left side of a
    conditional statement.
    Daniel Metzing
    #1924

  • Indentation can now be specified via a configuration file.
    Noah McCann
    RubenSandwich
    #319

  • Add required_enum_case opt-in rule which allows enums that
    conform to protocols to require one or more cases. Useful for
    result enums.
    Donald Ritter

  • Add discouraged_object_literal opt-in rule which encourages initializers
    over object literals.
    Ornithologist Coder
    #1987

  • Adds prefixed_toplevel_constant opt-in rule which encourages top-level
    constants to be prefixed by k.
    Ornithologist Coder
    #1907

  • Added explicit_acl opt-in rule to enforce explicit access control levels.
    Josep Rodriguez
    #1822

Bug Fixes
  • Fix false positives in control_statement rule when methods with keyword
    names are used.
    Marcelo Fabri
    #1946

  • Fix false positives in for_where rule when pattern matching (if case)
    is used.
    Marcelo Fabri
    #1968

  • Fix false positives in unused_closure_parameter rule when closure is wrapped
    in parentheses.
    JP Simard
    #1979

0.24.0: Timed Dry

Breaking
Enhancements
  • Add sorted_first_last opt-in rule to encourage using min() or max()
    over sorted().first or sorted().last.
    Tom Quist
    #1932

  • Add quick_discouraged_focused_test opt-in rule which warns against
    focused tests in Quick tests.
    Ornithologist Coder
    #1905

  • Add override_in_extension opt-in rule that warns against overriding
    declarations in an extension.
    Marcelo Fabri
    #1884

  • Add [f,x]{describe, context, itBehavesLike} to quick_discouraged_call
    rule.
    Ornithologist Coder
    #1903

  • Add quick_discouraged_pending_test opt-in rule which warns against
    pending tests in Quick tests.
    Ornithologist Coder
    #1909

  • Speed up equality tests for [Rule] and Configuration values.
    JP Simard

  • Make Configuration conform to Hashable.
    JP Simard

  • Speed up reading cached results by about 200%.
    JP Simard

  • Add catch to the statements checked by the control_statement rule.
    JP Simard

  • Make sorted_imports correctable.
    Samuel Susla
    JP Simard
    #1822

  • Make sorted_imports only validate within "groups" of imports on directly
    adjacent lines.
    Samuel Susla
    JP Simard
    #1822

Bug Fixes
  • Extend first_where and contains_over_first_not_nil rules to also detect
    cases where calls to filter and first are parenthesized.
    Tom Quist

  • Correct equality tests for Configuration values. They previously didn't
    account for warningThreshold or cachePath.
    JP Simard

  • Fix false positive in multiline_parameters rule when parameter is a closure
    with default value.
    Ornithologist Coder
    #1912

  • Fix caching on Linux.
    JP Simard

  • Fix crashes due to races.
    JP Simard

  • Fix String.characters deprecation warnings when compiling with Swift
    4.0.2.
    JP Simard

0.24.1: Dented Tumbler

08 Jan 23:22
7ad77df
Compare
Choose a tag to compare
Breaking
  • None.
Enhancements
  • Invalidate cache when Swift patch version changes.
    Norio Nomura

  • Add private_action opt-in rule which warns against public
    @IBAction methods.
    Ornithologist Coder
    #1931

  • Add yoda_condition opt-in rule which warns when Yoda conditions are used.
    That is, when the constant portion of the expression is on the left side of a
    conditional statement.
    Daniel Metzing
    #1924

  • Indentation can now be specified via a configuration file.
    Noah McCann
    RubenSandwich
    #319

  • Add required_enum_case opt-in rule which allows enums that
    conform to protocols to require one or more cases. Useful for
    result enums.
    Donald Ritter

  • Add discouraged_object_literal opt-in rule which encourages initializers
    over object literals.
    Ornithologist Coder
    #1987

  • Adds prefixed_toplevel_constant opt-in rule which encourages top-level
    constants to be prefixed by k.
    Ornithologist Coder
    #1907

  • Added explicit_acl opt-in rule to enforce explicit access control levels.
    Josep Rodriguez
    #1822

Bug Fixes
  • Fix false positives in control_statement rule when methods with keyword
    names are used.
    Marcelo Fabri
    #1946

  • Fix false positives in for_where rule when pattern matching (if case)
    is used.
    Marcelo Fabri
    #1968

  • Fix false positives in unused_closure_parameter rule when closure is wrapped
    in parentheses.
    JP Simard
    #1979

0.24.0: Timed Dry

10 Nov 23:51
06ece1e
Compare
Choose a tag to compare
Breaking
Enhancements
  • Add sorted_first_last opt-in rule to encourage using min() or max()
    over sorted().first or sorted().last.
    Tom Quist
    #1932

  • Add quick_discouraged_focused_test opt-in rule which warns against
    focused tests in Quick tests.
    Ornithologist Coder
    #1905

  • Add override_in_extension opt-in rule that warns against overriding
    declarations in an extension.
    Marcelo Fabri
    #1884

  • Add [f,x]{describe, context, itBehavesLike} to quick_discouraged_call
    rule.
    Ornithologist Coder
    #1903

  • Add quick_discouraged_pending_test opt-in rule which warns against
    pending tests in Quick tests.
    Ornithologist Coder
    #1909

  • Speed up equality tests for [Rule] and Configuration values.
    JP Simard

  • Make Configuration conform to Hashable.
    JP Simard

  • Speed up reading cached results by about 200%.
    JP Simard

  • Add catch to the statements checked by the control_statement rule.
    JP Simard

  • Make sorted_imports correctable.
    Samuel Susla
    JP Simard
    #1822

  • Make sorted_imports only validate within "groups" of imports on directly
    adjacent lines.
    Samuel Susla
    JP Simard
    #1822

Bug Fixes
  • Extend first_where and contains_over_first_not_nil rules to also detect
    cases where calls to filter and first are parenthesized.
    Tom Quist

  • Correct equality tests for Configuration values. They previously didn't
    account for warningThreshold or cachePath.
    JP Simard

  • Fix false positive in multiline_parameters rule when parameter is a closure
    with default value.
    Ornithologist Coder
    #1912

  • Fix caching on Linux.
    JP Simard

  • Fix crashes due to races.
    JP Simard

  • Fix String.characters deprecation warnings when compiling with Swift
    4.0.2.
    JP Simard

0.23.1: Rewash: Forgotten Load Edition

10 Oct 16:56
c34c5c1
Compare
Choose a tag to compare
Breaking
  • None.
Enhancements
  • None.
Bug Fixes
  • Fix false positive in array_init rule when using a map that
    doesn't take a closure.
    Marcelo Fabri
    #1878

  • superfluous_disable_command rule can now be disabled as expected when
    using // swiftlint:disable superfluous_disable_command.
    Marcelo Fabri
    #1890

0.23.0: Permanent Press Cycle

04 Oct 01:21
Compare
Choose a tag to compare
Breaking
  • None.
Enhancements
  • Fix csv reporter to output records with new lines.
    atetlaw

  • Add contains_over_first_not_nil rule to encourage using contains over
    first(where:) != nil.
    Samuel Susla
    #1514

  • Add fallthrough rule that flags usage of fallthrough.
    Marcelo Fabri
    #1834

  • Improve colon rule to catch violations in dictionary types
    (e.g. [String: Int]), when using Any and on function calls.
    Marcelo Fabri
    #1074
    #1389

  • Add switch_case_alignment rule to validate that case and default
    statements are vertically aligned with their enclosing switch statement.
    Austin Lu

  • Add array_init opt-in rule to validate that Array(foo) should be preferred
    over foo.map({ $0 }).
    Marcelo Fabri
    #1271

  • Truncate long configuration console descriptions to fit in the console window
    when running swiftlint rules.
    JP Simard
    #1002

  • Add multiline_arguments opt-in rule that warns to either keep
    all the arguments of a function call on the same line,
    or one per line.
    Marcel Jackwerth

  • Add unneeded_break_in_switch rule to validate that no extra breaks are
    added in switch statements.
    Marcelo Fabri
    #1870

  • Add literal_expression_end_indentation opt-in rule to validate that
    array and dictionary literals ends have the same indentation as the line
    that started them.
    Marcelo Fabri
    #1435

Bug Fixes
  • Improve how opening_brace rule reports violations locations.
    Marcelo Fabri
    #1811

  • Fix false negatives in unneeded_parentheses_in_closure_argument rule
    when using capture lists.
    Marcelo Fabri
    #1817

  • Fix handling of attributes (lazy, objc, etc.) for the let_var_whitespace
    rule.
    David Catmull
    #1770
    #1812

  • Fix false positives in for_where rule when using if var inside for.
    Marcelo Fabri
    #1838

  • Fix false positive in class_delegate_protocol rule when using Swift 4.0.1.
    Marcelo Fabri
    #1856

  • Print multi-line configuration values in a single line when running
    swiftlint rules to avoid breaking the table format.
    JP Simard
    #1002

  • Ignore SwiftLint commands (swiftlint:(disable|enable)) in file_header
    rule, making it work better with superfluous_disable_command rule.
    Marcelo Fabri
    #1810

  • Fix false negatives in generic_type_name, identifier_name and type_name
    rules when using allowed_symbols.
    Marcelo Fabri

0.22.0: Wrinkle-free

30 Aug 17:46
Compare
Choose a tag to compare
Breaking
Enhancements
  • Add is_disjoint rule to encourage using Set.isDisjoint(with:) over
    Set.intersection(_:).isEmpty.
    JP Simard

  • Add xctfail_message rule to enforce XCTFail
    calls to include a description of the assertion.
    Ornithologist Coder
    #1370

  • Add joined_default_parameter correctable opt-in rule to discourage
    explicit usage of the default separator.
    Ornithologist Coder
    #1093
    #1757

  • Files with extensions other than .swift can now be used as arguments
    to --file when linting or autocorrecting.
    Marcelo Fabri
    #1721

  • Allow ()?, Void?, ()!, and Void! as return types in
    redundant_void_return rule.
    Ryan Booker
    #1761

  • Add single_test_class opt-in rule to validate that test files
    only contain a single QuickSpec or XCTestCase subclass.
    Ornithologist Coder
    #1779

  • Produce an error when a // swiftlint:disable command does not silence
    any violations.
    JP Simard
    #1102

  • Add quick_discouraged_call opt-in rule to discourage calls and object
    initialization inside 'describe' and 'context' block in Quick tests.
    Ornithologist Coder
    #1781

  • Invalidate cache when Swift version changes.
    Marcelo Fabri

  • Add pattern_matching_keywords opt-in rule to enforce moving let and var
    keywords outside tuples in a switch.
    Marcelo Fabri
    #202

  • Add explicit_enum_raw_value opt-in rule to allow refactoring the
    Swift API without breaking the API contract.
    Mazyod
    #1778

  • Add no_grouping_extension opt-in rule to disallow the use of extensions
    for code grouping purposes within the same file.
    Mazyod
    #1767

  • Improve syntactic_sugar violation message to be type-specific.
    Marcelo Fabri
    #1803

  • Add multiple_closures_with_trailing_closure rule that disallows trailing
    closure syntax when passing more than one closure argument to a function.
    Erik Strottmann
    #1801

Bug Fixes
  • Fix false positive on force_unwrapping rule when declaring
    local variable with implicity unwrapped type.
    Otávio Lima
    #1710

  • Fix the warning message and autocorrection of vertical_whitespace rule to
    display the maximum empty lines allowed if max_empty_lines is greater
    than 1.
    Hossam Ghareeb
    #1763

  • Fix for the wrong configuration being used when using --path and a
    configuration exists in a parent directory.
    Marcelo Fabri
    #1744

  • Fix false positive on unused_enumerated rule with complex variable
    bindings.
    Marcelo Fabri
    #1787

  • Fix incorrect violations and autocorrections on
    unneeded_parentheses_in_closure_argument rule that were generated in some
    cases (mainly when using chained method calls with closures).
    Marcelo Fabri

0.21.0: Vintage Washboard

01 Aug 22:25
Compare
Choose a tag to compare
Breaking
  • Xcode 8.3 or later and Swift 3.1 or later are required to build.
    Norio Nomura
Enhancements
  • Rules are now categorized as lint, idiomatic, style, metrics
    or performance. Currently this is just used for documentation purposes
    when you run swiftlint rules or swiftlint generate-docs.
    Marcelo Fabri

  • Add rules documentation generation.
    Marcelo Fabri
    #1078

  • Add private_over_fileprivate correctable rule to check for top-level usages
    of fileprivate and recommend private instead. This is in line with
    SE-0169's goal "for fileprivate to be used rarely". There is a also a new
    strict_fileprivate opt-in rule that will mark every fileprivate
    as a violation (especially useful with Swift 4).
    Jose Cheyo Jimenez
    Marcelo Fabri
    #1469
    #1058

  • Add let_var_whitespace opt-in rule to enforce that let/var declarations
    should be separated from other statements by a single blank line.
    Uncommon
    #1461

  • Improve performance when linting and correcting on Linux,
    matching macOS behavior.
    JP Simard
    #1577

  • Don't trigger implicit_getter violations when attributes (such as mutating
    or @inline) are present.
    Marcelo Fabri
    #1309
    #1589

  • Add --use-tabs option to AutoCorrectOptions, enabling formatting using
    tabs over spaces.
    Cody Winton
    #1327

  • Improve autocorrect performance by running it in parallel.
    Marcelo Fabri
    #1578

  • Support building with Xcode 9 beta 3 in Swift 3.2 mode.
    JP Simard

  • Add support for optional error severity level configuration.
    Jamie Edge
    Marcelo Fabri
    #1647

  • Add unneeded_parentheses_in_closure_argument opt-in correctable rule that
    warns against using parentheses around argument declarations in closures.
    Marcelo Fabri
    #1483

  • Add --disabled flag to swiftlint rules to print only rules that are
    not enabled in the configuration.
    Marcelo Fabri

  • Add ignore_comment_only_lines boolean configuration option
    to file_length rule. With the option enabled, file_length will
    ignore lines which have only comments.
    Samuel Susla
    #1165

  • Improve file_header rule description.
    Marcelo Fabri
    #1492

  • Add trailing_closure opt-in rule that validates that trailing
    closure syntax should be used whenever possible.
    Marcelo Fabri
    #54

  • Shebang (#!) in the beginning of a file is now ignored by all rules.
    Marcelo Fabri
    #1294

  • Add block_based_kvo rule that enforces the usage of the new block based
    KVO API added when linting with Swift 3.2 or later.
    Marcelo Fabri
    #1714

  • Make file_header rule ignore doc comments.
    Marcelo Fabri
    #1719

  • Allow using environment variables in a configuration file in the form of
    ${SOME_VARIABLE}. The variables will be expanded when the configuration
    is first loaded.
    Marcelo Fabri
    #1512

  • Treat yes, no, on and off as strings (and not booleans) when loading
    configuration files.
    Marcelo Fabri
    #1424

  • Add discouraged_direct_init rule that discourages direct
    initialization of certain types.
    Ornithologist Coder
    #1306

Bug Fixes
  • Fix false positive on redundant_discardable_let rule when using
    while statements.
    Marcelo Fabri
    #1669

  • Fix all custom rules not being applied when any rule is configured
    incorrectly.
    Jamie Edge
    #1586

  • Fix crash when using --config with a relative path and
    --path with a file.
    Marcelo Fabri
    #1694

  • Fix mark rule corrections generating invalid code in some cases.
    Marcelo Fabri
    #1029

  • Fix false positive in empty_enum_arguments rule when using wildcards and
    where clauses.
    Marcelo Fabri
    #1722

  • Fix false positive in large_tuple rule when using throwing closure.
    Liquidsoul

  • Make vertical_parameter_alignment more robust, fixing false positives and
    detecting previously missed violations.
    JP Simard
    #1488

0.20.1: More Liquid Fabric Softener

01 Jul 18:29
Compare
Choose a tag to compare
Breaking
  • None.
Enhancements
  • None.
Bug Fixes
  • Fix typo in FatalErrorMessageRule.
    Alexander Lash

  • Don't trigger an extension_access_modifier violation when all extension
    members are open, as open extension is not supported by Swift.
    Marcelo Fabri
    #1629

  • Don't trigger a vertical_parameter_alignment_on_call violation when
    trailing closures are used.
    Marcelo Fabri
    #1635

  • Make vertical_parameter_alignment_on_call more flexible when multiline
    parameters are used.
    Marcelo Fabri
    #1630
    #1643

  • Use the directory's .swiftlint.yml when --path is used.
    Marcelo Fabri
    #1631

0.20.0: Liquid Fabric Softener

18 Jun 19:13
Compare
Choose a tag to compare
Breaking
  • None.
Enhancements
  • Add support for missing triggering cases in force_unwrapping
    when using subscript.
    Otávio Lima

  • Match (Void) as return type in the void_return rule.
    Anders Hasselqvist

  • Add multiline_parameters opt-in rule that warns to either keep
    all the parameters of a method or function on the same line,
    or one per line.
    Ornithologist Coder

  • Update function_parameter_count rule to ignore overridden methods.
    Markus Gasser
    #1562

  • Skip files with valid cache & no violations when auto correcting.
    Marcelo Fabri
    #1554

  • Don't trigger violations from the private_unit_test rule when a method has
    parameters.
    Marcelo Fabri
    #1532

  • Don't trigger violations from the discarded_notification_center_observer
    rule when the observer is being returned from a function that is not marked
    as @discardableResult.
    Marcelo Fabri
    #1525

  • Add extension_access_modifier opt-in rule validating that if all the
    declarations in a given extension have the same Access Control Level, the ACL
    keyword should be applied to the top-level extension.
    Marcelo Fabri
    #1546

  • Add vertical_parameter_alignment_on_call opt-in rule that validates that
    parameters are vertically aligned on a method call.
    Marcelo Fabri
    #1037

  • Add code_literal and image_literal boolean configuration options to
    object_literal rule. They allow to only check for one or the other
    literal type instead of both together.
    Cihat Gündüz
    #1587

Bug Fixes
  • Fix false positive in empty_enum_arguments rule when calling methods.
    Marcelo Fabri
    #1597

  • Fix crash in unused_closure_parameter rule when using unicode identifiers.
    Woo-Sik Byun
    Marcelo Fabri

  • Fix two false positives in force_unwrapping rule.
    Otávio Lima
    #614
    #977
    #1614

  • Fix custom rules not working correctly with comment commands.
    JP Simard
    #1558

  • Fix incorrectly using configuration files named .swiftlint.yml when they are
    located in the same directory as a differently-named, user-provided custom
    configuration file.
    JP Simard
    #1531

  • Fix empty_count rule false positive in words that include "count".
    Marcelo Fabri
    #1622

  • Use validates_start_with_lowercase key when decoding configurations for
    generic_type_name, identifier_name and type_name rules. This key was
    used on the docs, but internally validates_start_lowercase was used.
    Marcelo Fabri
    #1626