SwiftLint v0.21.0 Release Notes

  • ๐Ÿ’ฅ 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](Rules.md) 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