SwiftLint v0.17.0 Release Notes

  • ๐Ÿ’ฅ Breaking
    • variable_name rule (VariableNameRule) is now identifier_name (IdentifierNameRule) as it validates other identifiers as well.
      Marcelo Fabri #663

    • ๐Ÿ›  Fix sorted_imports rule to sort ignoring case.
      Keith Smiley #1185

    • ๐Ÿ‘• Temporarily disable cache when linting. This will be re-enabled in a future version after important cache-related issues have been addressed.
      Marcelo Fabri

    โœจ Enhancements
    • Add implicitly_unwrapped_optional opt-in rule that warns against using implicitly unwrapped optionals, except cases when this IUO is an IBOutlet.
      Siarhei Fedartsou #56

    • Performance improvements to generic_type_name, redundant_nil_coalescing, mark, first_where and vertical_whitespace rules.
      Marcelo Fabri

    • Add discarded_notification_center_observer rule that warns when the result of NotificationCenter.addObserver(forName:object:queue:using:) is not stored so it can be removed later.
      Marcelo Fabri #1062

    • Add notification_center_detachment rule that warns against an object removing itself from NotificationCenter in an unsafe location.
      Marcelo Fabri #1061

    • Accept AnyObject and NSObjectProtocol in class_delegate_protocol.
      Jon Shier #1261

    • Add ignores_function_declarations and ignores_comments as options to LineLengthRule.
      Michael L. Welles #598 #975

    • โž• Add for_where rule that validates that where is used in a for loop instead of a single if expression inside the loop.
      Marcelo Fabri #1228

    • unused_enumerated rule now warns when only the index is being used. You should use .indices instead of .enumerated() in this case.
      Marcelo Fabri #1278

    • Add ignores_case_statements as option to CyclomaticComplexityRule.
      Michael L. Welles #1298

    • Add correctable redundant_discardable_let rule that warns when let _ = foo() is used to discard a result from a function instead of _ = foo().
      Marcelo Fabri #1232

    • Accept global and local variables in implicit_getter rule.
      Marcelo Fabri

    • โž• Add --enabled (or -e) switch to the rules CLI command, to only display enabled rules.
      Natan Rolnik #1270

    • ๐Ÿ”ง Now nesting rule can be configured with a type and statement level.
      Hayashi Tatsuya #1318

    • Add explicit_type_interface opt-in rule that validates that the properties have an explicit type interface.
      Kim de Vos

    • โž• Add --lenient CLI option to lint command. Facilitates running a lint task that doesn't fail a pipeline of other tasks.
      aaroncrespo #1322

    • Add fatal_error_message opt-in rule that validates that fatalError() calls have a message.
      Kim de Vos #1348

    ๐Ÿ› Bug Fixes
    • ๐Ÿ›  Fix crashes when accessing cached regular expressions when linting in parallel.
      JP Simard #1344

    • ๐Ÿ›  Fix a false positive on large_tuple rule when using closures.
      Marcelo Fabri #1234

    • ๐Ÿ›  Fix force_unwrap false positive for bool negation.
      Aaron McTavish #918

    • ๐Ÿ›  Fix false positive and wrong correction on number_separator rule.
      Marcelo Fabri #1242

    • Retain closure parameter types when they are specified during autocorrect.
      Allen Zeng #1175

    • Fix redundant_void_return matches if return type starts with Void~.
      Hayashi Tatsuya

    • Ignore unused_closure_parameter rule on closures that are called inline.
      Marcelo Fabri #1161

    • ๐Ÿ“„ Disable valid_docs and missing_docs rules when running in Swift 2.3 or later as they have not been updated to work with those versions of Swift. Both rules are now opt-in because of this.
      JP Simard #728

    • ๐Ÿ›  Fix false positive on large_tuple rule when using generics inside a tuple.
      Marcelo Fabri #1257

    • 0๏ธโƒฃ Make ASTRule default implementation to navigate through the substructure even if its children are from a different kind. This fixes some violations not being reported in some contexts.
      Marcelo Fabri #1237

    • Reimplement switch_case_on_newline rule to be an ASTRule and be more reliable, fixing some false negatives and false positives.
      Marcelo Fabri #1268

    • Fix closure_end_indentation rule false positive when using single-line closures.
      Marcelo Fabri #1216

    • ๐Ÿ›  Fix todo rule messages when the comment is not on a new line.
      Marcelo Fabri #1304

    • Fix false negative on unused_closure_parameter rule.
      Hayashi Tatsuya

    • ๐Ÿ›  Fix checkstyle report format.
      Yuki Oya