Changelog History
Page 7
-
v0.20.1 Changes
π₯ Breaking
- None.
β¨ Enhancements
- None.
π Bug Fixes
π Fix typo in
FatalErrorMessageRule
.
Alexander LashDon't trigger an
extension_access_modifier
violation when all extension members areopen
, asopen extension
is not supported by Swift.
Marcelo Fabri #1629Don't trigger a
vertical_parameter_alignment_on_call
violation when trailing closures are used.
Marcelo Fabri #1635Make
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
-
v0.20.0 Changes
π₯ Breaking
- None.
β¨ Enhancements
Detect more violations of
force_unwrapping
when using subscripts.
OtΓ‘vio LimaMatch
(Void)
as return type in thevoid_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 CoderUpdate
function_parameter_count
rule to ignore overridden methods.
Markus Gasser #1562Skip files with valid cache & no violations when auto correcting.
Marcelo Fabri #1554Don't trigger violations from the
private_unit_test
rule when a method has parameters.
Marcelo Fabri #1532Don'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 #1525Add
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 #1546Add
vertical_parameter_alignment_on_call
opt-in rule that validates that parameters are vertically aligned on a method call.
Marcelo Fabri #1037Add
code_literal
andimage_literal
boolean configuration options toobject_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 #1597Fix 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 #1622Use
validates_start_with_lowercase
key when decoding configurations forgeneric_type_name
,identifier_name
andtype_name
rules. This key was used on the docs, but internallyvalidates_start_lowercase
was used.
Marcelo Fabri #1626
-
v0.19.0 Changes
π₯ Breaking
β Remove support for Swift 2.
Marcelo Fabri #1453π Remove
missing_docs
andvalid_docs
rules since they were already disabled.
Marcelo Fabri #1453β Add
modificationDate(forFileAtPath:)
function requirement toLintableFileManager
protocol.
Victor Pimentelπ Several breaking changes to
LinterCache
.
Victor Pimentel JP Simardβ Remove
Configuration.hash
property.
Victor Pimentelπ Rename
ConditionalReturnsOnNewline
struct toConditionalReturnsOnNewlineRule
to match rule naming conventions.
JP Simard
β¨ Enhancements
π Cache linter results for files unmodified since the previous linter run.
Victor Pimentel JP Simard Marcelo Fabri #1184 #1550Add opt-in configurations to
generic_type_name
,identifier_name
andtype_name
rules to allow excluding non-alphanumeric characters and names that start with uppercase.
Javier HernΓ‘ndez #541β Adds support for
excluded
in custom rules to exclude files.
Nigel Flack #1437π Make
trailing_comma
rule autocorrectable.
Samuel Susla Jeremy David Giesbrecht #1326Added
no_extension_access_modifier
opt-in rule to disallow access modifiers completely, Γ la SE-0119.
Jose Cheyo Jimenez #1457β Add lowercase and missing colon checks to the
mark
rule.
Jason MooreImprove violation reason wording in
function_body_length
,large_type
, andtype_body_length
rules. Β ultimatedbzAdd
explicit_top_level_acl
opt-in rule that validates that all top level declarations should explicitly be marked with an Access Control Level (private
,fileprivate
,internal
,public
oropen
).
J. Cheyo Jimenez Marcelo Fabri #58β Add
implicit_return
opt-in rule that warns against using thereturn
keyword when it can be omitted inside closures.
Marcelo Fabri #1194Add option to
unused_optional_binding
rule to ignoretry?
inguard
statements.
Sega-Zero #1432Add
empty_enum_arguments
correctable rule that warns against using silent associated values inside acase
.
Marcelo Fabri #1425 #1549β Remove
file.zip
from thePods
directory when installing SwiftLint via CocoaPods.
Hesham Salman #1507Add
protocol_property_accessors_order
correctable rule that validates that the order of accessors isget set
when declaring variables in protocols.
Marcelo Fabri #1504π Make
Region
&Command
structs conform toEquatable
.
JP Simardπ Make
closure_spacing
aCorrectableRule
.
J. Cheyo Jimenez
π Bug Fixes
π
emoji
andcheckstyle
reporter output report sorted by file name.
norio-nomura #1429Prevent false positive in
shorthand_operator
rule.
sammy-SC #1254π Fix typo in
DiscardedNotificationCenterObserverRule
.
Spencer Kaiserπ Fix
empty_parameters
rule with Swift 3.
Marcelo Fabri #1460Prevent triggering
redundant_optional_initialization
rule on alazy var
since it needs initialization.
Marcelo Fabri #1334Fix
ignores_case_statements
key incyclomatic_complexity
description.
Jeff Blagdon #1434Fall back to reporting violations on line
1
if no line was provided for the violation's location, ensuring Xcode always displays the warning or error.
rjhodge JP Simard #1520π Fix crash or incorrect violation location with strings including multi-byte unicode characters.
Marcelo Fabri #1006π Fix false positive in
syntactic_sugar
rule when using nested types namedOptional
,ImplicitlyUnwrappedOptional
,Array
orDictionary
.
Marcelo Fabri #1508Fix false positives in
prohibited_super_call
&overridden_super_call
rules where calls tosuper
were done in nested scopes such asdefer
blocks.
JP Simard #1301π Fix non-root configurations logging configuration warnings more than once.
JP Simard #949π Fix some overlapping
// swiftlint
commands not being applied.
JP Simard #1388
-
v0.18.1 Changes
π₯ Breaking
- None.
β¨ Enhancements
- None.
π Bug Fixes
- π Compile releases in the 'Release' configuration rather than 'Debug'.
-
v0.18.0 Changes
π₯ Breaking
π Replace YamlSwift with Yams. SwiftLint no longer includes YamlSwift. If your project implicitly depends on YamlSwift, you need to modify it to depend on YamlSwift explicitly.
norio-nomura #1412Yams interprets YAML more strictly than YamlSwift, so if your YAML configurations previously worked with SwiftLint but didn't fully conform to the YAML 1.2 standard, you'll need to fix those validation errors. For example:
custom_rules: wrong_regex: name: "wrong regex" regex: "((assert|precondition)\(false)" # '\' in "" means escape sequence strict_regex: name: "strict regex" regex: '((assert|precondition)\(false)' # Use single quotes
β¨ Enhancements
π Support compiling with Xcode 8.3 and Swift 3.1.
Keith Smileyπ Fix false positives on
for_where
rule and skip violation on complex conditions.
Marcelo Fabri #1387π§ Print YAML configuration errors in locatable format compatible with Xcode's Issue Navigator.
π Bug Fixes
π Fix --lenient enforcement not being applied to all violations.
aaroncrespo #1391Fix false positives in
unused_optional_binding
rule.
Daniel RodrΓguez TroitiΓ±o #1376Fix false positives in
redundant_discardable_let
rule.
Jeremy David Giesbrecht #1415
-
v0.17.0 Changes
π₯ Breaking
variable_name
rule (VariableNameRule
) is nowidentifier_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 #56Performance improvements to
generic_type_name
,redundant_nil_coalescing
,mark
,first_where
andvertical_whitespace
rules.
Marcelo FabriAdd
discarded_notification_center_observer
rule that warns when the result ofNotificationCenter.addObserver(forName:object:queue:using:)
is not stored so it can be removed later.
Marcelo Fabri #1062Add
notification_center_detachment
rule that warns against an object removing itself fromNotificationCenter
in an unsafe location.
Marcelo Fabri #1061Accept
AnyObject
andNSObjectProtocol
inclass_delegate_protocol
.
Jon Shier #1261Add
ignores_function_declarations
andignores_comments
as options toLineLengthRule
.
Michael L. Welles #598 #975β Add
for_where
rule that validates thatwhere
is used in afor
loop instead of a singleif
expression inside the loop.
Marcelo Fabri #1228unused_enumerated
rule now warns when only the index is being used. You should use.indices
instead of.enumerated()
in this case.
Marcelo Fabri #1278Add
ignores_case_statements
as option toCyclomaticComplexityRule
.
Michael L. Welles #1298Add correctable
redundant_discardable_let
rule that warns whenlet _ = foo()
is used to discard a result from a function instead of_ = foo()
.
Marcelo Fabri #1232Accept global and local variables in
implicit_getter
rule.
Marcelo Fabriβ Add
--enabled
(or-e
) switch to therules
CLI command, to only display enabled rules.
Natan Rolnik #1270π§ Now
nesting
rule can be configured with a type and statement level.
Hayashi Tatsuya #1318Add
explicit_type_interface
opt-in rule that validates that the properties have an explicit type interface.
Kim de Vosβ Add
--lenient
CLI option tolint
command. Facilitates running a lint task that doesn't fail a pipeline of other tasks.
aaroncrespo #1322Add
fatal_error_message
opt-in rule that validates thatfatalError()
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 #1242Retain closure parameter types when they are specified during autocorrect.
Allen Zeng #1175Fix
redundant_void_return
matches if return type starts with Void~.
Hayashi TatsuyaIgnore
unused_closure_parameter
rule on closures that are called inline.
Marcelo Fabri #1161π Disable
valid_docs
andmissing_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 #12570οΈβ£ 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 #1237Reimplement
switch_case_on_newline
rule to be anASTRule
and be more reliable, fixing some false negatives and false positives.
Marcelo Fabri #1268Fix
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 #1304Fix false negative on
unused_closure_parameter
rule.
Hayashi Tatsuyaπ Fix
checkstyle
report format.
Yuki Oya
-
v0.16.1 Changes
π₯ Breaking
- None.
β¨ Enhancements
Improve
unused_optional_binding
rule on tuples check.
Rafael Machadoβ‘οΈ Update
variable_name
to ignore overrides.
Aaron McTavish #1169β‘οΈ Update
number_separator
rule to allow for specifying minimum length of fraction.
Bjarke SΓΈndergaard #1200β‘οΈ Update
legacy_constant
rule to supportCGFloat.pi
andFloat.pi
.
Aaron McTavish #1198
π Bug Fixes
π Fix false positives on
shorthand_operator
rule.
Marcelo Fabri #1156 #1163Fix false positive on
redundant_optional_initialization
rule.
Marcelo Fabri #1159Fix false positive on
operator_usage_whitespace
rule with decimal literals in exponent format.
Marcelo Fabri #1153π Fix
excluded
configuration not excluding files.
Marcelo Fabri #1166Disable commutative operations on
shorthand_operator
rule.
Marcelo Fabri #1182 #1183 #1211π Fix crash when running in a Sandboxed environment, which also fixes Homebrew distribution. Set the
SWIFTLINT_SWIFT_VERSION
environment variable to either2
or3
to force that operation mode, bypassing the Swift version determined from SourceKit.
JP Simard
-
v0.16.0 Changes
π₯ Breaking
- Several API breaking changes were made to conform to the Swift 3 API Design Guidelines. We apologize for any inconvenience this may have caused.
β¨ Enhancements
π Speed up linting by caching linter results across invocations.
Marcelo Fabri #868π Speed up linting by processing multiple files and rules concurrently.
JP Simard #1077π Make many operations in SwiftLintFramework safe to call in multithreaded scenarios, including accessing
Linter.styleViolations
.
JP Simard #1077Permit unsigned and explicitly-sized integer types in
valid_ibinspectable
Daniel Duanπ Make
nimble_operator
rule correctable.
Vojta StavikAdd
vertical_parameter_alignment
rule that checks if parameters are vertically aligned for multi-line function declarations.
Marcelo Fabri #1033β Add more helpful reason strings to TrailingCommaRule.
Matt RubinAdd
class_delegate_protocol
rule that warns against protocol declarations that aren't marked as: class
or@objc
.
Marcelo Fabri #1039Add correctable
redundant_optional_initialization
rule that warns against initializing optional variables withnil
.
Marcelo Fabri #1052redundant_nil_coalescing
rule is now correctable.
Marcelo Fabriπ Make
number_separator
rule correctable.
Marcelo Fabriempty_parentheses_with_trailing_closure
rule is now correctable.
Marcelo FabriAdd correctable
redundant_void_return
rule that warns against explicitly adding-> Void
to functions.
Marcelo Fabri #1066β Add an opt-in rule that enforces alphabetical sorting of imports.
Scott Berrevoets #900type_name
rule forces enum values to be UpperCamelCase again when used with Swift 2.3.
Marcelo Fabri #1090π Make
weak_delegate
rule ignore computed properties.
Rafael Machado #1089β Add
object_literal
opt-in rule that warns against using image and color inits that can be replaced for#imageLiteral
or#colorLiteral
in Swift 3.
Marcelo Fabri #1060π§ Now
number_separator
rule can be configured with a minimum length.
Marcelo Fabri #1109Add
compiler_protocol_init
rule that flags usage of initializers declared in protocols used by the compiler such asExpressibleByArrayLiteral
that shouldn't be called directly. Instead, you should use a literal anywhere a concrete type conforming to the protocol is expected by the context.
Marcelo Fabri #1096β Add
large_tuple
configurable rule that validates that tuples shouldn't have too many members.
Marcelo Fabri #1065Add
generic_type_name
rule that validates generic constraint type names.
Marcelo Fabri #51β‘οΈ Update
vertical_whitespace
rule to allow configuration of the number of consecutive empty lines before a violation usingmax_empty_lines
. The default value is still 1 line.
Aaron McTavish #769Add check to ignore urls in
line_length
rule whenignores_urls
configuration is enabled.
Javier HernΓ‘ndez #384β Add
shorthand_operator
rule that validates that shorthand operators should be used when possible.
Marcelo Fabri #902π Allow specifying a
swiftlint_version
configuration key which will log a warning if the current running version of SwiftLint is different than this value.
JP Simard #221β Add internal support for deprecated rule aliases.
Marcelo Fabri #973Add
unused_optional_binding
rule that will check for optional bindings not being used.
Rafael Machado #1116
π Bug Fixes
Ignore close parentheses on
vertical_parameter_alignment
rule.
Marcelo Fabri #1042π
syntactic_sugar
rule now doesn't flag declarations that can't be fixed.
Marcelo Fabri #928Fix false positives on
closure_parameter_position
andunused_closure_parameter
rules with Swift 2.3.
Marcelo Fabri #1019π Fix crash on
trailing_comma
rule with Swift 2.3.
Marcelo Fabri #921π Fix out of range exception in
AttributesRule
.
JP Simard #1105Fix
variable_name
andtype_name
rules on Linux.
Marcelo Fabriπ Fix linting directories with names ending with
.swift
.
JP Simardπ Fix running
swiftlint version
when building with Swift Package Manager.
Marcelo Fabri #1045Fix false positive on
vertical_parameter_alignment
rule when breaking line in a default parameter declaration.
Marcelo Fabri #1129
-
v0.15.0 Changes
π₯ Breaking
- β
line_length
rule now has a default value of120
for warnings.
Marcelo Fabri #1008
β¨ Enhancements
- Add
closure_end_indentation
opt-in rule that validates closure closing braces according to these rules:- If the method call has chained breaking lines on each method
(
.
is on a new line), the closing brace should be vertically aligned with the.
. - Otherwise, the closing brace should be vertically aligned with
the beginning of the statement in the first line.
- If the method call has chained breaking lines on each method
(
operator_usage_whitespace
rule is now correctable.
Marcelo Fabriπ
implicit_getter
andmark
rule performance improvements.
Marcelo FabriHTML reports now display a relative path to files.
Jamie Edgecolon
rule now validates colon position in dictionaries too. You can disable this new validation with theapply_to_dictionaries
configuration.
Marcelo Fabri #603β Add
first_where
opt-in rule that warns against using.filter { /* ... */ }.first
in collections, as.first(where: { /* ... */ })
is often more efficient.
Marcelo Fabri #1005
π Bug Fixes
FunctionParameterCountRule
also ignores generic initializers.
Mauricio HanikaGrammar checks.
Michael Helmbrechtπ Fix the validity and styling of the HTML reporter.
Jamie EdgeFix false positive in
empty_parentheses_with_trailing_closure
rule.
Marcelo Fabri #1021Fix false positive in
switch_case_on_newline
when switching over a selector.
Marcelo Fabri #1020Fix crash in
closure_parameter_position
rule.
Marcelo Fabri #1026Fix false positive in
operator_usage_whitespace
rule when using image literals.
Marcelo Fabri #1028
- β
-
v0.14.0 Changes
π₯ Breaking
- π SwiftLint now requires Xcode 8.x and Swift 3.x to build.
APIs have not yet been adapted to conform to the Swift 3 API Design
Guidelines but will shortly.
JP Simard Norio Nomura
β¨ Enhancements
π§ Now builds and passes most tests on Linux using the Swift Package Manager with Swift 3. This requires
libsourcekitdInProc.so
to be built and located in/usr/lib
, or in another location specified by theLINUX_SOURCEKIT_LIB_PATH
environment variable. A preconfigured Docker image is available on Docker Hub by the ID ofnorionomura/sourcekit:302
.
JP Simard Norio Nomura #732Add
dynamic_inline
rule to discourage combination of@inline(__always)
anddynamic
function attributes.
Daniel Duanβ Add
number_separator
opt-in rule that enforces that underscores are used as thousand separators in large numbers.
Marcelo Fabri #924β Add
file_header
opt-in rule that warns when a file contains a copyright comment header, such as the one Xcode adds by default.
Marcelo Fabri #844FunctionParameterCountRule
now ignores initializers.
Denis Lebedev #544β Add
EmojiReporter
: a human friendly reporter.
MichaΕ KaΕuΕΌnyAdd
redundant_string_enum_value
rule that warns against String enums with redundant value assignments.
Marcelo Fabri #946β Add
attributes
opt-in rule which validates if an attribute (@objc
,@IBOutlet
,@discardableResult
, etc) is in the right position:- If the attribute is
@IBAction
or@NSManaged
, it should always be on the same line as the declaration - If the attribute has parameters, it should always be on the line above the declaration
- Otherwise:
- if the attribute is applied to a variable, it should be on the same line
- if it's applied to a type or function, it should be on the line above
- if it's applied to an import (the only option is
@testable import
), it should be on the same line. You can also configure what attributes should be always on a new line or on the same line as the declaration with thealways_on_same_line
andalways_on_line_above
keys.
- If the attribute is
Add
empty_parentheses_with_trailing_closure
rule that checks for empty parentheses after method call when using trailing closures.
Marcelo Fabri #885Add
closure_parameter_position
rule that validates that closure parameters are in the same line as the opening brace.
Marcelo Fabri #931type_name
rule now validatestypealias
andassociatedtype
too.
Marcelo Fabri #49 #956β Add
ProhibitedSuperRule
opt-in rule that warns about methods calling to super that should not, for exampleUIViewController.loadView()
.
Aaron McTavish #970β Add correctable
void_return
rule to validate usage of-> Void
over-> ()
.
Marcelo Fabri JP Simard #964β Add correctable
empty_parameters
rule to validate usage of() ->
overVoid ->
.
Marcelo Fabri #573Add
operator_usage_whitespace
opt-in rule to validate that operators are surrounded by a single whitespace when they are being used.
Marcelo Fabri #626Add
unused_closure_parameter
correctable rule that validates if all closure parameters are being used. If a parameter is unused, it should be replaced by_
.
Marcelo Fabri JP Simard #982β Add
unused_enumerated
rule that warns against unused indexes when using.enumerated()
on a for loop, e.g.for (_, foo) in bar.enumerated()
.
Marcelo Fabri #619
π Bug Fixes
π Fix
weak_delegate
rule reporting a violation for variables containing but not ending indelegate
.
Phil Websterπ Fix
weak_delegate
rule reporting a violation for variables in protocol declarations.
Marcelo Fabri #934π Fix
trailing_comma
rule reporting a violation for commas in comments.
Marcelo Fabri #940π Fix XML reporters not escaping characters.
Fabian Ehrentraud #968π Fix specifying multiple rule identifiers in comment commands.
JP Simard #976π Fix invalid CSS in HTML reporter template.
Aaron McTavish #981π Fix crash when correcting
statement_position
rule when there are multi-byte characters in the file.
Marcelo Fabri
- π SwiftLint now requires Xcode 8.x and Swift 3.x to build.
APIs have not yet been adapted to conform to the Swift 3 API Design
Guidelines but will shortly.