Skip to content

@jpsim jpsim released this Apr 4, 2020 · 14 commits to master since this release

This is the last release to support building with Swift 5.0.x.

Breaking

  • None.

Experimental

  • None.

Enhancements

  • Add configuration options to the unused_import rule to require
    explicit import statements for each module referenced in a source
    file (require_explicit_imports). When this setting is enabled,
    an allowed_transitive_imports setting may also be specified to allow
    a mapping of modules to transitively imported modules. See PR for
    details: #3123
    JP Simard
    #3116

Bug Fixes

  • Fix more false positives in implicit_getter rule in extensions when using
    Swift 5.2.
    Marcelo Fabri
    #3149

  • Fix false positives in redundant_objc_attribute rule in extensions when
    using Swift 5.2.
    Marcelo Fabri

  • Fix false positives in attributes rule when using rethrows using
    Swift 5.2.
    JP Simard

  • Fix false positives in valid_ibinspectable rule when defining inspectable
    properties in class extensions with computed properties using Swift 5.2.
    JP Simard

Assets 5

@jpsim jpsim released this Feb 11, 2020 · 25 commits to master since this release

Breaking

  • The new rules introduced in 0.39.0 that depend on SwiftSyntax have been
    temporarily removed as we work out release packaging issues.
    • prohibited_nan_comparison
    • return_value_from_void_function
    • tuple_pattern
    • void_function_in_ternary
      JP Simard
      #3105

Experimental

  • None.

Enhancements

  • None.

Bug Fixes

  • Fix unused_import rule reported locations and corrections when
    multiple @testable imports are involved.
    JP Simard
Assets 5

@marcelofabri marcelofabri released this Feb 11, 2020 · 28 commits to master since this release

Breaking

  • Replace all uses of Int/Int64/NSRange representing byte offsets
    to use newly introduced ByteCount and ByteRange values instead.
    This will minimize the risk of accidentally using a byte-based offset
    in character-based contexts.
    Paul Taykalo
    JP Simard

  • SwiftLint now imports SwiftSyntax
    and requires Xcode 11.0 to build.
    Marcelo Fabri

Experimental

  • None.

Enhancements

  • Add option to pass successfully if no files passed to SwiftLint are lintable.
    thedavidharris
    #2608i

  • Add deinitializer type content to type_contents_order rule instead of
    grouping it with initializers.
    Steven Magdy

  • Inline test failure messages to make development of SwiftLint easier. Test
    failures in triggering and non-triggering examples will appear inline in
    their respective files so you can immediately see which cases are working
    and which are not.
    ZevEisenberg
    #3040

  • Introduce a new SyntaxRule that enables writing rules using
    SwiftSyntax.
    Marcelo Fabri

  • Add tuple_pattern opt-in rule to warn against using
    assigning variables through a tuple pattern when the left side
    of the assignment contains labels.
    Marcelo Fabri
    #2203

  • Add return_value_from_void_function opt-in rule to warn against using
    return <expression> in a function that is Void.
    Marcelo Fabri

  • Add void_function_in_ternary opt-in rule to warn against using
    a ternary operator to call Void functions.
    Marcelo Fabri
    #2358

  • Add only_after_dot configuration option to empty_count rule. With the
    option enabled, empty_count rule will ignore variables named count.
    By default, this option is disabled.
    Zsolt Kovács
    #827

  • Add prohibited_nan_comparison opt-in rule to validate using isNaN
    instead of comparing values to the .nan constant.
    Marcelo Fabri
    #2086

Bug Fixes

  • Fix discarded_notification_center_observer false positives when
    capturing observers into an array.
    Petteri Huusko

  • Fix crash when non-closed #if was present in file.
    PaulTaykalo

  • Fix false positives when line ends with carriage return + line feed.
    John Mueller
    #3060

  • Implicit_return description now reports current config correctly.
    John Buckley

  • Fix false positive in implicit_getter rule in extensions when using
    Swift 5.2.
    Marcelo Fabri
    #3074

  • Do not trigger optional_enum_case_matching rule on _? as the ? might
    be required in some situations.
    Marcelo Fabri
    #3057

  • Fix false positive in attributes rule with @escaping parameters when
    using Swift 5.2.
    Marcelo Fabri
    #3079

  • Fix false positive in empty_string rule when using multiline string
    literals.
    Marcelo Fabri
    #3100

Assets 5

@jpsim jpsim released this Jan 8, 2020 · 69 commits to master since this release

Breaking

  • None.

Experimental

  • None.

Enhancements

  • Add option to configure which kinds of expressions should omit their
    return keyword by introducing an included configuration for the
    implicit_return rule. Supported values are closure, function and
    getter. Defaults to all three.
    Sven Münnich
    #2870

  • Add --correctable and --verbose arguments to the rules command
    to allow displaying only correctable rules, and to always print the
    full configuration details regardless of your terminal width.
    Optional Endeavors

  • Add capture_group option to custom_rules for more fine-grained placement
    of the location marker for violating code.
    pyrtsa

  • Add orphaned_doc_comment rule to catch doc comments that are not attached
    to any declarations.
    Marcelo Fabri
    #2989

  • Add new indentation opt-in rule (indentation_width) checking for
    super-basic additive indentation pattern.
    Frederick Pietschmann
    #227

  • Catch previously missed violations in the optional_enum_case_matching rule
    when case expressions involved tuples.
    JP Simard

  • API docs for SwiftLintFramework are now available at
    realm.github.io/SwiftLint. Rules.md
    now redirects to the rules directory in the API docs
    here. Contributors no
    longer need to update rule documentation in PRs as this is now done
    automatically. The rule documentation now includes the default configuration.
    JP Simard
    #1653
    #1704
    #2808
    #2933
    #2961

Bug Fixes

  • Fix issues in unused_import rule when correcting violations in files
    containing @testable imports where more than the unused imports would be
    removed.
    JP Simard
Assets 5

@jpsim jpsim released this Jan 4, 2020 · 101 commits to master since this release

Breaking

  • None.

Experimental

  • None.

Enhancements

  • Make weak_delegate rule correctable.
    MaxHaertwig

  • Allow SubstitutionCorrectableRule to return nil instead of a correction
    to indicate that a suitable correction couldn't be found for a specific case.
    MaxHaertwig

  • Add enum_case_associated_value_count opt-in rule.
    lakpa
    #2997

  • Add optional_enum_case_matching opt-in rule to validate that
    optional enum cases are matched without using ? when using Swift 5.1 or
    above. See SR-7799 for more
    details.
    Marcelo Fabri

  • Add prefer_self_type_over_type_of_self opt-in rule to enforce using
    Self instead of type(of: self) when using Swift 5.1 or above.
    Marcelo Fabri
    #3003

Bug Fixes

  • Fix crash in unused_import rule when unused imports have trailing
    comments.
    JP Simard
    #2990

  • Handle @_exported imports in unused_import rule.
    JP Simard
    #2877

  • Fix false positives from the unused_declaration rule involving
    functions in protocol extensions.
    JP Simard

  • Fix parsing of SwiftLint commands containing a URL in their trailing comment.
    Sven Münnich

  • Added missing parameters to FileNameConfiguration.consoleDescription.
    timcmiller
    #3009

  • Fix crash when SourceKit returns out of bounds string byte offsets.
    JP Simard

Assets 5

@jpsim jpsim released this Dec 3, 2019 · 118 commits to master since this release

Breaking

  • Replace the SyntaxToken and SyntaxMap structures used in
    public SwiftLintFramework APIs with a new SwiftLintSyntaxToken
    and SwiftlintSyntaxMap wrappers over structures returned from
    SourceKitten.
    PaulTaykalo
    #2955

Experimental

  • None.

Enhancements

  • Make control_statement rule correctable.
    MaxHaertwig

  • Add expiring_todo opt-in rule to allow developers to mark their
    todos with an expiration date.
    Dan Loman
    #727

  • Support compilation databases for swiftlint analayze.
    kastiglione
    #2962

Bug Fixes

Assets 5

@jpsim jpsim released this Nov 9, 2019 · 141 commits to master since this release

Breaking

  • Replace the [String: SourceKittenRepresentable] dictionaries used in
    public SwiftLintFramework APIs with a new SourceKittenDictionary
    wrapper over dictionaries returned from SourceKitten.
    PaulTaykalo
    #2922

  • Update Commandant dependency to version 0.17.0, removing the
    antitypical/Result dependency in favor of the Swift standard
    library's Result type.
    JP Simard

Experimental

  • None.

Enhancements

  • Speed up many operations by using SwiftLintFile wrapper over File from
    SourceKitten, caching most members derived from the File.
    PaulTaykalo
    #2929

  • Speed up Swiftlint by using swift enums instead of raw values for
    dictionary lookups.
    PaulTaykalo
    #2924

  • Speed up Identical Operands rule by using syntaxmap instead of regular
    expressions.
    PaulTaykalo
    #2918

  • Speed up syntax token lookups, which can improve performance when
    linting large files.
    PaulTaykalo
    #2916

  • Use faster comparison in 'file_types_order' rule.
    PaulTaykalo
    #2949

  • Speed up recursively executed rules (all AST rules and some others) by
    avoiding the creation of many intermediate collections when
    accumulating results.
    PaulTaykalo
    #2951

  • Add GitHub Actions Logging reporter (github-actions-logging).
    Norio Nomura

Bug Fixes

  • None.
Assets 5

@jpsim jpsim released this Oct 24, 2019 · 188 commits to master since this release

Breaking

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

Experimental

  • None.

Enhancements

  • Add contains_over_range_nil_comparison opt-in rule to prefer
    using contains over comparison of range(of:) to nil.
    Colton Schlosser
    #2776

  • Make contains_over_first_not_nil rule also match first(where:) == nil.
    Colton Schlosser

  • Add two new cases to the Mark rule to detect a Mark using three slashes.
    nvanfleet
    #2866

  • Add flatmap_over_map_reduce opt-in rule to prefer
    using flatMap over map { ... }.reduce([], +).
    Marcelo Fabri
    #2883

  • Add autocorrection to syntactic_sugar.
    Ivan Vavilov

  • Make toggle_bool rule substitution correctable.
    MaxHaertwig

  • Optimize the performance of redundant_void_return rule.
    Marcelo Fabri

  • Support building with Swift 5.1 on Linux.
    Marcelo Fabri
    #2874

  • Add raw_value_for_camel_cased_codable_enum opt-in rule to enforce raw values
    for camel cased Codable String enum cases.
    Marko Pejovic
    #2888

  • Speedup LetVarWhiteSpacesRule.
    PaulTaykalo
    #2901

Bug Fixes

  • Fix running analyzer rules on the output of builds performed with
    Xcode 11 or later.
    JP Simard
Assets 5

@jpsim jpsim released this Sep 3, 2019 · 235 commits to master since this release

This is the last release to support building with Swift 4.2.x.

Breaking

  • None.

Experimental

  • None.

Enhancements

  • Type name rules considers SwiftUI template code.
    atfelix
    #2791

  • Add no_space_in_method_call rule to validate that there're no spaces
    between the method name and parentheses in a method call.
    Marcelo Fabri

  • Add contains_over_filter_count opt-in rule to warn against using
    expressions like filter(where:).count > 0 instead of contains(where:).
    Marcelo Fabri
    #2803

  • Add contains_over_filter_is_empty opt-in rule to warn against using
    expressions like filter(where:).isEmpty instead of contains(where:).
    Marcelo Fabri

  • Add empty_collection_literal opt-in rule to prefer using isEmpty to
    comparison to [] or [:].
    Colton Schlosser
    #2807

Bug Fixes

Assets 5

@jpsim jpsim released this Jul 19, 2019 · 269 commits to master since this release

Breaking

  • To enable collecting rules, many breaking changes to SwiftLintFramework's
    public API were made the Linter type was significantely changed, and a new
    CollectedLinter type was introduced. Many public SwiftLintFramework APIs
    that interacted with Linter have also been affected. More new types and
    protocols were added such as RuleStorage, AnyCollectingRule,
    CollectingRule, CollectingCorrectableRule.
    We are not aware of any significant users of the SwiftLintFramework library,
    so if you are affected by this, please reach out to SwiftLint contributors by
    filing a GitHub issue about your use case.
    Elliott Williams
    JP Simard

Experimental

  • Add a two-stage CollectingRule protocol to support rules that collect data
    from all files before validating. Collecting rules implement a collect
    method which is called once for every file, before any file is checked for
    violations. By collecting, rules can be written which validate across
    multiple files for things like unused declarations.
    Elliott Williams
    #2431

  • Add a new unused_declaration analyzer rule to lint for unused declarations.
    By default, detects unused fileprivate, private and internal
    declarations. Configure the rule with include_public_and_open: true to
    also detect unused public and open declarations.
    JP Simard

  • Completely remove the unused_private_declaration rule. Please use
    unused_declaration instead.
    JP Simard

Enhancements

  • None.

Bug Fixes

  • None.
Assets 5
You can’t perform that action at this time.