Changelog History
Page 8
-
v0.21.0 Changes
π₯ 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,metricsorperformance. Currently this is just used for documentation purposes when you runswiftlint rulesorswiftlint generate-docs.
Marcelo Fabriβ Add [rules documentation](Rules.md) generation.
Marcelo Fabri #1078Add
private_over_fileprivatecorrectable rule to check for top-level usages offileprivateand recommendprivateinstead. This is in line with SE-0169's goal "forfileprivateto be used rarely". There is a also a newstrict_fileprivateopt-in rule that will mark everyfileprivateas a violation (especially useful with Swift 4).
Jose Cheyo Jimenez Marcelo Fabri #1469 #1058Add
let_var_whitespaceopt-in rule to enforce thatlet/vardeclarations 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 #1577Don't trigger
implicit_getterviolations when attributes (such asmutatingor@inline) are present.
Marcelo Fabri #1309 #1589β Add
--use-tabsoption toAutoCorrectOptions, enabling formatting using tabs over spaces.
Cody Winton #1327π Improve
autocorrectperformance 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
errorseverity level configuration.
Jamie Edge Marcelo Fabri #1647Add
unneeded_parentheses_in_closure_argumentopt-in correctable rule that warns against using parentheses around argument declarations in closures.
Marcelo Fabri #1483β Add
--disabledflag toswiftlint rulesto print only rules that are not enabled in the configuration.
Marcelo FabriAdd
ignore_comment_only_linesboolean configuration option tofile_lengthrule. With the option enabled,file_lengthwill ignore lines which have only comments.
Samuel Susla #1165π Improve
file_headerrule description.
Marcelo Fabri #1492β Add
trailing_closureopt-in rule that validates that trailing closure syntax should be used whenever possible.
Marcelo Fabri #54Shebang (
#!) in the beginning of a file is now ignored by all rules.
Marcelo Fabri #1294Add
block_based_kvorule 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_headerrule 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 #1512Treat
yes,no,onandoffas strings (and not booleans) when loading configuration files.
Marcelo Fabri #1424Add
discouraged_direct_initrule that discourages direct initialization of certain types.
Ornithologist Coder #1306
π Bug Fixes
Fix false positive on
redundant_discardable_letrule when usingwhilestatements.
Marcelo Fabri #1669π Fix all custom rules not being applied when any rule is configured incorrectly.
Jamie Edge #1586π Fix crash when using
--configwith a relative path and--pathwith a file.
Marcelo Fabri #1694π Fix
markrule corrections generating invalid code in some cases.
Marcelo Fabri #1029Fix false positive in
empty_enum_argumentsrule when using wildcards andwhereclauses.
Marcelo Fabri #1722π Fix false positive in
large_tuplerule when using throwing closure.
LiquidsoulMake
vertical_parameter_alignmentmore robust, fixing false positives and detecting previously missed violations.
JP Simard #1488
- π Xcode 8.3 or later and Swift 3.1 or later are required to build.
-
v0.20.1 Changes
π₯ Breaking
- None.
β¨ Enhancements
- None.
π Bug Fixes
π Fix typo in
FatalErrorMessageRule.
Alexander LashDon't trigger an
extension_access_modifierviolation when all extension members areopen, asopen extensionis not supported by Swift.
Marcelo Fabri #1629Don't trigger a
vertical_parameter_alignment_on_callviolation when trailing closures are used.
Marcelo Fabri #1635Make
vertical_parameter_alignment_on_callmore flexible when multiline parameters are used.
Marcelo Fabri #1630 #1643π Use the directory's
.swiftlint.ymlwhen--pathis used.
Marcelo Fabri #1631
-
v0.20.0 Changes
π₯ Breaking
- None.
β¨ Enhancements
Detect more violations of
force_unwrappingwhen using subscripts.
OtΓ‘vio LimaMatch
(Void)as return type in thevoid_returnrule.
Anders Hasselqvistβ Add
multiline_parametersopt-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_countrule 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_testrule when a method has parameters.
Marcelo Fabri #1532Don't trigger violations from the
discarded_notification_center_observerrule when the observer is being returned from a function that is not marked as@discardableResult.
Marcelo Fabri #1525Add
extension_access_modifieropt-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_callopt-in rule that validates that parameters are vertically aligned on a method call.
Marcelo Fabri #1037Add
code_literalandimage_literalboolean configuration options toobject_literalrule. 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_argumentsrule when calling methods.
Marcelo Fabri #1597Fix crash in
unused_closure_parameterrule when using unicode identifiers.
Woo-Sik Byun Marcelo Fabriπ Fix two false positives in
force_unwrappingrule.
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.ymlwhen they are located in the same directory as a differently-named, user-provided custom configuration file.
JP Simard #1531π Fix
empty_countrule false positive in words that include "count".
Marcelo Fabri #1622Use
validates_start_with_lowercasekey when decoding configurations forgeneric_type_name,identifier_nameandtype_namerules. This key was used on the docs, but internallyvalidates_start_lowercasewas used.
Marcelo Fabri #1626
-
v0.19.0 Changes
π₯ Breaking
β Remove support for Swift 2.
Marcelo Fabri #1453π Remove
missing_docsandvalid_docsrules since they were already disabled.
Marcelo Fabri #1453β Add
modificationDate(forFileAtPath:)function requirement toLintableFileManagerprotocol.
Victor Pimentelπ Several breaking changes to
LinterCache.
Victor Pimentel JP Simardβ Remove
Configuration.hashproperty.
Victor Pimentelπ Rename
ConditionalReturnsOnNewlinestruct toConditionalReturnsOnNewlineRuleto 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_nameandtype_namerules to allow excluding non-alphanumeric characters and names that start with uppercase.
Javier HernΓ‘ndez #541β Adds support for
excludedin custom rules to exclude files.
Nigel Flack #1437π Make
trailing_commarule autocorrectable.
Samuel Susla Jeremy David Giesbrecht #1326Added
no_extension_access_modifieropt-in rule to disallow access modifiers completely, Γ la SE-0119.
Jose Cheyo Jimenez #1457β Add lowercase and missing colon checks to the
markrule.
Jason MooreImprove violation reason wording in
function_body_length,large_type, andtype_body_lengthrules. Β ultimatedbzAdd
explicit_top_level_aclopt-in rule that validates that all top level declarations should explicitly be marked with an Access Control Level (private,fileprivate,internal,publicoropen).
J. Cheyo Jimenez Marcelo Fabri #58β Add
implicit_returnopt-in rule that warns against using thereturnkeyword when it can be omitted inside closures.
Marcelo Fabri #1194Add option to
unused_optional_bindingrule to ignoretry?inguardstatements.
Sega-Zero #1432Add
empty_enum_argumentscorrectable rule that warns against using silent associated values inside acase.
Marcelo Fabri #1425 #1549β Remove
file.zipfrom thePodsdirectory when installing SwiftLint via CocoaPods.
Hesham Salman #1507Add
protocol_property_accessors_ordercorrectable rule that validates that the order of accessors isget setwhen declaring variables in protocols.
Marcelo Fabri #1504π Make
Region&Commandstructs conform toEquatable.
JP Simardπ Make
closure_spacingaCorrectableRule.
J. Cheyo Jimenez
π Bug Fixes
π
emojiandcheckstylereporter output report sorted by file name.
norio-nomura #1429Prevent false positive in
shorthand_operatorrule.
sammy-SC #1254π Fix typo in
DiscardedNotificationCenterObserverRule.
Spencer Kaiserπ Fix
empty_parametersrule with Swift 3.
Marcelo Fabri #1460Prevent triggering
redundant_optional_initializationrule on alazy varsince it needs initialization.
Marcelo Fabri #1334Fix
ignores_case_statementskey incyclomatic_complexitydescription.
Jeff Blagdon #1434Fall back to reporting violations on line
1if 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_sugarrule when using nested types namedOptional,ImplicitlyUnwrappedOptional,ArrayorDictionary.
Marcelo Fabri #1508Fix false positives in
prohibited_super_call&overridden_super_callrules where calls tosuperwere done in nested scopes such asdeferblocks.
JP Simard #1301π Fix non-root configurations logging configuration warnings more than once.
JP Simard #949π Fix some overlapping
// swiftlintcommands 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_whererule 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_bindingrule.
Daniel RodrΓguez TroitiΓ±o #1376Fix false positives in
redundant_discardable_letrule.
Jeremy David Giesbrecht #1415
-
v0.17.0 Changes
π₯ Breaking
variable_namerule (VariableNameRule) is nowidentifier_name(IdentifierNameRule) as it validates other identifiers as well.
Marcelo Fabri #663π Fix
sorted_importsrule 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_optionalopt-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_whereandvertical_whitespacerules.
Marcelo FabriAdd
discarded_notification_center_observerrule 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_detachmentrule that warns against an object removing itself fromNotificationCenterin an unsafe location.
Marcelo Fabri #1061Accept
AnyObjectandNSObjectProtocolinclass_delegate_protocol.
Jon Shier #1261Add
ignores_function_declarationsandignores_commentsas options toLineLengthRule.
Michael L. Welles #598 #975β Add
for_whererule that validates thatwhereis used in aforloop instead of a singleifexpression inside the loop.
Marcelo Fabri #1228unused_enumeratedrule now warns when only the index is being used. You should use.indicesinstead of.enumerated()in this case.
Marcelo Fabri #1278Add
ignores_case_statementsas option toCyclomaticComplexityRule.
Michael L. Welles #1298Add correctable
redundant_discardable_letrule 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_getterrule.
Marcelo Fabriβ Add
--enabled(or-e) switch to therulesCLI command, to only display enabled rules.
Natan Rolnik #1270π§ Now
nestingrule can be configured with a type and statement level.
Hayashi Tatsuya #1318Add
explicit_type_interfaceopt-in rule that validates that the properties have an explicit type interface.
Kim de Vosβ Add
--lenientCLI option tolintcommand. Facilitates running a lint task that doesn't fail a pipeline of other tasks.
aaroncrespo #1322Add
fatal_error_messageopt-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_tuplerule when using closures.
Marcelo Fabri #1234π Fix
force_unwrapfalse positive for bool negation.
Aaron McTavish #918π Fix false positive and wrong correction on
number_separatorrule.
Marcelo Fabri #1242Retain closure parameter types when they are specified during autocorrect.
Allen Zeng #1175Fix
redundant_void_returnmatches if return type starts with Void~.
Hayashi TatsuyaIgnore
unused_closure_parameterrule on closures that are called inline.
Marcelo Fabri #1161π Disable
valid_docsandmissing_docsrules 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_tuplerule when using generics inside a tuple.
Marcelo Fabri #12570οΈβ£ Make
ASTRuledefault 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_newlinerule to be anASTRuleand be more reliable, fixing some false negatives and false positives.
Marcelo Fabri #1268Fix
closure_end_indentationrule false positive when using single-line closures.
Marcelo Fabri #1216π Fix
todorule messages when the comment is not on a new line.
Marcelo Fabri #1304Fix false negative on
unused_closure_parameterrule.
Hayashi Tatsuyaπ Fix
checkstylereport format.
Yuki Oya
-
v0.16.1 Changes
π₯ Breaking
- None.
β¨ Enhancements
Improve
unused_optional_bindingrule on tuples check.
Rafael Machadoβ‘οΈ Update
variable_nameto ignore overrides.
Aaron McTavish #1169β‘οΈ Update
number_separatorrule to allow for specifying minimum length of fraction.
Bjarke SΓΈndergaard #1200β‘οΈ Update
legacy_constantrule to supportCGFloat.piandFloat.pi.
Aaron McTavish #1198
π Bug Fixes
π Fix false positives on
shorthand_operatorrule.
Marcelo Fabri #1156 #1163Fix false positive on
redundant_optional_initializationrule.
Marcelo Fabri #1159Fix false positive on
operator_usage_whitespacerule with decimal literals in exponent format.
Marcelo Fabri #1153π Fix
excludedconfiguration not excluding files.
Marcelo Fabri #1166Disable commutative operations on
shorthand_operatorrule.
Marcelo Fabri #1182 #1183 #1211π Fix crash when running in a Sandboxed environment, which also fixes Homebrew distribution. Set the
SWIFTLINT_SWIFT_VERSIONenvironment variable to either2or3to 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_operatorrule correctable.
Vojta StavikAdd
vertical_parameter_alignmentrule 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_protocolrule that warns against protocol declarations that aren't marked as: classor@objc.
Marcelo Fabri #1039Add correctable
redundant_optional_initializationrule that warns against initializing optional variables withnil.
Marcelo Fabri #1052redundant_nil_coalescingrule is now correctable.
Marcelo Fabriπ Make
number_separatorrule correctable.
Marcelo Fabriempty_parentheses_with_trailing_closurerule is now correctable.
Marcelo FabriAdd correctable
redundant_void_returnrule that warns against explicitly adding-> Voidto functions.
Marcelo Fabri #1066β Add an opt-in rule that enforces alphabetical sorting of imports.
Scott Berrevoets #900type_namerule forces enum values to be UpperCamelCase again when used with Swift 2.3.
Marcelo Fabri #1090π Make
weak_delegaterule ignore computed properties.
Rafael Machado #1089β Add
object_literalopt-in rule that warns against using image and color inits that can be replaced for#imageLiteralor#colorLiteralin Swift 3.
Marcelo Fabri #1060π§ Now
number_separatorrule can be configured with a minimum length.
Marcelo Fabri #1109Add
compiler_protocol_initrule that flags usage of initializers declared in protocols used by the compiler such asExpressibleByArrayLiteralthat 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_tupleconfigurable rule that validates that tuples shouldn't have too many members.
Marcelo Fabri #1065Add
generic_type_namerule that validates generic constraint type names.
Marcelo Fabri #51β‘οΈ Update
vertical_whitespacerule 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_lengthrule whenignores_urlsconfiguration is enabled.
Javier HernΓ‘ndez #384β Add
shorthand_operatorrule that validates that shorthand operators should be used when possible.
Marcelo Fabri #902π Allow specifying a
swiftlint_versionconfiguration 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_bindingrule that will check for optional bindings not being used.
Rafael Machado #1116
π Bug Fixes
Ignore close parentheses on
vertical_parameter_alignmentrule.
Marcelo Fabri #1042π
syntactic_sugarrule now doesn't flag declarations that can't be fixed.
Marcelo Fabri #928Fix false positives on
closure_parameter_positionandunused_closure_parameterrules with Swift 2.3.
Marcelo Fabri #1019π Fix crash on
trailing_commarule with Swift 2.3.
Marcelo Fabri #921π Fix out of range exception in
AttributesRule.
JP Simard #1105Fix
variable_nameandtype_namerules on Linux.
Marcelo Fabriπ Fix linting directories with names ending with
.swift.
JP Simardπ Fix running
swiftlint versionwhen building with Swift Package Manager.
Marcelo Fabri #1045Fix false positive on
vertical_parameter_alignmentrule when breaking line in a default parameter declaration.
Marcelo Fabri #1129
-
v0.15.0 Changes
π₯ Breaking
- β
line_lengthrule now has a default value of120for warnings.
Marcelo Fabri #1008
β¨ Enhancements
- Add
closure_end_indentationopt-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_whitespacerule is now correctable.
Marcelo Fabriπ
implicit_getterandmarkrule performance improvements.
Marcelo FabriHTML reports now display a relative path to files.
Jamie Edgecolonrule now validates colon position in dictionaries too. You can disable this new validation with theapply_to_dictionariesconfiguration.
Marcelo Fabri #603β Add
first_whereopt-in rule that warns against using.filter { /* ... */ }.firstin collections, as.first(where: { /* ... */ })is often more efficient.
Marcelo Fabri #1005
π Bug Fixes
FunctionParameterCountRulealso 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_closurerule.
Marcelo Fabri #1021Fix false positive in
switch_case_on_newlinewhen switching over a selector.
Marcelo Fabri #1020Fix crash in
closure_parameter_positionrule.
Marcelo Fabri #1026Fix false positive in
operator_usage_whitespacerule when using image literals.
Marcelo Fabri #1028
- β