Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
303 KiB
Changelog
Main
Breaking
-
Remove support for boolean values in the
validates_start_with_lowercaseoption entirely. Use the severity levelsoff,warningorerrorinstead.
kaseken -
SwiftLint now requires macOS 13 or higher to run.
JP Simard -
In
SwiftLintBuildToolPlugin, print the content of theBUILD_WORKSPACE_DIRECTORYenvironment variable only in debug builds.
SimplyDanny #6135
Experimental
- None.
Enhancements
-
Add
include_variablesconfiguration option tonon_optional_string_data_conversionrule.
When enabled, the rule will trigger on variables, properties, and function calls in addition to string literals. Defaults tofalsefor backward compatibility.
SimplyDanny #6094 -
Add Sendable conformance to Rule.Type for building with Swift 6.
erikkerber #issue_number -
Fix false positives for
Actor-conforming delegate protocols in theclass_delegate_protocolrule.
imsonalbajaj #6054 -
Support extensions and protocols in
type_body_lengthrule. They can be configured using the newexcluded_typesoption which by default excludesextensionandprotocoltypes. This means the rule now checksstruct,class,actorandenumby default. To enable checking of extensions and protocols, setexcluded_typesto an empty array or exclude other types as needed.
SimplyDanny -
Ignore various assignment operators like
=,+=,&=, etc. with right-hand side ternary expressions otherwise violating thevoid_function_in_ternaryrule.
SimplyDanny #5611 -
Rewrite the following rules with SwiftSyntax:
accessibility_label_for_imageaccessibility_trait_for_buttonclosure_end_indentationexpiring_todofile_headerfile_lengthline_lengthtrailing_whitespacevertical_whitespace
-
Add
excluded_pathsoption to thefile_namerule. It allows to exclude complete file paths from analysis. All entries are treated as regular expressions. A single match in its full path is enough to ignore a file. This is different from theexcludedoption that only accepts and checks against file names.
Ueeek #6066 -
Fix false positives of
redundant_discardable_letrule in@ViewBuilderfunctions,#Previewmacro bodies and preview providers whenignore_swiftui_view_bodiesis enabled.
kaseken #6063 -
Improve
multiline_parametersrule to correctly support
max_number_of_single_line_parametersand detect mixed formatting.
GandaLF2006 -
Add new
prefer_condition_listrule that triggers when aguard/if/whilecondition is composed of multiple expressions connected by the&&operator. It suggests to use a condition list instead, which is more idiomatic.
SimplyDanny -
Add
ignore_coding_keysparameter tonestingrule. Setting this to true preventsCodingKeyenums from violating the rule.
braker1nine #5641 -
Support deinitializers and subscripts in
function_body_lengthrule.
SimplyDanny
Bug Fixes
-
Fix
no_extension_access_modifierrule incorrectly triggering fornonisolated extension. The rule now only flags actual access control modifiers (private,public,open,internal,fileprivate) and ignores isolation modifiers likenonisolated.
copilot #6168 -
Improved error reporting when SwiftLint exits, because of an invalid configuration file or other error.
Martin Redington #6052 -
Keep the default severity levels when neither
warningnorerrorvalues are configured. Ensure especially that theerrorlevel is not set tonilwhen thewarninglevel isn't set either.
SimplyDanny
0.59.1: Crisp Spring Clean
Breaking
- Remove
opaque_over_existentialopt-in rule as it causes too many false positives that can even lead to wrong-compilable code whenanyis required by a protocol the type conforms to. In this case, usingsomecan be totally valid even though the protocol requirement is not reimplemented for the type causing behavioral changes.
SimplyDanny
Experimental
- None.
Enhancements
- Add new
allowed_numbersoption to theno_magic_numbersrule.
Martin Redington
Bug Fixes
- None.
0.59.0: Crisp Spring Clean
Breaking
- Remove tracking of correction positions. Print the number of corrections applied instead.
SimplyDanny
Experimental
- Introduce
swiftlint-devcommand line tool that's intended to help to develop SwiftLint by encapsulating repetitive tasks. It can already be used to generate templates for new rules including optional configurations and tests. Runswift run swiftlint-dev rules template -hto get an overview of the command's usage and the available customization options. To register new rules, runswift run swiftlint-dev rules register.
SimplyDanny
Enhancements
-
Add new option
ignores_multiline_stringstoline_lengthrule. It allows to ignore too long lines inside of multiline strings.
thisIsTheFoxe #2689 -
Ignore
UIColorinitializers inno_magic_numbersrule.
suojae hyeffie #5183 -
Exclude types with a
@Suiteattribute and functions annotated with@Testfromno_magic_numbersrule. Also treat a type as a@Suiteif it contains@Testfunctions.
SimplyDanny #5964 -
Add new
opaque_over_existentialopt-in rule that triggers when the existentialanytype of a function parameter can be replaced with an opaquesometype.
SimplyDanny -
Add a new rationale property to rule descriptions, providing a more expansive description of the motivation behind each rule.
Martin Redington #5681 -
Add new
allowed_typesoption tolegacy_objc_typerule to ignore certain types.
kapitoshka438 #3723 -
Add
excluded_methodsconfiguration option tounneeded_overrideto opt out checking methods with a given name. For example, this helps avoid a conflict withbalanced_xctest_lifecyclewhere one ofsetUp/tearDownis empty but the other is not.
jaredgrubb
Bug Fixes
-
Fix issue referencing the Tests package from another Bazel workspace.
jszumski -
Fix crash when a disable command is preceded by a unicode character.
SimplyDanny #5945 -
Allow severity of
duplicate_importsrule to be configurable.
SimplyDanny #5978 -
Silence
no_magic_numbersrule in conditions of#ifdirectives.
SimplyDanny #6000 -
Consider types restricting a protocol to classes in composed inherited types in
class_delegate_protocolrule.
SimplyDanny #5982 -
Rewrite
type_contents_orderrule with SwiftSyntax fixing an issue with experimental availability macros.
SimplyDanny #5999 -
Update
file_namerule to considermacrotypes.
fraioli #6026
0.58.2: New Year’s Fresh Fold
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
- Fix version being reported by the binary consumed from the Docker image.
SimplyDanny #5966
0.58.1: New Year’s Fresh Fold
Breaking
-
If you are referring to the
swiftlintbinary from an Artifact Bundle consumed via Swift Package Manager in an Xcode Run Script Build Phase, make sure to update the path from"$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*/bin/swiftlintto
"$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*-macos/bin/swiftlintin order to make Xcode use the binary built for macOS.
SimplyDanny #5954 -
Revert changes to improve performance when exclude patterns resolve to a large set of files. While resolving files indeed got much faster in certain setups, it leads to missed exclusions for nested configurations and when the linted folder is not the current folder.
SimplyDanny #5953
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Fix
redundant_sendablecorrection by removing a remaining trailing comma as well whenSendablewas last.
SimplyDanny #5952 -
Remove lints for
redundant_sendableon protocols, whereSendableis not redundant.
riley-williams #5958 -
Add
ib_segue_actionto default configuration oftype_contents_orderrule on the same level asib_actionto define and document a standard position.
SimplyDanny #5524
0.58.0: New Year’s Fresh Fold
Breaking
-
The command plugin now requires write permissions so that it works with the
--fixoption without an error.
SimplyDanny -
The artifact bundle name has changed.
SwiftLintBinary-macos.artifactbundle.zipis now calledSwiftLintBinary.artifactbundle.zip. It now includes an AMD64 Linux binary.
Bradley Mackey #5514 -
The
inert_deferandunused_capture_listrules have completely been removed after being deprecated for 2 years.
SimplyDanny -
SwiftLint now requires a Swift 5.10 or higher compiler to build. The Swift Package Manager plugins continue to work with Swift 5.9.
SimplyDanny -
The
private_unit_testrule's deprecatedregexconfiguration option has been removed after 2 years.
Martin Redington #5912
Experimental
- None.
Enhancements
-
Add Xcode command plugin allowing to run SwiftLint from within Xcode.
SimplyDanny -
Add new
async_without_awaitopt-in rule that checks if anasyncdeclaration contains at least oneawait.
Jan Kolarik #5082 -
Support replacing identity expressions with
\.selfinprefer_key_pathrule from Swift 6 on.
SimplyDanny -
Support linting only provided file paths with command plugins.
DanSkeel -
Add new category for
@IBSegueActiontotype_contents_orderrule.
dk-talks SimplyDanny -
Add option to disable
redundant_discardable_letrule in SwiftUI view bodies.
SimplyDanny #3855 -
Add new
redundant_sendablerule that triggers onSendableconformances of types that are implicitly alreadySendabledue to being actor-isolated. It is enabled by default.
SimplyDanny -
Improve performance when exclude patterns resolve to a large set of files.
SimplyDanny #5018
Bug Fixes
-
Ignore TipKit's
#Rulemacro inempty_countrule.
Ueeek #5883 -
Ignore super calls with trailing closures in
unneeded_overriderule.
SimplyDanny #5886 -
If violations are detected by
lintoranalyze, still perform an update check for new versions of SwiftLint if requested.
Martin Redington #5904
0.57.1: Squeaky Clean Cycle
Breaking
- None.
Experimental
- None.
Enhancements
-
Suggest failable
String(bytes:encoding:)initializer inoptional_data_string_conversionrule as it accepts allSequencetypes.
Jordan Rose SimplyDanny -
Support reading files to lint from Input File Lists provided by Run Script Build Phases in Xcode using the command-line argument
--use-script-input-file-lists.
BlueVirusX -
Adds a
lenientconfiguration file setting, equivalent to the--lenientcommand line option.
Martin Redington #5801 -
Support type casting on configuration option values defined by environment variables. Without a cast, these values would always be treated as strings leading to a potentially invalid configuration.
SimplyDanny #5774 -
Add new option
max_number_of_single_line_parametersthat allows only the specified maximum number of parameters to be on one line whenallows_single_line = true. If the limit is exceeded, the rule will still trigger. Confusing option combinations likeallows_single_line = falsetogether withmax_number_of_single_line_parameters > 1will be reported.
kimdv SimplyDanny #5781 -
The
redundant_type_annotationrule gains a new option,ignore_properties, that skips enforcement on members in a type declaration (like astruct). This helps the rule coexist with theexplicit_type_interfacerule that requires such redundancy.
jaredgrubb #3750 -
Allow inherited isolation parameter to be first in function signatures depending on the new option
ignore_first_isolation_inheritance_parameterwhich istrueby default.
SimplyDanny #5793
Bug Fixes
-
Run command plugin in whole package if no targets are defined in the package manifest.
SimplyDanny #5787 -
Silence
superfluous_elserule onifexpressions with only a single availability condition.
SimplyDanny #5833 -
Stop triggering the
control_statementrule on closures being directly called as conditions.
SimplyDanny #5846 -
Do not trigger
self_in_property_initializationrule onselfin key paths expressions.
SimplyDanny #5835 -
Allow to specify transitive modules to be taken into account by
unused_importrule. This avoids that required imports are removed.
Paul Taykalo SimplyDanny #5167 -
Only pass cache path and directory paths to commands that accept these arguments in the command plugin.
SimplyDanny #5848 -
Do not throw deprecation warning if deprecated property is not presented in configuration.
chipp #5791 -
The
prefer_type_checkingrule will no longer trigger for non-optional type casting (as), or for comparisons to optional types.
Martin Redington #5802 -
Fixes an issue where the
superfluous_disable_commandrule could generate false positives for nested disable commands for custom rules.
Martin Redington #5788 -
Fixes the
--only-rulecommand line option, when a default.swiftlint.ymlis absent. Additionally rules specified with--only-ruleon the command line can now be disabled in a child configuration, to allow specific directories to be excluded from the rule (or from being auto-corrected by the rule), and--only-rulecan now be specified multiple times to run multiple rules.
Martin Redington #5711 -
Fixes
file_namerule to match fully-qualified names of nested types. Additionally adds arequire_fully_qualified_namesboolean option to enforce that file names match nested types only using their fully-qualified name.
fraioli #5840 -
Fixes an issue where the
vertical_whitespace_between_casesrule does not recognize@unknown default.
Jared Grubb #5788
0.57.0: Squeaky Clean Cycle
Breaking
-
The deprecated
anyobject_protocolrule has now been removed.
Martin Redington #5769 -
Revert the part of the
non_optional_string_data_conversionrule that enforces non-failable conversions ofDatato UTF-8String. This is due to the fact that the data to be converted can be arbitrary and especially doesn't need to represent a valid UTF-8-encoded string.
Sam Rayner #5263
Experimental
- None.
Enhancements
-
Add
ignore_multiline_type_headersandignore_multiline_statement_conditionsoptions toopening_bracerule to allow opening braces to be on a new line after multiline type headers or statement conditions. Renameallow_multiline_functoignore_multiline_function_signatures.
leonardosrodrigues0 #3720 -
Add new
optional_data_string_conversionrule to enforce failable conversions ofDatato UTF-8String.
Sam Rayner #5263 -
The
no_magic_numbersrule will now ignore violations in SwiftUI'sPreviewmacro.
Martin Redington #5778
Bug Fixes
-
superfluous_disable_commandviolations are now triggered for custom rules.
Marcelo Fabri Martin Redington SimplyDanny #4754 -
Trailing comments are now preserved by the
opening_bracerule when rewriting.
Martin Redington #5751
0.56.2: Heat Pump Dryer
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Ignore initializers with attributes in
unneeded_synthesized_initializerrule.
SimplyDanny #5153 -
Silence
prefer_key_pathrule on macro expansion expressions.
SimplyDanny #5744 -
Check
ifexpressions nested arbitrarily deep incontrasted_opening_bracerule.
SimplyDanny #5752 -
Align left closure brace with associated parent function call in
contrasted_opening_bracerule.
SimplyDanny #5752 -
Align left brace of additional trailing closures with right brace of previous trailing closure in
contrasted_opening_bracerule.
SimplyDanny #5752 -
Trigger on empty closure blocks in
no_empty_blockrule.
SimplyDanny #5762 -
Silence
unneeded_overriderule on methods and initializers with attributes.
SimplyDanny #5753
0.56.1: Heat Pump Dryer
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
- Let
contrasted_opening_bracebe an opt-in rule.
SimplyDanny
0.56.0: Heat Pump Dryer
Breaking
-
The deprecated
--pathand--in-process-sourcekitarguments have now been removed completely.
Martin Redington SimplyDanny #5614 -
When SwiftLint corrects violations automatically (
swiftlint lint --fix) it doesn't report the exact location of the fix any longer. The new format is<file-path>: Correcting <rule-name>without line and column numbers. Reason: Correction positions are likely just incorrect, especially when multiple rules apply their rewrites. Fixing that is not trivial and likely not worth the effort also considering that there haven't been any bug reports about wrong correction positions so far.
SimplyDanny
Experimental
- None.
Enhancements
-
Add new
attribute_name_spacingrule to enforce no trailing whitespace between attribute names and parentheses, ensuring compatibility with Swift 6, where this spacing causes compilation errors.
aryamansharda #5667 -
Linting got up to 30% faster due to the praisworthy performance improvements done in the SwiftSyntax library.
-
Rewrite the following rules with SwiftSyntax:
missing_docs
-
Add new
prefer_key_pathrule that triggers when a trailing closure on a standard function call is only hosting a (chained) member access expression since the closure can be replaced with a key path argument. Likewise, it triggers on closure arguments.
SimplyDanny -
Adds
baselineandwrite_baselineconfiguration file settings, equivalent to the--baselineand--write-baselinecommand line options.
Martin Redington #5552 -
Add
no_empty_blockopt-in rule to validate that code blocks are not empty. They should at least contain a comment.
Ueeek #5615 -
Add new
contrasted_opening_bracerule that enforces opening braces to be on a separate line after the preceding declaration.
SimplyDanny -
Add new
unused_parameterrule that triggers on function/initializer/subscript parameters that are not used inside of the function/initializer/subscript.
SimplyDanny #2120 -
Support
--targetpaths being passed to command plugin by Xcode.
SimplyDanny #5603 -
Add modified configurations to examples in rule documentation.
SimplyDanny -
Add new option
evaluate_effective_access_control_leveltomissing_docsrule. Setting it totruestops the rule from triggering on declarations inside of types with lower visibility. These declarations effectively have at most the same access level.
SimplyDanny -
Add new
--check-for-updatescommand line option for thelint,analyze, andversionsubcommands to check for new versions of SwiftLint, and an equivalentcheck_for_updatesconfiguration file setting.
Martin Redington SimplyDanny Ian Leitch #5613 -
Add new
--only-rulecommand line option for thelintandanalyze, subcommands that overrides configuration file rule enablement and disablement, in particular to facilitate running--fixfor single rules without having to temporarily edit the configuration file. Martin Redington #5666
Bug Fixes
-
Fix a few false positives and negatives by updating the parser to support Swift 6 with all its new language constructs.
SimplyDanny -
Stop triggering
markrule on "mark" comments in the middle of another comment.
SimplyDanny #5592 -
Don't consider specialized imports with attributes as duplicates in
duplicate_importsrule.
SimplyDanny #5716 -
Use correct types and relative paths in SARIF reporter output. Generally avoid escaping slashes in JSON output as well.
SimplyDanny #5598 #5599 -
Keep initializers with attributed parameters in
unneeded_synthesized_initializerrule.
SimplyDanny #5153 -
Make
vertical_whitespace_between_casesrule work for cases ending with a string literal.
ilendemli #5612 -
Ignore access level modifiers restricted to value setting in
extension_access_modifierrule.
SimplyDanny #5623 -
Fix
baseline compareincorrectly reporting some violations as new, and also now sorts the violations frombaseline comparedeterministically.
Martin Redington #5606 -
Fix rewriting for
implicit_returnrule when violations are nested within each other.
Martin Redington #5660 -
Fix
opening_bracecorrection and make sure that disable commands are taken into account before applying a fix.
swiftty SimplyDanny #5598 -
Violations of the
typesafe_array_initrule will now be correctly reported as such, instead of as violations of thearray_initrule.
Martin Redington #5709
0.55.1: Universal Washing Powder
Breaking
- None.
Experimental
- None.
Enhancements
- Clarify wording of
static_over_final_classrule's violation message.
SimplyDanny #5570
Bug Fixes
-
Fix Bazel build when
bzlmodis not in use by adding transitive dependencies explicitly.
SimplyDanny #5568 -
Treat condionally activatable variable declarations and initializer as if they were always active in
unneeded_synthesized_initializerrule to avoid compilation issues when unexpected items are there after all.
SimplyDanny #5574 -
Silence
unused_enumeratedrule when$0in a closure is explicitly unpacked.
SimplyDanny #5573 -
Remove redundant initializers in
unneeded_overriderule only when checking initializers is actually enabled in the configuration.
SimplyDanny #5571 -
Respect comments before opening brace in
opening_bracerule when there is one space before the brace after the comment. Everything else is still a violation, yet the rewriter will not remove the comment anymore.
SimplyDanny #5578
0.55.0: Universal Washing Powder
Breaking
-
Rewrite
SwiftLintBuildToolPluginusingBUILD_WORKSPACE_DIRECTORYwithout relying on the--configoption.
Garric Nahapetian -
Introduce SwiftLintCommandPlugin. Rename SwiftLintBuildToolPlugin. Add Swift Package Manager installation instructions.
garricn -
Fix Code Climate reporter output by having lower case severity values to comply with the Code Climate specification.
waitButY -
The
superfluous_disable_commandrule will now be enabled for theanalyzecommand, unless it has been disabled, and will warn about superfluous disablement of analyzer rules.
Martin Redington #4792 -
With the introduction of the
consider_default_literal_types_redundantoption to theredundant_type_annotationrule,Boolliterals will no longer be considered redundant by default. Set this option to true to preserve the previous behavior.
Garric Nahapetian
Experimental
- Add two new options to the
lintandanalyzecommands:--write-baselineto save a baseline to disk, and--baselineto read a saved baseline and use it to filter out detected pre-existing violations. A newbaselinecommand uses the reporters to print the violations in a baseline.
Martin Redington #5475 #3421
Enhancements
-
Add a reporter that outputs violations in the Static Analysis Results Interchange Format (SARIF).
waitButY -
Ignore absence of a non-initial local config instead of falling back to default.
kohtenko -
Add new option
ignore_typealiases_and_associatedtypestonestingrule. It excludestypealiasandassociatedtypedeclarations from the analysis. marunomi #3183 -
Prevent from compiling
SwiftLinttarget when only usingSwiftLintPluginon macOS.
Julien Baillon #5372 -
Allow to set the severity of rules (if they have one) in the short form
rule_name: warning|errorprovided that no other attributes need to be configured.
SimplyDanny -
Add new
ignore_one_linersoption toswitch_case_alignmentrule to ignore switch statements written in a single line.
tonell-m #5373 -
Add new
shorthand_argumentrule that triggers on shorthand arguments like$0,$1, etc. in closures if they are too far away from the beginning of the closure. Options allow further cases to always trigger.
SimplyDanny #70 -
Warn when
--fixcomes together with--strictor--lenientas only--fixtakes effect then.
SimplyDanny #5387 -
Add new
one_declaration_per_filerule that allows only a single class/struct/enum/protocol declaration per file. Extensions are an exception; more than one is allowed.
Muhammad Zeeshan #2802 -
Add new
ignore_attributesoption toredundant_type_annotationrule that allows disabling the rule for properties that are marked with at least one of the configured attributes.
tonell-m #5366 -
Rewrite the following rules with SwiftSyntax:
explicit_aclextension_access_modifieridentifier_namelet_var_whitespacemarkmultiline_literal_bracketsnestingnimble_operatoropening_braceorphaned_doc_commentredundant_type_annotationtrailing_closurevoid_return
SimplyDanny
kishikawakatsumi
Marcelo Fabri
swiftty
KS1019
tonell-m -
Print invalid keys when configuration parsing fails.
SimplyDanny #5347 -
Add new
final_test_caserule that triggers on non-final test classes.
SimplyDanny -
Make
superfluous_elserule auto-correctable.
SimplyDanny -
Support other scope-exiting statements
continue,breakandthrowinsuperfluous_elserule.
SimplyDanny -
Trigger on
-> ()return signatures inreturn_value_from_void_functionrule. Moreover, support automatic fixes for obvious cases.
SimplyDanny -
Refine violation position of
trailing_closurerule.
SimplyDanny -
Trigger on the declaration keyword (i.e.
let,var,func,subscript) instead of thestaticorclasskeywords in theexplicit_aclrule.
SimplyDanny -
Allow to configure more operators in
identifier_namerule. The new option is namedadditional_operators. Use it to add more operators to the list of default operators known to the rule.
SimplyDanny #1762 -
Stop triggering
no_magic_numbersrule on literals used in range expressions assigned to variables.
SimplyDanny #5430 -
Add
affect_initializersoption to allowunneeded_overriderule to affect initializers.
leonardosrodrigues0 #5265 -
Respect scattered disable commands in auto-correction of
duplicate_importsrule.
SimplyDanny #5418 -
Add new
non_optional_string_data_conversionrule to enforce non-failable conversions of UTF-8String<->Data.
Ben P #5263 -
Refine violation position of
superfluous_elserule.
SimplyDanny -
Make
sorted_enum_casesrule's comparison case-insensitive to avoid unexpected ordering.
Oleg Kokhtenko -
Add
excluded_lines_patternstoline_lengthto avoid linting lines that contain one of the patterns.
kasrababaei -
Make
empty_countauto-correctable.
KS1019 -
Make
private_swiftui_stateauto-correctable.
mt00chikin -
Make
trailing_closurecorrectable.
KS1019 -
Add new
static_over_final_classrule to preferstaticoverfinal classdeclaration.
phlippieb #5471 -
Extends
unused_enumeratedrule to cover closure parameters, to detect cases likelist.enumerated().map { idx, _ in idx }andlist.enumerated().map { $1 }.
Martin Redington #5470 -
Include
Double,IntandStringto the exiting redundant type validation check ofBoolin theredundant_type_annotationrule. Addconsider_default_literal_types_redundantoption supportingBool,Double,IntandString. Setting this option totruelets the rule consider said types in declarations likelet i: Int = 1orlet s: String = ""as redundant.
Garric Nahapetian -
Add new
prefer_type_checkingrule to prefera is Xovera as? X != nil.
ikelax
mildm8nnered #5295
Bug Fixes
-
Invalid keys in a configuration don't lead to the default configuration being used anymore. The invalid key will just be reported but otherwise ignored.
SimplyDanny #5565 -
Fix version comparison algorithm which caused some version-dependent rules to misbehave with Swift 5.10.
chandlerwall #5517 -
Silence
discarded_notification_center_observerrule in closures. Furthermore, handlegetandsetaccessors correctly and consider implicit returns.
SimplyDanny #4801 -
Fix some false positives in
let_var_whitespacerule that would happen when attributes attached to declarations were spread over multiple lines.
SimplyDanny #4801 -
Support
private_over_fileprivaterule for actors.
SimplyDanny #5489 -
Ensure that declarations referenced only as extended types do not count as used by means of the
unused_declarationrule.
SimplyDanny #5550 -
Fix some false positives in
multiline_literal_bracketsrule that would happen when comments are present.
Marcelo Fabri -
Fix some false positives in the
opening_bracerule.
kishikawakatsumi SimplyDanny
#4610 #5114 #3470 #3574 #2632 #3476 #3756 #3690 -
Ignore overridden functions with default parameters in the
unneeded_overriderule as they might change behavior.
SimplyDanny #5355 -
Trigger
nsobject_prefer_isequalandredundant_self_in_closureeven in case the surrounding declaration is nested in an extension.
SimplyDanny -
Fixed false positives for the
no_magic_numbersrule, when they are defined in a tuple likelet (a, b) = (5, 10)orlet a = (2, 3).
Martin Redington #5305 -
Take array and nested types into account in
redundant_type_annotationrule.
SimplyDanny #3141 #3146 -
Silence
pattern_matching_keywordsrule when an identifier is referenced in the argument list of a matching enum case.
SimplyDanny #3852 -
Don't trigger the
return_value_from_void_functionwarning from initializers.
mrbkap -
Fixes superfluous warnings about configurations for rules that were not enabled, when the rules were enabled in a parent configuration.
Martin Redington #4858 -
Add
allpseudo-rule foranalyzer_rules- enables all analyzer rules that are not listed indisabled_rules.
woxtu Martin Redington #4999 -
Updates the reasons provided by violations of the
blanket_disable_commandto omit language about the end of the file, and to direct users to re-enable the rule as soon as possible.
Martin Redington #5450 -
Add a
--working-directorycommand line option, for users who cannot otherwise control which directory SwiftLint is run from.
Martin Redington #5424
0.54.0: Macro-Economic Forces
Breaking
- SwiftLint now requires Swift 5.9 or higher to build.
SimplyDanny JP Simard
Experimental
- None.
Enhancements
-
Add
onlyconfiguration option totodorule which allows to specify whether the rule shall trigger onTODOs,FIXMEs or both.
gibachan #5233 -
Make
unneeded_break_in_switchauto correctable.
KS1019 -
Speed up
closure_parameter_positionrule when there are no violations.
Marcelo Fabri -
Rewrite
cyclomatic_complexityrule using SwiftSyntax.
Marcelo Fabri -
Rewrite
redundant_void_returnrule using SwiftSyntax. Also include redundant void return clauses for closures in addition to functions. This can be disabled by configuring the rule withinclude_closures: false.
Marcelo Fabri JP Simard -
Rewrite
discouraged_optional_collectionrule using SwiftSyntax, catching more violations.
JP Simard -
Rewrite
duplicate_importsrule using SwiftSyntax.
JP Simard -
Handle
viewIsAppearingin thetype_contents_orderrule.
u-abyss #5259 -
Rewrite
vertical_parameter_alignment_on_callrule using SwiftSyntax, fixing some false positives.
Marcelo Fabri #3581 -
Rewrite
no_grouping_extensionrule using SwiftSyntax.
Marcelo Fabri
Bug Fixes
-
Fix false positive in
implicit_getterrule when using unknown accessors.
kabiroberai #5300 -
Fix correction of
explicit_initrule by keeping significant trivia.
BB9z #5289 -
Fix invalid corrections for opaque and existential optionals in
syntactic_sugarrule.
SimplyDanny #5277 -
Fix false positive in
unused_importrule that triggered on@_exportedimports which could break downstream modules if removed.
jszumski #5242 -
Fix false positive in
unused_importrule when using a constructor defined in a transitive module.
jszumski #5246
0.53.0: Laundry List
Breaking
-
Hide all
Reporters from SwiftLint's' public interface.
SimplyDanny -
The options
inlcuded,nameandmessageare from now on ignored in the configuration for theprivate_unit_testrule. The optionregexis still supported but is deprecated. It's recommended to use the listtest_parent_classesinstead which accepts names of parent test classes.
SimplyDanny -
Remove support for disable and enable commands in multiline comments.
Martin Redington #4798
Experimental
- None.
Enhancements
-
Show specific violation message for the
attributesrule when the optionalways_on_line_aboveorattributes_with_arguments_always_on_line_aboveis involved.
chrisngabp 5103 -
Rewrite
control_statementrule using SwiftSyntax.
SimplyDanny -
Add new
non_overridable_class_declarationrule that triggers onclassfunction and variable declarations in final classes that are not final themselves or private.
SimplyDanny -
The Homebrew formula for SwiftLint now also installs completion scripts for Bash, Zsh and fish.
SimplyDanny -
Add new
private_swiftui_stateopt-in rule to encourage setting SwiftUI@Stateand@StateObjectproperties to private.
mt00chikin #3173 -
The
implicit_returnrule now supports the kindssubscriptandinitializerin theincludedconfiguration list.
SimplyDanny -
Add
unneeded_overriderule to remove function overrides that only call super.
keith 5139 -
Show a rule's active YAML configuration in output of
swiftlint rules <rule>.
SimplyDanny -
Add
invokeTest()tooverridden_super_calldefaults.
DylanBettermannDD -
Add
--config-onlyoption torulescommand allowing to print only the YAML configuration of a single or all rules.
SimplyDanny -
Add
--default-configoption torulescommand allowing to use default values for configurations being printed for a single rule or all rules.
SimplyDanny -
Add
include_bare_initoption to theexplicit_initrule.include_bare_initencourages using named constructors over.init()and type inference.
Martin Redington #5203 -
Improved the reported location and reasons provided for issues detected by the
invalid_swiftlint_commandrule.
Martin Redington #5204 -
100 is no longer considered to be a magic number by the
no_magic_numbersrule.
Martin Redington #5215 -
Adds a
strictconfiguration file setting, equivalent to the--strictcommand line option.
Martin Redington #5226 -
Extend
implicitly_unwrapped_optionalrule with the new modeweak_except_iboutletsthat only checksweakvariables.
Ricky Tan
Bug Fixes
-
Respect grapheme clusters in counting the number of characters in the
collection_alignmentrule.
kishikawakatsumi #4837 -
Fix false positive in
control_statementrule that triggered on conditions with trailing closures where parentheses are recommended by the compiler.
SimplyDanny #5135 -
Fix runtime error when an excluded directory does not exist.
SimplyDanny #5078 -
Support
switchexpressions used in expression contexts inswitch_case_alignmentrule.
SimplyDanny #5191 #5227 #5080 -
Fix bug in
prefer_self_in_static_referencesrule that triggered on initializers of computed properties in classes when the property had an accessor block.
SimplyDanny #5118 -
Document
exclude_rangesoption fornumber_separatorrule.
SimplyDanny -
Rewrite
implicit_returnrule with SwiftSyntax fixing a few false positives and false negatives in the process.
SimplyDanny #5161 -
Make sure
severityis configurable fortype_contents_orderrule.
SimplyDanny -
Bazel: Mark
rules_xcodeprojas a development dependency.
Thi Doãn JP Simard #4737 -
Fix false negatives for the
unneeded_synthesized_initializerrule for nested structs in classes.
Martin Redington #5120 -
Fix some unexpected rule enablement interactions between parent and child configurations.
Martin Redington #4876 -
The
no_magic_numbersrule will not trigger for violations in an extension, if the extended class inherits from one of the specifiedtest_parent_classes, as long as the class declaration and the extension are in the same source file.
Martin Redington #5137 -
Fix false positive in the
ns_number_init_as_function_referencerule when callingNSNumber.init(value:)directly.
Marcelo Fabri #5172 -
The
no_magic_numbersrule will not trigger for bitwise shift operations.
Martin Redington #5171 -
The
accessibility_label_for_imagerule will no longer ignore theImage(systemName:)constructor, as many system images do not have good accessibility labels.
Martin Redington #5165 -
Fix false positives for
superfluous_disable_commandrule.
Martin Redington #4798 -
Fix false positive in the
test_case_accessibilityrule.
gibachan #5211
0.52.4: Lid Switch
Breaking
- None.
Experimental
- None.
Enhancements
-
Handle static
specmethods inquick_discouraged_callrule. The method type changed from an instance method to a class method in Quick 7.
SimplyDanny #5072 -
Prettify the rule configuration presentation on the command line as well as on the website.
SimplyDanny
Bug Fixes
-
Fix false positives for the
unneeded_synthesized_initializerrule, when no argument initializers had side-effects.
Martin Redington #5075 -
Ignore
switchexpressions assigned to variables inswitch_case_alignmentrule.
SimplyDanny #5080 -
Fix auto-correction for the
direct_returnrule, when statements have trailing comments.
Martin Redington #5081 -
Fix false positives for the
private_subjectrule when creating subjects inside initializers.
kasrababaei -
Fix false positive for
prefer_self_in_static_referenceswhen a class inherits from another class with generic types.
kasrababaei
0.52.3: Duplicate Hampers
Breaking
- None.
Experimental
- None.
Enhancements
-
Make severity for unallowed symbols configurable. The option name is
unallowed_symbols_severity. It accepts the two valueswarninganderror(default) as usual.
SimplyDanny -
Mention a rule's identifier in the console message that is printed when the rule's associated configuration entry contains invalid values.
SimplyDanny -
Silence
xct_specific_matcherrule on "one argument asserts" if there are potential types or tuples involved in the comparison as types and tuples do not conform toEquatable.
SimplyDanny #4990 -
Add
groupingoption to thesorted_importsrule allowing to sort groups of imports defined by their preceding attributes (e.g.@testable,@_exported, ...).
hiltonc -
Add new
--silence-deprecation-warningsflag that silences deprecation warnings that would otherwise be printed to the console.
SimplyDanny #4989 -
Do not trigger
redundant_self_in_closurerule when another idenfierxin scope shadows the field accessed byself.xto avoid semantical changes.
SimplyDanny #5010 -
Rewrite
todorule with SwiftSyntax.
woxtu -
Adds an
unneeded_synthesized_initializerrule, based onswift-format'sUseSynthesizedInitializerrule, which warns when a defined default or memberwise initializer would have been automatically synthesized.
Martin Redington
Bug Fixes
-
The option
validates_start_with_lowercasecan now be disabled by setting it tooff.
SimplyDanny #5036 -
Do not trigger
prefer_self_in_static_referencesrule ontypealiasdeclarations in classes.
SimplyDanny #5009 -
Do not trigger
prefer_self_in_static_referencesrule on collection types in classes, but on initializers like[C]()in all types.
SimplyDanny #5042 -
Fix false positives on
redundant_objc_attributerule for enums and private members.
Martin Redington #4633 -
Fix autocorrect for
CGIntersectionRectinlegacy_cggeometry_functionsrule.
Haoocen #5023 -
Fix false positives on
sorted_first_lastrule whenfirst/lasthave a predicate.
woxtu #3023 -
Work around dyld warning about duplicate SwiftSyntax classes with Xcode 15 betas.
keith JP Simard #4782
0.52.2: Crisper Clearer Pleats
Breaking
- None.
Experimental
- None.
Enhancements
- Exclude simple assignments of the form
self.x = xfrom being reported by theredundant_self_in_closurerule.
SimplyDanny #4988
Bug Fixes
-
Make
unhandled_throwing_taskopt-in instead of enabled by default. The rule is still prone to false positives at this point, so this makes enabling the rule a conscious decision by end-users.
JP Simard #4987 -
Fix
unhandled_throwing_taskfalse positives when theTaskis returned or where the throwing code is handled in aResultinitializer.
JP Simard #4987
0.52.1: Crisp Clear Pleats
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Let the
validates_start_with_lowercaseoption in name configurations expect a severity (warning or error). Not setting it disables the check. Boolean values are now deprecated. Atruevalue enables the check as an error for the time being to keep the previous behavior.
SimplyDanny #2180 -
Fixed a false positive in
unhandled_throwing_task.
kylebshr #4984 -
Fix Bazel release tarball for compiling on macOS.
JP Simard #4985
0.52.0: Crisp Clear Pleats
Breaking
-
The
attributesrule now expects attributes with arguments to be placed on their own line above the declaration they are supposed to influence. This applies to attributes with any kinds of arguments including single key path arguments which were previously handled in a different way. This behavior can be turned off by settingattributes_with_arguments_always_on_line_aboveto `false.
SimplyDanny #4843 -
The internal module structure for SwiftLint has changed to split the monolithic
SwiftLintFrameworkinto newSwiftLintCorefor core linter infrastructure,SwiftLintBuiltInRulesfor built-in rules andSwiftLintExtraRulesto add your own native rules to SwiftLint.
JP Simard
Experimental
- None.
Enhancements
-
Add new
superfluous_elserule that triggers onif-statements when an attachedelse-block can be removed, because all branches of the previousif-block(s) would certainly exit the current scope already.
SimplyDanny -
Add
sorted_enum_casesrule which warns when enum cases are not sorted.
kimdv -
Add new
redundant_self_in_closurerule that triggers in closures on explicitly usedselfwhen it's actually not needed due to:- Strongly captured
self({ [self] in ... }) - Closure used in a struct declaration (
selfcan always be omitted) - Anonymous closures that are directly called (
{ ... }()) as they are definitly not escaping - Weakly captured
selfwith explicit unwrapping
- Strongly captured
-
Extend
xct_specific_matcherrule to check for boolean asserts on (un)equal comparisons. The rule can be configured with the matchers that should trigger rule violations. By default, all matchers trigger, but that can be limited to justone-argument-assertsortwo-argument-asserts.
SimplyDanny JP Simard #3726 -
Trigger
prefer_self_in_static_referencesrule on more type references.
SimplyDanny -
Adds a new
reporterscommand, to improve discoverability of reporters.
Martin Redington #4819 -
Adds
test_parent_classesoption to theno_magic_numbersrule. Violations within test classes will now be ignored by default.
Martin Redington #4896 -
Stop enforcing calls to super from the override functions
setUp(),tearDown(),setUpWithError(), andtearDownWithError()inXCTestCasesubclasses.
AndrewDMontgomery #4875 -
Prepend
warning:to error messages so that they show in Xcode.
whiteio #4923 -
The
attributesrule received a new boolean optionattributes_with_arguments_always_on_line_abovewhich istrueby default. Setting it tofalseensures that attributes with arguments like@Persisted(primaryKey: true)don't violate the rule if they are on the same line with the variable declaration.
SimplyDanny #4843 -
Add new
unhandled_throwing_taskrule that triggers when a Task with an implicit error type has unhandled trys or errors thrown inside its body. This results in errors being silently discarded, which may be unexpected. See this forum thread for more details.
kylebshr
Bug Fixes
-
Fix
lower_acl_than_parentrule rewriter by preserving leading whitespace.
SimplyDanny #4860 -
Ignore block comments in
let_var_whitespacerule.
SimplyDanny #4871 -
Fix false positives in
indentation_widthrule.
Sven Münnich -
Do not trigger
reduce_booleanonreducemethods with a first named argument that is different frominto.
SimplyDanny #4894 -
Work around dyld warning about duplicate SwiftSyntax classes.
keith #4782 -
Improve lint times of SwiftLintPlugin by moving the
excludedPaths(fileManager:)operation out of the linting iterations.
andyyhope #4844
0.51.0: bzllint
Breaking
-
Deprecate the
unused_capture_listrule in favor of the Swift compiler warning. At the same time, make it an opt-in rule.
Cyberbeni #4656 -
Deprecate the
inert_deferrule in favor of the Swift compiler warning. At the same time, make it an opt-in rule.
SimplyDanny #4615 -
Interpret strings in
excludedoption ofidentifier_name,type_nameandgeneric_type_namerules as regular expression. Existing configurations should remain working without notice as long as they don't contain characters that must be escaped in regular expression.
Moly #4655
Experimental
- None.
Enhancements
-
Add
duplicate_conditionsrule which warns when a condition is duplicated in separate branches of the same branching statement (if-else, or switch).
1in1 #4666 -
Add local links to rule descriptions to every rule listed in
Rule Directory.md.
kattouf -
Make forceExclude work with directly specified files.
jimmya #4609 -
Adds
allpseudo-rule foropt_in_rules- enables all opt in rules that are not listed indisabled_rules.
Martin Redington #4540 -
Separate analyzer rules as an independent section in the rule directory of the reference.
Ethan Wong #4664 -
Add rule identifier to output of Emoji reporter.
SimplyDanny #4707 -
Add new
direct_returnrule that triggers onreturnstatements returning variables that have been declared in the statement before only.
SimplyDanny -
Add
period_spacingopt-in rule that checks periods are not followed by 2 or more spaces in comments.
Julioacarrettoni #4624 -
Allow to pass a rule identifier to the
swiftlint docscommand to open its specific documentation website, e.g.swiftlint docs for_where.
SimplyDanny #4707 -
Allow new Quick APIs
aroundEachandjustBeforeEachforquick_discouraged_call.
David Steinacher #4626 -
Add
relative-pathreporter to generate reports with relative file paths.
Roya1v #4660 -
Let
number_separatorrule trigger on misplaced separators, e.g.10_00.
SimplyDanny #4637 -
Rewrite
multiline_argumentsrule using SwiftSyntax, ignoring trailing closures.
Marcelo Fabri #3399 #3605 -
Speed up linting by up to 6% updating to use a newer version of
SwiftSyntax.
JP Simard -
Catch more valid
legacy_multipleviolations.
JP Simard -
Catch more valid
no_magic_numbersviolations.
JP Simard -
Add
blanket_disable_commandrule that checks whether rules are re-enabled after being disabled.
Martin Redington #4731 -
Add
invalid_swiftlint_commandrule that validates// swiftlint:enableanddisablecommands.
Martin Redington #4546 -
Improve
identifier_namedocumentation.
Martin Redington #4767 -
Adds
include_multiline_stringsoption toindentation_widthrule.
Martin Redington #4248 -
Adds a new
summaryreporter, that displays the number of violations of each rule in a text table.
Martin Redington
Bug Fixes
-
Report violations in all
<scope>_lengthrules when the error threshold is smaller than the warning threshold.
SimplyDanny #4645 -
Consider custom attributes in
attributesrule.
SimplyDanny #4599 -
Fix whitespaces issue in auto-fix of
redundant_optional_initializationrule when multiple variable declaration are involved.
SimplyDanny #4794 -
Stop triggering
strict_fileprivaterule on symbols implementing a protocol in the same file.
SimplyDanny #4692 -
Fix false positives on
private_subjectrule when using subjects inside functions.
Marcelo Fabri #4643 -
Fix for compiler directives masking subsequent
opening_braceviolations.
Martin Redington #3712 -
Rewrite
explicit_type_interfacerule with SwiftSyntax fixing a false-positive in if-case-let statements.
SimplyDanny #4548 -
Stop triggering
unused_capture_liston captured variable that is only referenced by a shorthand optional binding (if let capturedVar { ... }).
SimplyDanny #4804 -
Ensure that negative literals in initializers do not trigger
no_magic_numbersrule.
SimplyDanny #4677 -
Fix caching of
indentation_widthrule.
SimplyDanny #4121 -
Updated JUnit reporter to output error count and warning count.
patricks #4725 -
Fix correction on
lower_acl_than_parentrule foropendeclarations.
Marcelo Fabri #4753 -
Fix
void_returnrule to support async and async throws functions.
Mathias Schreck #4772 -
Fix false positives in
attributesrule when using property wrappers with keypath arguments.
JP Simard -
Fix for
superfluous_disable_commandnot being completely disabled bydisablecommands.
Martin Redington #4788 -
Fixed correction for
trailing_commarule wrongly removing trailing comments.
Martin Redington #4814
0.50.3: Bundle of Towels
Breaking
- None.
Experimental
- None.
Enhancements
-
The
SwiftLintPluginSwiftPM plugin now uses a prebuilt binary on macOS.
Tony Arnold JP Simard #4558 -
Don't trigger
shorthand_operatorviolations inside a shorthand operator function declaration.
Marcelo Fabri #4611 -
The
balanced_xctest_lifecycle,single_test_class,empty_xctest_methodandtest_case_accessibilityrules will now be applied to subclasses ofQuickSpec, as well asXCTestCase, by default.
Martin Redington -
Add
test_parent_classesoption tobalanced_xctest_lifecycle,single_test_classandempty_xctest_methodrules.
Martin Redington #4200 -
Show warnings in the console for Analyzer rules that are listed in the
opt_in_rulesconfiguration section.
SimplyDanny #4612
Bug Fixes
-
Fix configuration parsing error in
unused_declarationrule.
SimplyDanny #4612 -
Skip
deferstatements being last in an#ifblock if the#ifstatement is not itself the last statement in a block.
SimplyDanny #4615 -
Fix false positives in
empty_enum_argumentswhen the called expression is an identifier or an init call.
Steffen Matthischke #4597 -
Fix correction issue in
commawhen there was too much whitespace following the comma.
JP Simard
0.50.1: Artisanal Clothes Pegs Fixup Edition
Breaking
- None.
Experimental
- None.
Enhancements
-
Moved the validation of doc comments in local scopes out of
orphaned_doc_commentand into a new opt-inlocal_doc_commentrule.
JP Simard #4573 -
SwiftLint's Swift Package Build Tool Plugin will now only scan files in the target being built.
Tony Arnold #4406
Bug Fixes
-
Fix building with
swift build -c release.
JP Simard #4559 #4560 -
Fix false positives in
lower_acl_than_parentwhen the nominal parent is an extension.
Steffen Matthischke #4564 -
Fix
minimum_fraction_lengthhandling innumber_separator.
JP Simard #4576 -
Fix false positives in
closure_spacing.
JP Simard #4565 #4582 -
Fix line count calculation for multiline string literals.
JP Simard #4585 -
Fix false positives in
unused_closure_parameterwhen using identifiers with backticks.
JP Simard #4588 -
Fix
type_nameregression where names with backticks would trigger violations.
JP Simard #4571
0.50.0: Artisanal Clothes Pegs
Breaking
-
SwiftLint now requires Swift 5.7 or higher to build.
JP Simard -
Exclude
weak_delegaterule from autocorrection due to behavioral changes leading to potential undefined behavior or bugs.
SimplyDanny #3577 -
The
anyobject_protocolrule is now deprecated and will be completely removed in a future release because it is now handled by the Swift compiler.
JP Simard -
Built-in SwiftLint rules are no longer marked as
publicin SwiftLintFramework. This only impacts the programmatic API for the SwiftLintFramework module.
JP Simard
Experimental
- None.
Enhancements
-
SwiftSyntax libraries have been updated from the previous 5.6 release and now use the new parser written in Swift. Swift 5.7+ features should now be parsed more accurately. We've also measured an improvement in lint times of up to 15%. This should also fix some deployment issues where the exact version of the internal SwiftSyntax parser needed to be available. If you notice any unexpected changes to lint results, please file an issue on the SwiftLint issue tracker. We can look into it and if it's a SwiftSyntax parser regression we can re-file it upstream.
JP Simard #4031 -
Rewrite some rules with SwiftSyntax, fixing some false positives and catching more violations:
anonymous_argument_in_multiline_closurearray_initattributesbalanced_xctest_lifecycleblock_based_kvoclass_delegate_protocolclosing_braceclosure_body_lengthclosure_parameter_positioncollection_alignmentcomment_spacingcomputed_accessors_orderconditional_returns_on_newlinecontains_over_filter_countcontains_over_filter_is_emptycontains_over_first_not_nilcontains_over_range_nil_comparisonconvenience_typedeployment_targetdiscarded_notification_center_observerdiscouraged_assertdiscouraged_direct_initdiscouraged_none_namediscouraged_object_literaldiscouraged_optional_booleanduplicate_enum_casesduplicated_key_in_dictionary_literaldynamic_inlineempty_collection_literalempty_countempty_enum_argumentsempty_parametersempty_parentheses_with_trailing_closureempty_stringenum_case_associated_values_countexplicit_enum_raw_valueexplicit_initexplicit_top_level_aclfallthroughfile_namefirst_whereflatmap_over_map_reducefor_whereforce_tryforce_unwrappingfunction_body_lengthfunction_default_parameter_at_endfunction_parameter_countgeneric_type_nameibinspectable_in_extensionidentical_operandsimplicit_getterimplicitly_unwrapped_optionalinclusive_languageinert_deferis_disjointjoined_default_parameterlarge_tuplelast_wherelegacy_cggeometry_functionslegacy_constantlegacy_constructorlegacy_hashinglegacy_multiplelegacy_nsgeometry_functionslegacy_objc_typelegacy_randomlower_acl_than_parentmultiline_arguments_bracketsmultiline_parametersmultiple_closures_with_trailing_closureno_extension_access_modifierno_fallthrough_onlyno_space_in_method_callnotification_center_detachmentnslocalizedstring_keynslocalizedstring_require_bundlensobject_prefer_isequalnumber_separatorobject_literaloperator_whitespaceoptional_enum_case_matchingorphaned_doc_commentoverridden_super_calloverride_in_extensionpattern_matching_keywordsprefer_nimbleprefer_self_in_static_referencesprefer_self_type_over_type_of_selfprefer_zero_over_explicit_initprefixed_toplevel_constantprivate_actionprivate_outletprivate_over_fileprivateprivate_subjectprivate_unit_testprohibited_interface_builderprohibited_super_callprotocol_property_accessors_orderquick_discouraged_focused_testquick_discouraged_pending_testraw_value_for_camel_cased_codable_enumreduce_booleanreduce_intoredundant_discardable_letredundant_nil_coalescingredundant_objc_attributeredundant_optional_initializationredundant_set_access_controlredundant_string_enum_valuerequired_deinitrequired_enum_casereturn_arrow_whitespaceself_in_property_initializationshorthand_operatorsingle_test_classsorted_first_laststatic_operatorstrict_fileprivatestrong_iboutletswitch_case_alignmentswitch_case_on_newlinetest_case_accessibilitytoggle_booltrailing_commatrailing_semicolontype_body_lengthtype_nameunneeded_break_in_switchunneeded_parentheses_in_closure_argumentunowned_variable_captureuntyped_error_in_catchunused_capture_listunused_closure_parameterunused_control_flow_labelunused_enumeratedunused_optional_bindingunused_setter_valuevalid_ibinspectablevertical_parameter_alignmentweak_delegatexct_specific_matcherxctfail_message
-
The "body length" family of rules have changed how they calculate body line count to be significantly more correct and intuitive. However, this is likely to require adjustments to your configuration or disable commands to account for the changes.
JP Simard -
Add ability to filter rules for
generate-docssubcommand.
kattouf -
Add new
excludes_trivial_initconfiguration formissing_docsrule to exclude initializers without any parameters.
Marcelo Fabri #4107 -
Add new
ns_number_init_as_function_referencerule to catchNSNumber.initandNSDecimalNumber.initbeing used as function references since it can cause the wrong initializer to be used, causing crashes. See this Swift issue for more info.
Marcelo Fabri -
Add
accessibility_trait_for_buttonrule to warn if a SwiftUI View has a tap gesture added to it without having the button or link accessibility trait.
Ryan Cole -
Add methods from SE-0348 to
UnusedDeclarationRule.
JP Simard -
Include the configured
bind_identifierinself_bindingviolation messages.
JP Simard -
The
self_bindingrule now catches shorthand optional bindings (for exampleif let self {}) when using abind_identifierdifferent thanself.
Marcelo Fabri -
Add
library_content_providerfile type tofile_types_orderrule to allowLibraryContentProviderto be ordered independent frommain_type.
dahlborn -
Add
test_parent_classesoption totest_case_accessibilityrule, which allows detection in subclasses of XCTestCase.
Martin Redington #4200 -
Add a new
shorthand_optional_bindingopt-in rule that triggers in Swift 5.7 when a shadowing optional binding is created in aniforguardstatement.
SimplyDanny #4202 -
Use SwiftSyntax instead of SourceKit to determine if a file has parser errors before applying corrections. This speeds up corrections significantly when none of the rules use SourceKit.
JP Simard -
Add Swift Package Build Tool Plugin with support for Swift Packages and Xcode projects.
Johannes Ebeling #3679 #3840 -
Make
private_unit_testrule correctable.
SimplyDanny -
Disregard whitespace differences in
identical_operandsrule. That is, the rule now also triggers if the left-hand side and the right-hand side of an operation only differ in trivia.
SimplyDanny -
Print violations in realtime if
--progressand--outputare both set.
JP Simard -
Trigger
prefer_self_in_static_referencesrule on more type references like:- Key paths (e.g.
\MyType.myVar->\Self.myVar) - Computed properties (e.g.
var i: Int { MyType.myVar )->var i: Int { Self.myVar }) - Constructor calls (e.g.
MyType()->Self())
- Key paths (e.g.
-
Update
for_whererule, adding a new configurationallow_for_as_filterto allow usingfor inwith a singleifinside when there's areturnstatement inside theif's body.
Marcelo Fabri #4040 -
quick_discouraged_call,quick_discouraged_focused_testandquick_discouraged_pending_testrules now trigger on subclasses ofQuickSpec.
Marcelo Fabri #4420 -
The
type_namerule now validates protocol declarations by default. You can opt-out by using thevalidate_protocolskey in your configuration:type_name: validate_protocols: false -
Report how much memory was used when
--benchmarkis specified.
JP Simard -
Adds
NSErrorto the list of types indiscouraged_direct_init.
jszumski #4508 -
Fix SwiftLint support on Xcode Cloud.
JagCesar westerlund #4484 -
Add
no_magic_numbersrule to avoid "Magic Numbers".
Henrik Storch #4031 -
Add new option
only_enforce_before_trivial_linestovertical_whitespace_closing_bracesrule. It restricts the rule to apply only before trivial lines (containing only closing braces, brackets and parentheses). This allows empty lines before non-trivial lines of code (e.g. if-else-statements).
benjamin-kramer #3940
Bug Fixes
-
Respect
validates_start_with_lowercaseoption when linting function names.
Chris Brakebill #2708 -
Do not report variables annotated with
@NSApplicationDelegateAdaptorand@WKExtensionDelegateAdaptorinweak_delegaterule.
Till Hainbach #3598 #3611 -
Fix false-positives related to the
willMovelifecycle method intype_contents_orderrule.
SimplyDanny #3478 -
Do no longer autocorrect usage of
NSIntersectionRectinlegacy_nsgeometry_functionsrule.
SimplyDanny #3703 -
Fix Analyzer rules in Xcode 14.
SimplyDanny #4208 -
Add column for SourceKit usage to
rulescommand.
JP Simard -
Make
nsobject_prefer_isequalrule work for nested@objcclasses. Also consider the@objcMembersannotation.
SimplyDanny -
Print fixed content at most once to STDOUT.
SimplyDanny #4211 -
Fix fatal error when content given via STDIN is corrected in the
trailing_newlinerule.
SimplyDanny #4234 -
Fix false-positives from
multiline_arguments_bracketswhen a function call has a single line trailing closure.
CraigSiemens #4510
0.49.1: Buanderie Principale
Note: The default branch for the SwiftLint git repository was renamed from
master to main on September 1st. Please update any code or automation
accordingly.
Breaking
- None.
Experimental
- None.
Enhancements
-
Add new
self_bindingopt-in rule to enforce thatselfidentifiers are consistently re-bound to a common identifier name. Configurebind_identifierto the name you want to use. Defaults toself.
JP Simard #2495 -
Add
--outputoption to lint and analyze commands to write to a file instead of to stdout.
JP Simard #4048 -
Add
--progressflag to lint and analyze commands to show a live-updating progress bar instead of each file being processed.
JP Simard -
--fixnow works with--use-stdin, printing the output to STDOUT instead of crashing.
SimplyDanny #4127
Bug Fixes
-
Migrate
empty_xctest_methodrule to SwiftSyntax fixing some false positives.
SimplyDanny #3647 #3691 -
Fix false positives in
redundant_discardable_letwhen usingasync let.
Martin Hosna #4142 -
Consistently print error/info messages to stderr instead of stdout, which wasn't being done for errors regarding remote configurations.
JP Simard
0.49.0: Asynchronous Defuzzer
Note: The default branch for the SwiftLint git repository will be renamed from
master to main on September 1st. Please update any code or automation
accordingly.
Breaking
-
SwiftLint now requires Swift 5.6 or higher to build, and macOS 12 or higher to run.
JP Simard -
Code Climate reports now use SHA256 strings as the issue fingerprint values.
JP Simard -
Make
comma_inheritancean opt-in rule.
Steve Madsen #4027 -
The
autocorrectcommand that was deprecated in 0.43.0 has now been completely removed. Use--fixinstead.
JP Simard -
Remove the
AutomaticTestableRuleprotocol. All examples listed in rules are now tested automatically to make sure they are correct.
SimplyDanny -
Deprecate the
--in-process-sourcekitcommand line flag. SwiftLint now always uses an in-process SourceKit.
JP Simard
Experimental
- None.
Enhancements
-
Make
duplicate_importsrule correctable. Fixduplicate_importsrule reporting redundant violations when more than one duplicate is present.
Timofey Solonin -
Support for building SwiftLint with bazel.
JP Simard -
Support for writing custom private native rules when building with bazel.
JP Simard Keith Smiley #3516 -
Make
commarule about 10x faster, finding some previously missed cases and fixing some previously wrong corrections.
JP Simard -
Make
colonrule about 7x faster, finding some previously missed cases.
JP Simard -
Make
closure_spacingrule about 9x faster, finding some previously missed cases and fixing some previously wrong corrections.
JP Simard SimplyDanny #4090 -
Introduce new configuration option
include_compiler_directives(trueby default) for theindentation_widthrule that allows to ignore compiler directives in the indentation analysis. This is especially useful if one (or a formatter) prefers to have compiler directives always at the very beginning of a line.
SimplyDanny #4030 -
Enable (recursive) globs in
includedfile paths.
sarastro-nl -
Custom rules are now broken down per rule instead of in aggregate in
--benchmark.
JP Simard -
The
versioncommand now has an optional--verboseflag that prints out the full version info, notably the build ID, which can be used to determine if twoswiftlintexecutables are identical.
JP Simard -
Update documentation for
multiline_arguments_bracketsandmultiline_literal_bracketsto make it immediately obvious that common examples will trigger.
chrisjf #4060 -
The
--compile-commandsargument can now parse SwiftPM yaml files produced when runningswift buildat.build/{debug,release}.yaml.
JP Simard -
Add new configuration option
allowed_no_space_operatorstooperator_usage_whitespacerule. It allows to specify custom operators which shall not be considered by the rule.
imben123 -
Add new protocols to remove some boilerplate involved in writing SwiftSyntax-based rules.
JP Simard
Bug Fixes
-
Fix false positive in
self_in_property_initializationrule when using closures insidedidSetand other accessors.
Marcelo Fabri #4041 -
Fix false positive in
Duplicated Key in Dictionary Literal Violationrule when using keys that are generated at runtime with the same source code.
OrEliyahu #4012 -
Fix false positive in
yoda_conditionrule by basing it on SwiftSyntax.
SimplyDanny #4081 -
Fix false negatives in
first_whererule when filtering array of dictionaries with String keys.
KS1019 -
Fix broken correction for
explicit_initrule.
KS1019
0.48.0: Rechargeable Defuzzer
This is the last release to support building with Swift 5.5.x and running on macOS < 12.
Breaking
- Deprecate the
--pathoptions forlint/analyzecommands. Prefer the positional paths that can be added last to both commands.
SimplyDanny
Experimental
- None.
Enhancements
-
Support
iOSApplicationExtension,macOSApplicationExtension,watchOSApplicationExtension, andtvOSApplicationExtensionidentifiers in thedeployment_targetrule. To configure the rule for these identifiers, you need to use the keysiOSApplicationExtension_deployment_target,macOSApplicationExtension_deployment_target,watchOSApplicationExtension_deployment_target, andtvOSApplicationExtension_deployment_target. Extentions default to their counterparts unless they are explicitly defined.
tahabebek #4004 -
Rewrite
operator_usage_whitespacerule using SwiftSyntax, fixing false positives and false negatives.
Note that this rule doesn't catch violations around return arrows (->) anymore - they are already handled byreturn_arrow_whitespace.
Marcelo Fabri #3965 #3668 #2728 -
Support arrays for the
includedandexcludedoptions when defining a custom rule.
Marcelo Fabri -
Add back
void_function_in_ternaryopt-in rule to warn against using a ternary operator to callVoidfunctions.
Marcelo Fabri -
Support
UIEdgeInsetstype inprefer_zero_over_explicit_initrule.
KokiHirokawa #3986
Bug Fixes
-
Ignore array types in
syntactic_sugarrule if their associatedIndexis accessed.
SimplyDanny #3502 -
Prevent crash for private types named
_intype_namerules.
sinoru #3971 -
Make
for_whererule implementation independent of order in structure dictionary. This fixes the rule in Xcode 13.3 where some violation were no longer reported.
SimplyDanny #3975 -
Update result builder methods in
unused_declarationrule fixing some false-positives.
SimplyDanny -
Look for call expressions which are not wrapped into an argument when checking for nested (possibly multiline) arguments fixing some false-negatives in (at least) Xcode 13.2.
SimplyDanny #3975 -
Make sure that include paths prefixed with the name of the original path are included in the analysis.
SimplyDanny #3705 -
Do not trigger
unavailable_conditionrule if other#(un)availablechecks are involved.
SimplyDanny #3985 -
Update
nimble_operatorto support the operators forbeNil().
CraigSiemens -
Avoid false-positive in
let_var_whitespacerule by allowing custom attributes on lines directly before let/var declarations.
SimplyDanny #2980
0.47.1: Smarter Appliance
Breaking
- None.
Experimental
- None.
Enhancements
-
Add type-checked analyzer rule version of
ArrayInitRulenamedTypesafeArrayInitRulewith identifiertypesafe_array_initthat avoids the false positives present in the lint rule.
SimplyDanny #3749 -
Add the
--in-process-sourcekitcommand line flag tolintandanalyzecommands, which has the same effect as setting theIN_PROCESS_SOURCEKITenvironment variable.
Juozas Valancius -
Add a new
artifactbundlerelease asset containingswiftlintbinaries for x86 & arm64 macOS.
Juozas Valancius #3840 -
Add back
return_value_from_void_functionopt-in rule to warn against usingreturn <expression>in a function that returnsVoid.
Marcelo Fabri -
Don't skip autocorrect on files that have parser warnings. Only files with errors reported by the Swift parser will be skipped.
Marcelo Fabri #3343 -
Add
accessibility_label_for_imagerule to warn if a SwiftUI Image does not have an accessibility label and is not hidden from accessibility.
Ryan Cole -
Add
unavailable_conditionrule to prefer usingif #unavailableinstead ofif #availablewith an empty body and anelsecondition when using Swift 5.6 or later.
Marcelo Fabri #3897 -
Add
comma_inheritancerule to validate that inheritance clauses use commas instead of&.
Marcelo Fabri #3950
Bug Fixes
-
Fix false positives in
unused_closure_parameterwhen using parameters with backticks.
JP Simard #3628 -
Improved the
syntactic_sugarrule's detection accuracy and fixed some corrections leading to invalid code.
Paul Taykalo #3866 -
Fix analyzer rules with Xcode 13.3 / Swift 5.6. Note that we've measured performance regressions compared to Swift 5.5 on the order of about 2x.
JP Simard #3920 -
Error by default on bad expiring todo date formatting.
Christopher Hale #3636 -
Lint/analyze all files listed in the command even if the
--pathoption is used.
coffmark
0.47.0: Smart Appliance
Breaking
-
SwiftLint now requires Swift 5.5 or higher to build.
JP Simard -
The
SwiftLintFrameworkpodspec has been removed. To our knowledge, this was completely unused by other projects and was not worth the complexity needed to justify its continued maintenance, especially in light of the integration of SwiftSyntax. TheSwiftLintpodspec is still supported.
JP Simard -
SwiftLint now requires at least Swift 5.0 installed in order to lint files.
Marcelo Fabri
Experimental
- The
force_castrule and the comment command parsing mechanism have been updated to use SwiftSyntax instead of SourceKit. Please report any problems you encounter by opening a GitHub issue. If this is successful, more rules may use Swift Syntax in the future.
JP Simard
Enhancements
-
Empty files no longer trigger any violations.
JP Simard #3854 -
The
legacy_randomrule is now enabled by default.
Marcelo Fabri -
The
deployment_targetrule now supports the#unavailablesyntax added in Swift 5.6.
Marcelo Fabri #3896 -
Set the
IN_PROCESS_SOURCEKITenvironment variable, which will use the in-process version of sourcekitd on macOS when Xcode 13 or later is selected. This avoids the use of XPC, which is prohibited in some sandboxed environments, such as in Swift Package Manager plugins.
Juozas Valancius -
Add ability to run only one (focused) example.
PaulTaykalo #3911
Bug Fixes
-
Extend
class_delegate_protocolto correctly identify cases with the protocol body opening brace on a new line.
Tobisaninfo -
Fix SwiftLint.pkg installer installing multiple copies of SwiftLint.
JP Simard #3815 #3887
0.46.5: Laundry Studio
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Fix
empty_parentheses_with_trailing_closurerule when using Swift 5.6.
Marcelo Fabri #3846 -
Fix false negatives in
closure_parameter_positionrule with Swift 5.6.
Marcelo Fabri #3845 -
Fix regression in
last_whererule when using Swift 5.6.
Marcelo Fabri #3847 -
Fix regression in
unused_importrule when using Swift 5.6.
JP Simard #3849 -
Fix regression in
trailing_closurerule when using Swift 5.6.
Marcelo Fabri #3848
0.46.4: Detergent Tray
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Ignore meta class types in
prefer_self_in_static_referencesrule.
SimplyDanny #3804 -
Ignore MARK in multiline comment, fixing cases that would previously crash or produce invalid results when correcting.
goranche #1749 #3841 -
Fix false positive in
EmptyEnumArgumentsRulerule when using Swift 5.6.
Marcelo Fabri #3850
0.46.3: Detergent Spill
Breaking
- None.
Experimental
- None.
Enhancements
- Change fingerprint generation in
CodeClimateReporter.swiftto use the relative file path to better support CI/CD on multiple machines.
HA Pors
Bug Fixes
-
Fix crash in the
closure_end_indentationrule when linting with Swift 5.6.
JP Simard #3830 -
Fix default rules section in documentation.
Natan Rolnik #3857
0.46.2: Detergent Package
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Fix SwiftLint.pkg installer on macOS 11 or later.
JP Simard #3815 -
Ignore
prefer_self_in_static_referencesrule in extensions generally.
SimplyDanny #3775 -
Fix
class_delegate_protocolfalse positives when usingwhereclause.
Steven Magdy
0.46.1: Detergent Container
Breaking
Experimental
- None.
Enhancements
-
Official Docker images are now available. See the Docker section of the README for usage instructions.
Francisco Javier Trujillo Mata -
Allow
unused_setter_valuefor overrides.
Adrian Debbeler #2585
Bug Fixes
-
Fix
convenience_typefalse positives when using actors.
JP Simard #3770 -
Fix false positives in the
prefer_self_in_static_referencesrule.
SimplyDanny #3768 -
Fix the regex for expiring TODO comments.
Sergei Shirokov #3767 -
Fix crash when parsing multi-line attributes with the
attributesrule.
JP Simard #3761 -
Fix false positives in
unused_closure_parameterwhen using list element bindings in SwiftUI.
Paul Williamson #3790 -
Fix the cache path not being properly set when using nested configurations.
Andrés Cecilia Luque
0.45.1: Clothes Drying Hooks
Breaking
- None.
Experimental
- None.
Enhancements
-
Update Rule list documentation to distinguish between opt-in and on-by-default rules.
Benny Wong -
Add opt-in
prefer_self_in_static_referencesrule to warn if the type name is used to reference static members the same type. Prefer usingSelfinstead which is not affected by renamings.
SimplyDanny -
Add support for running SwiftLint as a pre-commit hook.
Jesse Crocker Hannes Ljungberg
Bug Fixes
-
Fix
unused_importrule incorrectly consideringSwiftShimsas a used import.
JP Simard -
Fix false positives on
large_tuplerule when usingasyncclosures.
Kaitlin Mahar #3753 -
Fix false positive on
legacy_objc_typerule when using types with names that start with a legacy type name.
Isaac Ressler #3555
0.45.0: Effectful Apparel
Breaking
- SwiftLint now requires Swift 5.4 or higher to build.
JP Simard
Experimental
- None.
Enhancements
-
Add
self_in_property_initializationrule to catch uses ofselfinside an inline closure used for initializing a variable. In this case,selfrefers to theNSObject.selfmethod and likely won't be what you expect. You can make the variablelazyto be able to refer to the current instance withselfor useMyClass.selfif you really want to reference the method.
Marcelo Fabri -
Exclude
idfromidentifier_nameby default.
Artem Garmash #3651 -
Handle
get asyncandget throws(introduced in Swift 5.5) in theimplicit_getterrule.
Marcelo Fabri #3684 -
Speed up explicit type interface rule.
PaulTaykalo #3745 -
Speed up analyzer rules.
PaulTaykalo #3747
Bug Fixes
-
Fix a bug with the
missing_docsrule whereexcludes_inherited_typeswould not be set.
Ben Fox -
Fix redundant_optional_initialization autocorrect broken in case observer's brace exists.
Naruki Chigira #3718 -
Fix a false positive in the
unneeded_break_in_switchrule when usingdo/catch.
Marcelo Fabri #3724 -
Speed up Computed Accessors Order rule.
PaulTaykalo #3727 -
[Colon Rule] Fix case when comment is used in function call.
PaulTaykalo #3740
0.44.0: Travel Size Lint Roller
Breaking
- SwiftLint now requires Swift 5.3 or higher to build.
JP Simard
Experimental
- None.
Enhancements
-
Add configuration options to
missing_docsrule:excludes_extensionsdefaults totrueto skip reporting violations for extensions with missing documentation comments.excludes_inherited_typesdefaults totrueto skip reporting violations for inherited declarations, like subclass overrides.
-
Fix false negative on
redundant_optional_initializationrule when variable has observers.
Isaac Ressler #3621 -
Make
test_case_accessibilityrule identify invalid test functions with parameters.
Keith Smiley #3612 -
Add
duplicated_key_in_dictionary_literalrule to warn against duplicated keys in dictionary literals.
Marcelo Fabri -
Fix the rule name from "Colon" to "Colon Spacing" to improve phrasing.
Radu #3587 -
Add
discouraged_none_nameopt-in rule to discourage naming cases and static/class members "none", which can conflict with Swift'sOptional<T>.nonewhen checking equality.
Kane Cheshire #3624 -
Improve language and positioning of
file_lengthwarnings whenignore_comment_only_lines: true.
Steven Grosmark #3654 -
Add
anonymous_argument_in_multiline_closureopt-in rule to validate that named arguments are used in closures that span multiple lines.
Marcelo Fabri
Bug Fixes
-
Fix false positives in
empty_enum_argumentsrule when comparing values with a static member (e.g.if number == .zero).
Marcelo Fabri #3562 -
Fix
type_contents_orderinitializer detection.
StevenMagdy -
Fix autocorrect when there's no space between the tuple the
inkeyword onunneeded_parentheses_in_closure_argumentrule.
p-x9 #3633 -
Fix
unused_capture_list,empty_enum_arguments,implicit_returnandexplicit_type_interfacerules when using Swift 5.4.
Marcelo Fabri #3615 #3685 -
Fix Xcode build logs with spaces in paths preventing
analyzefrom running.
adamawolf
0.43.1: Laundroformat
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Re-add
--formatflag to reformat Swift files using SourceKit. Only applied with--fix/--autocorrect.
JP Simard #3571
0.43.0: Clothes Line Interface
Breaking
-
The command line syntax has slightly changed due to migrating from the Commandant command line parsing library to swift-argument-parser. For the most part the breaking changes are all to make the syntax more unix compliant and intuitive to use. For example, commands such as
swiftlint --helporswiftlint -hnow work as expected. The help output from various commands has greatly improved as well. Notably:swiftlint autocorrectwas removed in favor ofswiftlint --fix. Previous commands should continue to work temporarily to help with the transition. Please let us know if there's a command that no longer works and we'll attempt to add a bridge to help with its transition.
JP Simard -
Configuration files now consistently have their
included/excludedrelative file paths applied relative to their location in the file system. Previously the root configuration file applied these relative to the current working directory, but nested configurations applied these to their location in the file system.
Frederick Pietschmann JP Simard -
The
discarded_notification_center_observeris now opt-in due to some difficult to resolve false positives, such as #3498.
JP Simard
Experimental
- None.
Enhancements
-
Added
allows_single_lineoption inmultiline_parametersrule configuration. Defaults totrue. This enforces parameters in a method with multiple parameters to always be in different lines.
Otavio Cordeiro -
Support relative paths in compilation databases for SwiftLint analyzer rules.
JP Simard -
Add opt-in rule
discouraged_assertto encourage the use ofassertionFailure()and/orpreconditionFailure()overassert(false).
Otavio Cordeiro -
Adds
balanced_xctest_lifecycleopt-in rule to enforce balancedsetUpandtearDownmethods in a test class.
Otavio Cordeiro #3452 -
Tweak the auto-correction result console output for clarity.
mokagio #3522 -
Allow configuring related USRs to skip in UnusedDeclarationRule by specifying a list of USRs in the
related_usrs_to_skipkey. For example you might have custom source tooling that does something with types conforming to a procotol even if that type is never explicitly referenced by other code.
JP Simard -
Make
strong_iboutletrule correctable.
MaxHaertwig -
Add
legacy_objc_typeopt-in rule to warn against using bridged Objective-C reference types instead of Swift value types.
Blake #2758 -
Support Swift Playground control comments in the
comment_spacingrule.
Thomas Goyne -
[Internal] Integrate OS Signposts to help profile SwiftLint performance.
jpsim -
Update CodeClimateReporter to produce relative paths.
bmwalters -
Add Bool violation reporting in
redundant_type_annotation.
Artem Garmash #3423 -
Add a new
capture_variableanalyzer rule to warn about listing a non-constant (var) variable in a closure's capture list. This captures the variable's value at closure creation time instead of closure call time, which may be unexpected.
Laszlo Kustra -
Log references to a specified module when running the
unused_importby setting theSWIFTLINT_LOG_MODULE_USAGE=<module-name>environment variable when running analyze.
jpsim -
Add opt-in rule
private_subjectrule which warns against public Combine subjects.
Otavio Cordeiro
Bug Fixes
-
Fix
custom_rulesmerging when the parent configuration is based ononly_rules.
Frederick Pietschmann #3468 -
Fix misleading warnings about rules defined in the
custom_rulesnot being available (when using multiple configurations).
Frederick Pietschmann #3472 -
Fix bug that prevented the reconfiguration of a custom rule in a child config.
Frederick Pietschmann #3477 -
Fix typos in configuration options for
file_namerule.
advantis -
Fix issue that prevented the inclusion of a configuration file from a parent folder.
Frederick Pietschmann #3485 -
Fix violation location and misplaced corrections for some function references in
explicit_selfrule.
JP Simard -
Fix false positives with result builders in
unused_declaration.
JP Simard -
Find more unused declarations in
unused_declaration.
JP Simard -
Fix parsing xcode logs for analyzer rules for target names with spaces.
JP Simard #3021
0.42.0: He Chutes, He Scores
Breaking
-
SwiftLint now requires Swift 5.2 or higher to build.
JP Simard -
SwiftLintFramework can no longer be integrated as a Carthage dependency.
JP Simard #3412 -
SwiftLint.xcworkspaceandSwiftLint.xcprojecthave been completely removed. You can still use Xcode to develop SwiftLint by opening it as a Swift Package by typingxed .orxed Package.swiftfrom your shell.
JP Simard #3412 -
Renamed
statement_leveltofunction_levelinnestingrule configuration.
Skoti -
Separated
type_levelandfunction_levelcounting innestingrule.
Skoti #1151 -
function_levelinnestingrule defaults to 2 levels.
Skoti -
Added
check_nesting_in_closures_and_statementsinnestingrule to search for nested types and functions within closures and statements. Defaults totrue.
Skoti -
Renamed
OverridenSuperCallConfigurationtoOverriddenSuperCallConfiguration.
Bryan Ricker #3426
Experimental
- None.
Enhancements
-
Don't report
@UIApplicationDelegateAdaptorstatements inweak-delegaterule.
Richard Turton #3286 -
Don't report
unavailable_functionviolations for functions returningNever.
Artem Garmash #3286 -
Added
always_allow_one_type_in_functionsoption innestingrule configuration. Defaults tofalse. This allows to nest one type within a function even if breaking the maximumtype_level.
Skoti #1151 -
Add option to specify a
child_config/parent_configfile (local or remote) in any SwiftLint configuration file. Allow passing multiple configuration files via the command line. Improve documentation for multiple configuration files.
Frederick Pietschmann #1352 -
Add an
always_keep_importsconfiguration option for theunused_importrule.
Keith Smiley -
Add
comment_spacingrule.
Noah Gilmore #3233 -
Add
codeclimatereporter to generate JSON reports in codeclimate format. Could be used for GitLab Code Quality MR Widget.
jkroepke #3424 -
Add an
override_allowed_termsconfiguration parameter to theinclusive_languagerule, with a default value ofmastercard.
Dalton Claybrook #3415
Bug Fixes
- Remove
@IBOutletand@IBInspectablefrom UnusedDeclarationRule.
Keith Smiley #3184
0.41.0: World’s Cleanest Voting Booth
Breaking
-
Changed behavior of
strictoption onlintandanalyzeto treat all warnings as errors instead of only changing the exit code.
Jeehut #3312 -
Removed the
unneeded_notification_center_removalrule because it was based on an incorrect premise.
JP Simard #3338 -
The
whitelist_rulesconfiguration key has been renamed toonly_rules.
Dalton Claybrook
Experimental
- None.
Enhancements
-
Add
use-alternative-excludingoption to speed up linting in cases described in #3325. This option yields different exclusion behavior.
JohnReeze #3304 -
Add
test_case_accessibilityrule.
Keith Smiley #3376 -
Remove
@IBOutletand@IBInspectablefrom UnusedDeclarationRule.
Keith Smiley #3184 -
Add
allow_multiline_funcconfiguration option toopening_bracerule, to allow placing{on new line in case of multiline function. Defaults tofalse.
Zsolt Kovács #1921 -
Update the
nslocalizedstring_keyrule to validate thecommentargument in addition to thekeyargument.
Dalton Claybrook #3334 -
Add
inclusive_languagerule to encourage the use of inclusive language that avoids discrimination against groups of people.
Dalton Claybrook -
Add
prefer_nimbleopt-in rule to encourage using Nimble matchers over the XCTest ones.
Marcelo Fabri #3293 -
unused_closure_parameterrule now validates closures outside of function calls.
Marcelo Fabri #1082 -
Improve documentation for running SwiftLint as Xcode build phase.
Christian Mitteldorf #3169 -
Add
skip_aligned_constants(defaults totrue) andlines_look_around(defaults to2) configuration parameters to theoperator_usage_whitespacerule.
Paul Taykalo #3388
Bug Fixes
-
Fix parsing of Xcode 12 compiler logs for analyzer rules.
JP Simard #3365 -
Fix some SwiftUI unused declaration rule false positives.
JP Simard #3365 -
Fix some false positives in rule
explicit_self.
Sven Münnich -
Fix incorrect autocorrection in
prefer_zero_over_explicit_initrule.
Paul Taykalo -
Rule
unused_capture_listshould not be triggered by unowned self keyword.
hank121314 #3389 -
Fix severity configuration for
indentation_width.
Samasaur1 #3346 -
Fix DuplicateImportsRule's support for import attributes.
Keith Smiley #3402 -
Allow "allowed symbols" as first character in
identifier_name.
JP Simard #3306 -
Fix false positives with parameterized attributes in
attributes.
JP Simard #3316 -
Fix some missed cases in rule
unavailable_function.
Quinn Taylor #3374 -
Fix incorrect violation message for line length violations.
JP Simard #3333 -
Fix inconsistency in
operator_usage_whitespacerule.
Paul Taykalo #3321 -
Fix false positives in
convenience_typerule for types that cannot be converted to enums.
ZevEisenberg #3033 -
Fix finding a nested config when a single file path is passed.
Seth Friedman -
Fix incorrect calculation of the root path when a directory in the tree is passed in as a path argument.
Seth Friedman #3383 -
Fix rare false positive in
toggle_boolrule.
Marcelo Fabri #3398
0.40.3: Greased Up Drum Bearings
Breaking
- None.
Experimental
- None.
Enhancements
-
Make the
unused_declarationrule run 3-5 times faster, and enable it to detect more occurrences of unused declarations.
JP Simard -
Remove unneeded internal locking overhead, leading to increased performance in multithreaded operations.
JP Simard -
Skip correcting file if the swift parser reports a warning or an error.
JP Simard #3343
Bug Fixes
-
Rule
unused_capture_listshould not be triggered by self keyword.
hank121314 #2367 -
Rule
multiple_closures_with_trailing_closureno longer triggers when Swift 5.3's 'multiple trailing closures' feature is used.
Jumhyn #3295
0.40.2: Demo Unit
Breaking
- None.
Experimental
- None.
Enhancements
-
Improve description for
empty_enum_arguments.
Lukas Schmidt -
Add support for
excluded_match_kindscustom rule config parameter.
Ryan Demo
Bug Fixes
- None.
0.40.1: A Baffling Response
Breaking
- None.
Experimental
- None.
Enhancements
- Add support for params files for file paths.
keith
Bug Fixes
0.40.0: Washable Mask
Breaking
-
SwiftLint now requires Swift 5.1 or higher to build.
JP Simard -
Improve compile commands json file validation. If you previously provided invalid files or arguments, the command will now abort.
Keith Smiley
Experimental
- None.
Enhancements
-
JUnit reporter for GitLab artifact:report:junit with better representation of found issues.
krin-san #3177 -
Add opt-in
ibinspectable_in_extensionrule to lint against@IBInspectableproperties inextensions.
Keith Smiley -
Add
computed_accessors_orderrule to validate the order ofgetandsetaccessors in computed properties and subscripts.
Marcelo Fabri #3158 -
Extend
empty_enum_argumentsrule to supportif caseandguard case.
Zsolt Kovács #3103 -
Add
prefer_zero_over_explicit_initopt-in rule to enforce using.zeroinstead of calling constructor with zero arguments (e.g.CGPoint(x: 0, y: 0)) when using CoreGraphics types.
Anton Nazarov #3190 -
Add
swiftlint docscommand to easily open online documentation.
417-72KI -
Add
unneeded_notification_center_removalrule to warn against usingNotificationCenter.removeObserver(self)indeinitsince it's not required after iOS 9/macOS 10.11.
Amzd #2755
Bug Fixes
-
Fix UnusedImportRule breaking transitive imports.
keith -
Fix severity level configuration for
duplicate_imports.
Yusuke Goto -
Fixes false positives for
multiline_parameters_bracketsandmultiline_arguments_brackets.
Noah Gilmore #3167 -
Fix conflict of 'opening_brace' with 'implicit_return' for functions implicitly returning a closure.
SimplyDanny #3034 -
Fix false positive on
switch_case_on_newlinerule withdo/catchstatements when using Swift 5.3.
Marcelo Fabri #3253 -
Fix false positive uppercase enum case in
raw_value_for_camel_cased_codable_enumrule.
Teameh -
Fix false positive in
no_space_in_method_callrule with multiple trailing closures (Swift 5.3).
Marcelo Fabri #3259 -
Fix false negative in
explicit_aclrule when usingextensionwith Swift 5.2+.
Marcelo Fabri #3186 -
closure_parameter_positionnow triggers in closures that are not inside a function call and also validates captured variables.
Marcelo Fabri #3225 -
Fix some cases where the output would be incomplete when running SwiftLint on Linux.
Marcelo Fabri #3214 -
compiler_protocol_initnow triggers onIndexSet(arrayLiteral:).
Janak Shah #3284 -
Fix false positives in
extension_access_modifierrule when using Swift 5.2.
Marcelo Fabri #3150
0.39.2: Stay Home
This is the last release to support building with Swift 5.0.x.
Breaking
- None.
Experimental
- None.
Enhancements
- Add configuration options to the
unused_importrule to require explicit import statements for each module referenced in a source file (require_explicit_imports). When this setting is enabled, anallowed_transitive_importssetting may also be specified to allow a mapping of modules to transitively imported modules. See the PR for details.
JP Simard #3116
Bug Fixes
-
Fix more false positives in
implicit_getterrule in extensions when using Swift 5.2.
Marcelo Fabri #3149 -
Fix false positives in
redundant_objc_attributerule in extensions when using Swift 5.2.
Marcelo Fabri -
Fix false positives in
attributesrule when usingrethrowsusing Swift 5.2.
JP Simard -
Fix false positives in
valid_ibinspectablerule when defining inspectable properties in class extensions with computed properties using Swift 5.2.
JP Simard
0.39.1: The Laundromat has a Rotating Door
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_comparisonreturn_value_from_void_functiontuple_patternvoid_function_in_ternary
Experimental
- None.
Enhancements
- None.
Bug Fixes
- Fix unused_import rule reported locations and corrections when
multiple
@testableimports are involved.
JP Simard
0.39.0: A Visitor in the Laundromat
Breaking
-
Replace all uses of
Int/Int64/NSRangerepresenting byte offsets to use newly introducedByteCountandByteRangevalues 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 #2608 -
Add
deinitializertype content totype_contents_orderrule 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
SyntaxRulethat enables writing rules using SwiftSyntax.
Marcelo Fabri -
Add
tuple_patternopt-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_functionopt-in rule to warn against usingreturn <expression>in a function that isVoid.
Marcelo Fabri -
Add
void_function_in_ternaryopt-in rule to warn against using a ternary operator to callVoidfunctions.
Marcelo Fabri #2358 -
Add
only_after_dotconfiguration option toempty_countrule. With the option enabled,empty_countrule will ignore variables namedcount. By default, this option is disabled.
Zsolt Kovács #827 -
Add
prohibited_nan_comparisonopt-in rule to validate usingisNaNinstead of comparing values to the.nanconstant.
Marcelo Fabri #2086 -
Add case
preview_providerto the order list offile_types_orderto fix an issue with false positives forPreviewProvidersubclasses in SwiftUI.
Cihat Gündüz #2860
Bug Fixes
-
Fix false positive in
attributesrule with@autoclosureparameters when using Swift 5.2.
Mateusz Matrejek #3079 -
Fix
discarded_notification_center_observerfalse 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_getterrule in extensions when using Swift 5.2.
Marcelo Fabri #3074 -
Do not trigger
optional_enum_case_matchingrule on_?as the?might be required in some situations.
Marcelo Fabri #3057 -
Fix false positive in
attributesrule with@escapingparameters when using Swift 5.2.
Marcelo Fabri #3079 -
Fix false positive in
empty_stringrule when using multiline string literals.
Marcelo Fabri #3100
0.38.2: Machine Repair Manual
Breaking
- None.
Experimental
- None.
Enhancements
-
Add option to configure which kinds of expressions should omit their
returnkeyword by introducing anincludedconfiguration for theimplicit_returnrule. Supported values areclosure,functionandgetter. Defaults to all three.
Sven Münnich #2870 -
Add
--correctableand--verbosearguments to therulescommand to allow displaying only correctable rules, and to always print the full configuration details regardless of your terminal width.
Optional Endeavors -
Add
capture_groupoption tocustom_rulesfor more fine-grained placement of the location marker for violating code.
pyrtsa -
Add
orphaned_doc_commentrule 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_matchingrule when case expressions involved tuples.
JP Simard -
API docs for SwiftLintFramework are now available at realm.github.io/SwiftLint.
Rules.mdnow redirects to the Rule Directory in the API docs. 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_importrule when correcting violations in files containing@testableimports where more than the unused imports would be removed.
JP Simard
0.38.1: Extra Shiny Pulsator Cap
Breaking
- None.
Experimental
- None.
Enhancements
-
Make
weak_delegaterule correctable.
MaxHaertwig -
Allow
SubstitutionCorrectableRuleto returnnilinstead of a correction to indicate that a suitable correction couldn't be found for a specific case.
MaxHaertwig -
Add
enum_case_associated_value_countopt-in rule.
lakpa #2997 -
Add
optional_enum_case_matchingopt-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_selfopt-in rule to enforce usingSelfinstead oftype(of: self)when using Swift 5.1 or above.
Marcelo Fabri #3003
Bug Fixes
-
Fix crash in
unused_importrule when unused imports have trailing comments.
JP Simard #2990 -
Handle
@_exportedimports inunused_importrule.
JP Simard #2877 -
Fix false positives from the
unused_declarationrule 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
0.38.0: Toroidal Agitation
Breaking
- Replace the
SyntaxTokenandSyntaxMapstructures used in public SwiftLintFramework APIs with a newSwiftLintSyntaxTokenandSwiftlintSyntaxMapwrappers over structures returned from SourceKitten.
PaulTaykalo #2955
Experimental
- None.
Enhancements
-
Make
control_statementrule correctable.
MaxHaertwig -
Add
expiring_todoopt-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
-
Fix false positive for LetVarWhitespaceRule.
PaulTaykalo #2956 -
Fix for false-positive identical operands rule.
PaulTaykalo #2953 -
Fixed false positive in
opening_bracerule on anonymous closure.
Andrey Uryadov #2879
0.37.0: Double Load
Breaking
-
Replace the
[String: SourceKittenRepresentable]dictionaries used in public SwiftLintFramework APIs with a newSourceKittenDictionarywrapper over dictionaries returned from SourceKitten.
PaulTaykalo #2922 -
Update Commandant dependency to version 0.17.0, removing the
antitypical/Resultdependency in favor of the Swift standard library'sResulttype.
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.
0.36.0: 👕👚👗
Breaking
- SwiftLint now requires Swift 5.0 or higher to build.
JP Simard
Experimental
- None.
Enhancements
-
Add
contains_over_range_nil_comparisonopt-in rule to prefer usingcontainsover comparison ofrange(of:)tonil.
Colton Schlosser #2776 -
Make
contains_over_first_not_nilrule also matchfirst(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_reduceopt-in rule to prefer usingflatMapovermap { ... }.reduce([], +).
Marcelo Fabri #2883 -
Add autocorrection to
syntactic_sugar.
Ivan Vavilov -
Make
toggle_boolrule substitution correctable.
MaxHaertwig -
Optimize the performance of
redundant_void_returnrule.
Marcelo Fabri -
Support building with Swift 5.1 on Linux.
Marcelo Fabri #2874 -
Add
raw_value_for_camel_cased_codable_enumopt-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
0.35.0: Secondary Lint Trap
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_callrule to validate that there're no spaces between the method name and parentheses in a method call.
Marcelo Fabri -
Add
contains_over_filter_countopt-in rule to warn against using expressions likefilter(where:).count > 0instead ofcontains(where:).
Marcelo Fabri #2803 -
Add
contains_over_filter_is_emptyopt-in rule to warn against using expressions likefilter(where:).isEmptyinstead ofcontains(where:).
Marcelo Fabri -
Add
empty_collection_literalopt-in rule to prefer usingisEmptyto comparison to[]or[:].
Colton Schlosser #2807
Bug Fixes
-
Fixed false positive in
colonrule inside guard and ternary operator.
Andrey Uryadov #2806 -
Release memory created for sourcekitd requests.
Colton Schlosser #2812 -
Fix
swiftlint rulesoutput table formatting.
JP Simard #2787 -
Don't trigger
missing_docsviolations when implementingdeinit.
Marcelo Fabri #2690 -
Fix
unused_importrule false positive when only operators from the module are used.
Timofey Solonin #2737 -
Avoid triggering
redundant_type_annotationrule when declaringIBInspectableproperties.
Marcelo Fabri #2842 -
Don't trigger
missing_docsviolations on extensions.
Marcelo Fabri #2851
0.34.0: Anti-Static Wool Dryer Balls
Breaking
- To enable collecting rules, many breaking changes to
SwiftLintFramework's public API were made theLintertype was significantely changed, and a newCollectedLintertype was introduced. Many publicSwiftLintFrameworkAPIs that interacted withLinterhave also been affected. More new types and protocols were added such asRuleStorage,AnyCollectingRule,CollectingRule,CollectingCorrectableRule. We are not aware of any significant users of theSwiftLintFrameworklibrary, 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
CollectingRuleprotocol to support rules that collect data from all files before validating. Collecting rules implement acollectmethod 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_declarationanalyzer rule to lint for unused declarations. By default, detects unusedfileprivate,privateandinternaldeclarations. Configure the rule withinclude_public_and_open: trueto also detect unusedpublicandopendeclarations.
JP Simard -
Completely remove the
unused_private_declarationrule. Please useunused_declarationinstead.
JP Simard
Enhancements
- Added 'file_name_no_space' opt-in rule.
timcmiller #3007
Bug Fixes
- None.
0.33.1: Coin-Operated Property Wrapper
Breaking
- None.
Experimental
- None.
Enhancements
-
Significantly improve performance when running with a large number of cached configurations or when running with many cached results. This was done by splitting each configuration to have its own cache and by encoding the cache as a binary property list instead of json.
Colton Schlosser JP Simard -
Several public types in SwiftLintFramework have added
Codableconformance: Location, RuleDescription, RuleKind, StyleViolation, SwiftVersion, ViolationSeverity.
JP Simard -
Print full relative path to file in log output when it matches the file name of another path being linted.
Keith Smiley
Bug Fixes
-
Don't trigger
vertical_parameter_alignmentviolations when using parameters with attributes such as@ViewBuilderin function declarations.
Marcelo Fabri #2792 -
Fix false positive in
function_default_parameter_at_endrule when using a closure parameter with default value.
Marcelo Fabri #2788
0.33.0: Worldwide Dryers Conference
Breaking
- Remove the
weak_computed_propertyrule. Please see linked issue for discussion and rationale.
JP Simard #2712
Experimental
- None.
Enhancements
-
Add
" - "delimiter to allow commenting SwiftLint commands without triggeringsuperfluous_disable_command.
Kevin Randrup -
Make
testSimulateHomebrewTest()test opt-in because it may fail on unknown condition. SetSWIFTLINT_FRAMEWORK_TEST_ENABLE_SIMULATE_HOMEBREW_TESTenvironment variable to test like:$ SWIFTLINT_FRAMEWORK_TEST_ENABLE_SIMULATE_HOMEBREW_TEST=1 \ swift test --filter testSimulateHomebrewTest -
Add option to configure how nested types should be separated in file names by introducting
nested_type_separatorconfiguration for thefile_namerule.
Frederick Pietschmann #2717 -
Add
unowned_variable_captureopt-in rule to warn against unowned captures in closures when using Swift 5.
Marcelo Fabri #2097 -
Don't trigger a
no_fallthrough_onlyviolation if next case is an@unknown default.
Marcelo Fabri #2696 -
Add
duplicate_enum_casesrule to validate that an enum doesn't contain duplicated cases, as it's impossible to switch on it (see SR-10077 for details).
Marcelo Fabri #2676 -
Add
legacy_multipleopt-in rule to warn against using the remainder operator (%) checking for a remainder of zero when using Swift 5.
Marcelo Fabri #2612
Bug Fixes
-
Don't trigger
redundant_void_returnviolations when usingsubscriptas the return type is required.
Marcelo Fabri -
Skip module import if cursor info is missing module info.
alvarhansen #2746 -
Don't trigger
file_types_orderviolations in files only containing extensions.
Sam Rayner #2749 -
Force-unwrapping
selfshould trigger a violation of theforce_unwrappingrule.
Dalton Claybrook #2759
0.32.0: Wash-N-Fold-N-Reduce
Breaking
- None.
Experimental
- None.
Enhancements
-
Add
reduce_booleanrule to prefer simpler constructs overreduce(Boolean).
Xavier Lowmiller #2675 -
Add
nsobject_prefer_isequalrule to warn against implementing==on anNSObjectsubclass as callingisEqual(i.e. when using the class from Objective-C) will not use the defined==method.
Matthew Healy #2663 -
Add
reduce_intoopt-in rule to encourage the use ofreduce(into:_:)instead ofreduce(_:_:)which is less performant.
Dalton Claybrook #2658 -
Remove @ mark to fix invalid link in Rules.md.
Hiroki Nagasawa #2669 -
Add new opt-in rule
file_types_orderto specify how the types in a file should be sorted.
Cihat Gündüz #2294 -
Add new opt-in rule
type_contents_orderto specify the order of subtypes, properties, methods & more within a type.
Cihat Gündüz #2294 -
Add
nslocalizedstring_require_bundlerule to ensure calls toNSLocalizedStringspecify the bundle where the strings file is located.
Matthew Healy #2595 -
contains_over_first_not_nilrule now also checks forfirstIndex(where:).
Marcelo Fabri #2678 -
Add
unused_capture_listrule to ensure that all references in a closure capture list are used.
Dalton Claybrook #2715 -
SwiftLint can now be compiled using Xcode 10.2.
Marcelo Fabri Norio Nomura #2693
Bug Fixes
-
Fix bug where SwiftLint ignores excluded files list in a nested configuration file.
Dylan Bruschi #2447 -
colonrule now catches violations when declaring generic types with inheritance or protocol conformance.
Marcelo Fabri #2628 -
discarded_notification_center_observerrule now checks if the observer is added to any collection or passed to a function before triggering the violation.
jsloop42 #2684 -
Fix false positives on
number_separatorwhen the number is wrapped in parentheses.
Dalton Claybrook #2683 -
Fix false positives on
sorted_first_lastwhen callingfirstIndexandlastIndexmethod.
Taiki Komaba #2700 -
Fix crash when running on Linux with Swift 5 without specifying a
--pathvalue or specifying an empty string.
Keith Smiley #2703 -
Fix false positives on
explicit_aclandexplicit_top_level_aclrules when declaring extensions that add protocol conformances with Swift 5.
Marcelo Fabri #2705 -
Let
disable allcommand overridesuperfluous_disable_commandrule.
Frederick Pietschmann #2670 -
Fix issues in
explict_acl,redundant_set_access_controlandexplicit_top_level_aclrules when using Swift 5.
Marcelo Fabri #2694
0.31.0: Busy Laundromat
Breaking
- None.
Experimental
- None.
Enhancements
-
Add
deployment_targetrule to validate that@availabilityattributes and#availableconditions are not using a version that is satisfied by the deployment target. Since SwiftLint can't read an Xcode project, you need to configure this rule with these keys:iOS_deployment_target,macOS_deployment_target,watchOS_deployment_targetandtvOS_deployment_target. By default, these values are configured with the minimum versions supported by Swift.
Marcelo Fabri #2589 -
Add
weak_computed_propertyrule to warn against usingweakin a computed property as it has no effect.
Marcelo Fabri #2596 -
Add
SwiftVersion.fiveand automatically detect it when computingSwiftVersion.current.
JP Simard -
Make
redundant_objc_attributerule autocorrectable.
Daniel Metzing -
Add
required_deinitopt-in rule to ensure that all classes have a deinit method. The purpose of this is to make memory leak debugging easier so all classes have a place to set a breakpoint to track deallocation.
Ben Staveley-Taylor #2620 -
nimble_operatornow warns aboutbeTrue()andbeFalse().
Igor-Palaguta #2613 -
Warn if a configured rule is not enabled.
Marcelo Fabri #1350 -
Add
exclude_rangesoption tonumber_separatorfor exclusion.
Cihat Gündüz #2637
Bug Fixes
-
Fix false positives on
no_grouping_extensionrule when usingwhereclause.
Almaz Ibragimov -
Fix
explicit_type_interfacewhen used in statements.
Daniel Metzing #2154 -
Fix
lower_acl_than_parentwhen linting with Swift 5.
JP Simard #2607 -
Fix
let_var_whitespacewith#warning.
Igor-Palaguta #2544 -
Fix excessive
superfluous_disable_commandviolations being reported when using an invalid rule identifier in a disable command.
Marcelo Fabri #2623 -
Fix
explicit_type_interfacewithallow_redundancywhen assigning type references to variables.
Cihat Gündüz #2636 -
Fix
unused_closure_parameterwhen argument is namedself.
Cihat Gündüz #2437 -
Fix
first_wherefor some calls on Realm collection types.
Cihat Gündüz #1930
0.30.1: Localized Stain Remover
Breaking
- None.
Experimental
- Silence
CodingKeysviolations inunused_private_declarationsince these should always be intentional violations.
Kim de Vos #2573
Enhancements
- Add
nslocalizedstring_keyopt-in rule to validate that keys used inNSLocalizedStringcalls are static strings, sogenstringswill be able to find them.
Marcelo Fabri
Bug Fixes
-
Fix false positives on
trailing_closurerule when using anonymous closure calls.
Marcelo Fabri #2159 -
Fix false positives on
array_initrule when using prefix operators.
Marcelo Fabri #1877 -
Exclude files defined in the
excludedvalue of SwiftLint's configuration when--use-script-input-filesand--force-excludeare specified.
Luis Valdés #591
0.30.0: A New Washer and Dryer Set
Breaking
- None.
Experimental
- None.
Enhancements
-
Add
duplicate_importsrule to prevent importing the same module twice.
Samuel Susla #1881 -
Add
unused_setter_valuerule to validate that setter arguments are used in properties.
Marcelo Fabri #1136 -
Add
only_single_muted_parameterconfiguration ontrailing_closurerule to only enforce using trailing closure on functions that take one single muted parameter.
Marcelo Fabri
Bug Fixes
- Fix false positives on
identical_operandsrule when the right side of the operand has a chained optional.
JP Simard #2564
0.29.4: In-Unit Operands
Breaking
- None.
Experimental
- Fix
unused_importcorrection deleting unrelated ranges when there are multiple violations in a single file.
JP Simard #2561
Enhancements
- Add
strong_iboutletopt-in rule to enforce that@IBOutlets are not declared asweak.
Marcelo Fabri #2433
Bug Fixes
-
Fix inaccessible custom rules in nested configurations.
Timofey Solonin #1815 #2441 -
Improve
superfluous_disable_commandto warn against disabling non-existent rules.
Kim de Vos #2348 -
Fix false positives on
identical_operandsrule when the right side of the operand does not terminate.
Xavier Lowmiller #2467
0.29.3: Entangled Agitator
Breaking
- None.
Experimental
- Skip
@IBInspectableanddeinitdeclarations inunused_private_declaration.
JP Simard
Enhancements
-
Allow configuring
discouraged_object_literalrule to only discourage one kind of object literal.
Marcelo Fabri #2439 -
Adds
xct_specific_matcheropt-in rule to enforce specific matchers overXCTAssertEqualandXCTAssertNotEqual.
Ornithologist Coder #1874 -
Add
last_whereopt-in rule that warns against using.filter { /* ... */ }.lastin collections, as.last(where: { /* ... */ })is more efficient.
Marcelo Fabri -
Add
unused_control_flow_labelrule to validate that control flow labels are used.
Marcelo Fabri #2227
Bug Fixes
-
Fix false positives on
first_whererule when callingfilterwithout a closure parameter (for example on a Realm collection).
Marcelo Fabri -
Fix false positives on
sorted_first_lastrule when callingsortedwith a different argument thanby:(e.g. on a Realm collection).
Marcelo Fabri #2533 -
Fix false positives on
redundant_objc_attributerule when using nested types.
Marcelo Fabri #2539 -
Fix false positives on
vertical_whitespace_between_casesrule when a blank line is present but it contains trailing whitespace.
Ben Staveley-Taylor #2538
0.29.2: Washateria
Breaking
- None.
Experimental
- None.
Enhancements
-
Add new opt-in rule
vertical_whitespace_opening_bracesto warn against empty lines after opening braces.
Cihat Gündüz #1518 -
Add new opt-in rule
vertical_whitespace_closing_bracesto warn against empty lines before closing braces.
Cihat Gündüz #1518 -
Improve performance for
unused_private_declarationandunused_importrules for large files.
Niil Öhlin -
Add new
legacy_hashingrule to encourage the use of Swift 4.2's new hashing interface.
Kim de Vos #2108 -
Improve
private_unit_testrule to allow private classes with@objcattribute.
Kim de Vos #2282 -
Support glob patterns without the star.
Maksym Grebenets -
Make
modifier_orderrule autocorrectable.
Timofey Solonin #2353
Bug Fixes
-
Fix false positives in
redundant_objc_attributefor private declarations under@objcMembers.
Daniel Metzing #2499 -
Fix an error when pulling SwiftLint as a dependency using Carthage.
JP Simard -
Non-string values specified in
swiftlint_versionnow fail the lint if it doesn't match the version.
JP Simard #2518
0.29.1: There’s Always More Laundry
Breaking
- None.
Experimental
- None.
Enhancements
-
Add
redundant_objc_attributeto warn against already implied@objcattribute.
Daniel Metzing #2193 -
Add
vertical_whitespace_between_casesopt-in rule to enforce a single empty line between switch cases.
Cihat Gündüz #1517 -
Add
multiline_arguments_bracketsopt-in rule to warn against multiline function call arguments with surrounding brackets without newline.
Cihat Gündüz #2306 -
Add
multiline_literal_bracketsopt-in rule to warn against multiline literal arrays & dictionaries with surrounding brackets without newline.
Cihat Gündüz #2306 -
Add
multiline_parameters_bracketsopt-in rule to warn against multiline function definition parameters with surrounding brackets without newline.
Cihat Gündüz #2306 -
Ignore unspecified modifiers in
modifier_order.
Timofey Solonin #2435 -
The
lintcommand now exits with a code of 2 when not using pinned version defined asswiftlint_versionin the configuration file.
Kim de Vos #2074
Bug Fixes
-
Fix false positive in
nimble_operatorrule.
Marcelo Fabri #2489 -
Fix false positives on
explicit_type_interfacerule when configured with optionallowRedundancyset totrue.
Cihat Gündüz #2425 -
Only mark custom rules as 'enabled in your config' in the output of the
rulescommand when there are one or more configured custom rules.
jhildensperger -
Fix wrong correction when removing testable imports with the
unused_importrule.
JP Simard -
Fix false positive with the
unused_importrule when importing Foundation when there are attributes in that file requiring Foundation.
JP Simard
0.29.0: A Laundry List of Changes
Breaking
- SwiftLint now requires Swift 4.2 or higher to build.
JP Simard
Experimental
- None.
Enhancements
-
Improve the performance of saving or reading cached lint results on platforms with CommonCrypto.
JP Simard -
Add
markdownreporter which outputs markdown-formatted tables, ideal for rendering in GitLab or GitHub.
Dani Vela -
Add
testSimulateHomebrewTest()toIntegrationTeststhat simulates test inhomebrew-core/Formula/swiftlint.rbwithin sandbox.
Norio Nomura
Bug Fixes
-
Fix compiler warnings when building with Swift 4.2 introduced in the last release.
JP Simard -
Fix false positive in
explicit_initrule.
Dominic Freeston -
Fix
toggle_boolfalse positive violation when comparing object parameter to an equally named variable.
Timofey Solonin #2471 -
Fix false positive on file_name rule with specific patterns.
Cihat Gündüz #2417 -
Fix crash in
no_fallthrough_onlyand potentially other rules when linting files with unicode characters in certain locations.
JP Simard #2276 -
Fix violations with no character/column location not being reported in
xcpretty. Now violations with no column location default to a column value of1indicating the start of the line.
JP Simard #2267
0.28.2: EnviroBoost Plus
Breaking
- None.
Experimental
- None.
Enhancements
- Add
SWIFTLINT_DISABLE_SOURCEKITenvironment variable to allow running SwiftLint without connecting to SourceKit. This will run a subset of rules that don't require SourceKit, which is useful when running in a sandboxed setting such as in Homebrew's CI.
Norio Nomura
Bug Fixes
- None.
0.28.1: EnviroBoost
This is the last release to support building with Swift 4.0 and Swift 4.1.
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Improve the performance of collecting which files to lint by up to 3.5x.
JP Simard -
Improve the performance of looking up cached lint results by up to 10x for complex configurations.
JP Simard
0.28.0: EcoBoost
Breaking
- Completely remove the
--use-tabsoption of theautocorrectcommand that was deprecated in 0.24.1. In its place, define anindentationkey in your configuration files.
JP Simard
Experimental
-
Add a new
swiftlint analyzecommand which can lint Swift files using the full type-checked AST. Rules of theAnalyzerRuletype will be added over time. The compiler log path containing the cleanswiftcbuild command invocation (incremental builds will fail) must be passed toanalyzevia the--compiler-log-pathflag, e.g.--compiler-log-path /path/to/xcodebuild.log.
JP Simard -
Add an
explicit_selfanalyzer rule to enforce the use of explicit references toself.when accessing instance variables or functions.
JP Simard #321 -
Add an
unused_importanalyzer rule to lint for unnecessary imports.
JP Simard #2248 -
Add an
unused_private_declarationanalyzer rule to lint for unused private declarations.
JP Simard
Enhancements
-
Add
legacy_randomopt-in rule to encourage the use of.random(in:)instead ofarc4random,arc4random_uniform, anddrand48.
Joshua Kaplan -
Improve performance of
line_lengthandmultiple_closures_with_trailing_closurerules.
Marcelo Fabri -
Add
closure_body_lengthopt-in rule to enforce the maximum number of lines a closure should have. Requires Swift 4.2.
Ornithologist Coder #52 -
Add SonarQube reporter.
Yusuke Ohashi #2350 -
Add
prohibited_interface_builderopt-in rule to validate that@IBOutlets and@IBActions are not used.
Marcelo Fabri #2365 -
Add
inert_deferrule to validate thatdeferis not used at the end of a scope.
Marcelo Fabri #2123 -
Add
toggle_boolopt-in rule which suggests usingsomeBool.toggle()oversomeBool = !someBool. Requires Swift 4.2.
Dalton Claybrook #2369 -
Add
identical_operandsopt-in rule to validate that operands are different expressions in comparisons.
Marcelo Fabri #1371 -
Add
collection_alignmentopt-in rule to validate that all elements in a collection literal are aligned vertically.
Dalton Claybrook #2326 -
Add
static_operatoropt-in rule to enforce that operators are declared as static functions instead of free functions.
Marcelo Fabri #2395 -
Specify what type of compiler protocol initializer violated the
compiler_protocol_initrule.
Timofey Solonin #2422
Bug Fixes
-
Fix
commarule false positives on object literals (for example, images).
Marcelo Fabri #2345 -
Fix false positive on
file_namerule when using nested types.
Marcelo Fabri #2325 -
Fix crash on
multiline_function_chainsrule when using some special characters inside the function calls.
Marcelo Fabri #2360 -
Change
autocorrect --formatto run format before autocorrect, fixing conflicts between default indentation and rules which modify indentation (i.e.closure_end_indentation).
Ornithologist Coder #2374 -
Fix false positive on
empty_countrule when assessing binary, octal and hexadecimal integer literals.
Timofey Solonin #2423
0.27.0: Heavy Duty
Breaking
- None.
Enhancements
-
Append
modifier_orderdescription with failure reason.
Daniel Metzing #2269 -
Decrease default severity of
superfluous_disable_commandtowarning.
Frederick Pietschmann #2250 -
Don't touch files when running
autocorrect --formatif the contents haven't changed.
Marcelo Fabri #2249 -
Add
only_enforce_after_first_closure_on_first_lineconfiguration tomultiline_arguments.
Mike Ciesielka #1896 -
Add
anyobject_protocolopt-in rule which suggests usingAnyObjectoverclassfor class-only protocols.
Ornithologist Coder #2283 -
Add options
prefix_patternandsuffix_patternto rulefile_name.
Cihat Gündüz #2309 -
Add new bool config option
if_onlyto ruleconditional_returns_on_newlineto specify that the rule should only be applied toifstatements.
Cihat Gündüz #2307 -
Add support for globs in
excludedfile paths.
Keith Smiley #2316 -
Add
only_privateconfiguration toprefixed_toplevel_constantrule.
Keith Smiley #2315 -
Make rule
explicit_type_interfacecompatible with ruleredundant_type_annotationvia new optionallow_redundancy.
Cihat Gündüz #2312 -
Add
missing_docsrule to warn against undocumented declarations.
Nef10 Andrés Cecilia Luque #1652
Bug Fixes
-
Fix an issue with
control_statementwhere commas in clauses prevented the rule from applying.
Allen Wu -
Fix
explicit_enum_raw_value,generic_type_name,implicit_return,required_enum_case,quick_discouraged_call,array_init,closure_parameter_positionandunused_closure_parameterrules when linting with Swift 4.2.
Marcelo Fabri -
Fix
identifier_namerule false positives withenumwhen linting using Swift 4.2.
Marcelo Fabri Jacob Greenfield #2231 -
Fix a crash when running with Swift 4.2.
Norio Nomura SR-7954 -
Fix false positive on
attributesrule when linting a line that is below a line with a declaration that has attributes.
Marcelo Fabri #2297 -
redundant_optional_initializationrule now lints local variables.
Marcelo Fabri #2233 -
Fix autocorrection for
redundant_type_annotationrule.
Marcelo Fabri #2314
0.26.0: Maytagged Pointers
Breaking
-
SwiftLint now requires Swift 4.0 or higher to build.
JP Simard -
The
fallthroughrule is now opt-in.
Marcelo Fabri #1892
Enhancements
-
Add optional filename verification to the
file_headerrule. All occurrences in the pattern of theSWIFTLINT_CURRENT_FILENAMEplaceholder are replaced by the name of the validated file.
Anders Hasselqvist #1079 -
Updates the
untyped_error_in_catchrule to support autocorrection.
Daniel Metzing -
Add
no_fallthrough_onlyrule to check thatcasestatements do not contain only afallthrough.
Austin Belknap -
Add
indented_casessupport toswitch_case_alignmentrule.
Shai Mishali #2119 -
Add opt-in
modifier_orderto enforce the order of declaration modifiers. Requires Swift 4.1 or later.
Jose Cheyo Jimenez Daniel Metzing #1472 #1585 -
Validate implicit
subscriptgetter inimplicit_getterrule when using Swift 4.1 or later.
Marcelo Fabri #898 -
Add
unavailable_functionopt-in rule to validate that functions that are currently unimplemented (using a placeholderfatalError) are marked with@available(*, unavailable).
Marcelo Fabri #2127 -
Updates the
closure_end_indentationrule to support autocorrection.
Eric Horacek -
Updates the
literal_expression_end_indentationrule to support autocorrection.
Eric Horacek -
Add a new
multiline_function_chainsrule to validate that chained function calls start either on the same line or one per line.
Eric Horacek #2214 -
Improves the
markrule's autocorrection.
Eric Horacek -
Add
redundant_set_access_controlrule to warn against using redundant setter ACLs on variable declarations.
Marcelo Fabri #1869 -
Add a new
ignores_interpolated_stringsconfig parameter to theline_lengthrule to ignore lines that include interpolated strings from this rule.
Michael Gray #2100 -
Add a new
ignores_default_parametersconfig parameter to thefunction_parameter_countrule to ignore default parameter when calculating parameter count. True by default.
Varun P M #2171 -
Add
empty_xctest_methodopt-in rule which warns against empty XCTest methods.
Ornithologist Coder #2190 -
Add
function_default_parameter_at_endopt-in rule to validate that parameters with defaults are located toward the end of the parameter list in a function declaration.
Marcelo Fabri #2176 -
Add
file_nameopt-in rule validating that file names contain the name of a type or extension declared in the file (if any).
JP Simard #1420 -
Add
redundant_type_annotationopt-in rule which warns against unnecessary type annotations for variables.
Šimon Javora #2239 -
Add
convenience_typeopt-in rule to validate that types hosting only static members should be enums to avoid instantiation.
Marcelo Fabri #1871
Bug Fixes
-
Update
LowerACLThanParentrule to not lint extensions.
Keith Smiley #2164 -
Fix operator usage spacing nested generics false positive.
Eric Horacek #1341 #1897 -
Fix autocorrection for several rules (
empty_parentheses_with_trailing_closure,explicit_init,joined_default_parameter,redundant_optional_initializationandunused_closure_parameter) when used with preprocessor macros.
John Szumski Marcelo Fabri -
Fix
unneeded_parentheses_in_closure_argumentfalse negatives when multiple violations are nested.
Marcelo Fabri #2188 -
Fix false negatives in
implicit_returnrule when using closures as function arguments.
Marcelo Fabri #2187 -
Fix false positives in
attributesrule when@testableis used.
Marcelo Fabri #2211 -
Fix false positives in
prohibited_super_callrule.
Marcelo Fabri #2212 -
Fix a false positive in
unused_closure_parameterrule when a parameter is used in a string interpolation.
Marcelo Fabri #2062 -
Fixes a case where the
closure_end_indentationrule wouldn't lint the end indentation of non-trailing closure parameters.
Eric Horacek #2121
0.25.1: Lid Locked
This is the last release to support building with Swift 3.2 and Swift 3.3. The next release will require Swift 4.0 or higher to build.
Breaking
- None.
Enhancements
-
Add
LowerACLThanParentrule.
Keith Smiley #2136 -
Add
UIOffsetMaketolegacy_constructorrule.
Nealon Young #2126 -
Add a new
excludedconfig parameter to theexplicit_type_interfacerule to exempt certain types of variables from the rule.
Rounak Jain #2028 -
Add
empty_stringopt-in rule to validate against comparing strings to""instead of using.isEmpty.
Davide Sibilio -
Add
untyped_error_in_catchopt-in rule to warn against declaring errors without an explicit type in catch statements instead of using the impliciterrorvariable.
Daniel Metzing #2045 -
Add
allkeyword for use in disable / enable statement:// swiftlint:disable all. It allows disabling SwiftLint entirely, in-code, for a particular section.
fredpi #2071 -
Adds
--force-excludeoption tolintandautocorrectcommands, which will force SwiftLint to exclude files specified in the configexcludedeven if they are explicitly specified with--path.
Ash Furrow #2051 -
Adds
discouraged_optional_collectionopt-in rule to encourage the use of empty collections instead of optional collections.
Ornithologist Coder #1885 -
Add 4.1.0, 4.1.1 and 4.2.0 to Swift version detection.
Norio Nomura #2143 -
Support building with Swift 4.1.
Norio Nomura #2038
Bug Fixes
-
Fixes an issue with the
yoda_conditionrule where the severity would always display as a warning, and the reason would display as the severity type.
Twig -
Fix TODOs lint message to state that TODOs should be resolved instead of avoided.
Adonis Peralta #150 -
Fix some cases where
colonrule wouldn't autocorrect dictionary literals.
Marcelo Fabri #2050 -
Fix linux crash on sources with surrogate pair emojis as variable names.
Cyril Lashkevich -
Make
legacy_constructorrule more reliable, especially for autocorrecting.
Marcelo Fabri #2098 -
Fix
colonrule autocorrect when preprocessor macros are present.
Marcelo Fabri #2099 -
Fix crash when saving cache if there're entries referring to the same path but with different capitalization.
Marcelo Fabri #2032 -
Fix several rules (
empty_enum_arguments,explicit_initempty_parentheses_with_trailing_closure,joined_default_parameter,redundant_optional_initialization,redundant_void_returnandunused_closure_parameter) rules autocorrection inside functions or other declarations.
Marcelo Fabri -
Fix
redundant_void_returnrule autocorrect when preprocessor macros are present.
John Szumski #2115 -
Fix issue where the autocorrect done message used the plural form of "files" even if only 1 file changed.
John Szumski -
Fix false positives in
attributesrule when using Swift 4.1.
Marcelo Fabri #2125 #2141
0.25.0: Cleaning the Lint Filter
Breaking
- None.
Enhancements
- Adds
discouraged_optional_booleanopt-in rule to discourage the use of optional booleans.
Ornithologist Coder #2011
Bug Fixes
-
Fix some cases where
colonrule wouldn't be autocorrected.
Manabu Nakazawa -
Fix false positives in
explicit_aclrule when declaring functions and properties in protocols or implementingdeinit.
Marcelo Fabri #2014 -
Fix false negatives in
unneeded_parentheses_in_closure_argumentrule when using_as one of the closure arguments.
Marcelo Fabri #2017 -
Fix several rules that use attributes when linting with a Swift 4.1 toolchain.
Marcelo Fabri #2019 -
Don't trigger violations in
let_var_whitespacerule when using local variables when linting with a Swift 4.1 toolchain.
Marcelo Fabri #2021 -
Improve
type_namerule violations to be positioned on the type name.
Marcelo Fabri #2021 -
Use SourceKit to validate
associatedtypeandtypealiasintype_namerule when linting with Swift 4.1.
Marcelo Fabri #2021 -
Fix some cases where violations would still be triggered when using the
ignores_function_declarationsconfiguration ofline_lengthrule.
Manabu Nakazawa -
Fix false positive in
empty_enum_argumentsrule when using closures.
Marcelo Fabri #2041 -
Fix false positives in
force_unwrappingrule when declaring functions that return implicitly unwrapped collections (for example[Int]!or[AnyHashable: Any]!).
Marcelo Fabri #2042 -
Fix directories with a
.swiftsuffix being treated as files.
Jamie Edge #1948
0.24.2: Dented Tumbler
Breaking
- None.
Enhancements
- None.
Bug Fixes
0.24.1: Dented Tumbler
Breaking
- None.
Enhancements
-
Invalidate cache when Swift patch version changes.
Norio Nomura -
Add
private_actionopt-in rule which warns against public @IBAction methods.
Ornithologist Coder #1931 -
Add
yoda_conditionopt-in rule which warns when Yoda conditions are used. That is, when the constant portion of the expression is on the left side of a conditional statement.
Daniel Metzing #1924 -
Indentation can now be specified via a configuration file.
Noah McCann RubenSandwich #319 -
Add
required_enum_caseopt-in rule which allows enums that conform to protocols to require one or more cases. Useful for result enums.
Donald Ritter -
Add
discouraged_object_literalopt-in rule which encourages initializers over object literals.
Ornithologist Coder #1987 -
Adds
prefixed_toplevel_constantopt-in rule which encourages top-level constants to be prefixed byk.
Ornithologist Coder #1907 -
Added
explicit_aclopt-in rule to enforce explicit access control levels.
Josep Rodriguez #1822
Bug Fixes
-
Fix false positives in
control_statementrule when methods with keyword names are used.
Marcelo Fabri #1946 -
Fix false positives in
for_whererule when pattern matching (if case) is used.
Marcelo Fabri #1968 -
Fix false positives in
unused_closure_parameterrule when closure is wrapped in parentheses.
JP Simard #1979
0.24.0: Timed Dry
Breaking
-
SwiftLint now requires Xcode 9 and Swift 3.2+ to build.
Marcelo Fabri -
Remove
SwiftExpressionKind.other.
Marcelo Fabri
Enhancements
-
Add
sorted_first_lastopt-in rule to encourage usingmin()ormax()oversorted().firstorsorted().last.
Tom Quist #1932 -
Add
quick_discouraged_focused_testopt-in rule which warns against focused tests in Quick tests.
Ornithologist Coder #1905 -
Add
override_in_extensionopt-in rule that warns against overriding declarations in anextension.
Marcelo Fabri #1884 -
Add
[f,x]{describe, context, itBehavesLike}toquick_discouraged_callrule.
Ornithologist Coder #1903 -
Add
quick_discouraged_pending_testopt-in rule which warns against pending tests in Quick tests.
Ornithologist Coder #1909 -
Speed up equality tests for
[Rule]andConfigurationvalues.
JP Simard -
Make
Configurationconform toHashable.
JP Simard -
Speed up reading cached results by about 200%.
JP Simard -
Add
catchto the statements checked by thecontrol_statementrule.
JP Simard -
Make
sorted_importscorrectable.
Samuel Susla JP Simard #1822 -
Make
sorted_importsonly validate within "groups" of imports on directly adjacent lines.
Samuel Susla JP Simard #1822
Bug Fixes
-
Extend
first_whereandcontains_over_first_not_nilrules to also detect cases where calls tofilterandfirstare parenthesized.
Tom Quist -
Correct equality tests for
Configurationvalues. They previously didn't account forwarningThresholdorcachePath.
JP Simard -
Fix false positive in
multiline_parametersrule when parameter is a closure with default value.
Ornithologist Coder #1912 -
Fix caching on Linux.
JP Simard -
Fix crashes due to races.
JP Simard -
Fix
String.charactersdeprecation warnings when compiling with Swift 4.0.2.
JP Simard
0.23.1: Rewash: Forgotten Load Edition
Breaking
- None.
Enhancements
- None.
Bug Fixes
-
Fix false positive in
array_initrule when using amapthat doesn't take a closure.
Marcelo Fabri #1878 -
superfluous_disable_commandrule can now be disabled as expected when using// swiftlint:disable superfluous_disable_command.
Marcelo Fabri #1890
0.23.0: Permanent Press Cycle
Breaking
- None.
Enhancements
-
Fix csv reporter to output records with new lines.
atetlaw -
Add
contains_over_first_not_nilrule to encourage usingcontainsoverfirst(where:) != nil.
Samuel Susla #1514 -
Add
fallthroughrule that flags usage offallthrough.
Marcelo Fabri #1834 -
Improve
colonrule to catch violations in dictionary types (e.g.[String: Int]), when usingAnyand on function calls.
Marcelo Fabri #1074 #1389 -
Add
switch_case_alignmentrule to validate thatcaseanddefaultstatements are vertically aligned with their enclosingswitchstatement.
Austin Lu -
Add
array_initopt-in rule to validate thatArray(foo)should be preferred overfoo.map({ $0 }).
Marcelo Fabri #1271 -
Truncate long configuration console descriptions to fit in the console window when running
swiftlint rules.
JP Simard #1002 -
Add
multiline_argumentsopt-in rule that warns to either keep all the arguments of a function call on the same line, or one per line.
Marcel Jackwerth -
Add
unneeded_break_in_switchrule to validate that no extrabreaks are added inswitchstatements.
Marcelo Fabri #1870 -
Add
literal_expression_end_indentationopt-in rule to validate that array and dictionary literals ends have the same indentation as the line that started them.
Marcelo Fabri #1435
Bug Fixes
-
Improve how
opening_bracerule reports violations locations.
Marcelo Fabri #1811 -
Fix false negatives in
unneeded_parentheses_in_closure_argumentrule when using capture lists.
Marcelo Fabri #1817 -
Fix handling of attributes (
lazy,objc, etc.) for thelet_var_whitespacerule.
David Catmull #1770 #1812 -
Fix false positives in
for_whererule when usingif varinsidefor.
Marcelo Fabri #1838 -
Fix false positive in
class_delegate_protocolrule when using Swift 4.0.1.
Marcelo Fabri #1856 -
Print multi-line configuration values in a single line when running
swiftlint rulesto avoid breaking the table format.
JP Simard #1002 -
Ignore SwiftLint commands (
swiftlint:(disable|enable)) infile_headerrule, making it work better withsuperfluous_disable_commandrule.
Marcelo Fabri #1810 -
Fix false negatives in
generic_type_name,identifier_nameandtype_namerules when usingallowed_symbols.
Marcelo Fabri
0.22.0: Wrinkle-free
Breaking
- Nested configurations will now be merged with parent configurations rather
than replace them outright.
Stéphane Copin JP Simard #676
Enhancements
-
Add
is_disjointrule to encourage usingSet.isDisjoint(with:)overSet.intersection(_:).isEmpty.
JP Simard -
Add
xctfail_messagerule to enforce XCTFail calls to include a description of the assertion.
Ornithologist Coder #1370 -
Add
joined_default_parametercorrectable opt-in rule to discourage explicit usage of the default separator.
Ornithologist Coder #1093 #1757 -
Files with extensions other than
.swiftcan now be used as arguments to--filewhen linting or autocorrecting.
Marcelo Fabri #1721 -
Allow
()?,Void?,()!, andVoid!as return types inredundant_void_returnrule.
Ryan Booker #1761 -
Add
single_test_classopt-in rule to validate that test files only contain a singleQuickSpecorXCTestCasesubclass.
Ornithologist Coder #1779 -
Produce an error when a
// swiftlint:disablecommand does not silence any violations.
JP Simard #1102 -
Add
quick_discouraged_callopt-in rule to discourage calls and object initialization inside 'describe' and 'context' block in Quick tests.
Ornithologist Coder #1781 -
Invalidate cache when Swift version changes.
Marcelo Fabri -
Add
pattern_matching_keywordsopt-in rule to enforce movingletandvarkeywords outside tuples in aswitch.
Marcelo Fabri #202 -
Add
explicit_enum_raw_valueopt-in rule to allow refactoring the Swift API without breaking the API contract.
Mazyod #1778 -
Add
no_grouping_extensionopt-in rule to disallow the use of extensions for code grouping purposes within the same file.
Mazyod #1767 -
Improve
syntactic_sugarviolation message to be type-specific.
Marcelo Fabri #1803 -
Add
multiple_closures_with_trailing_closurerule that disallows trailing closure syntax when passing more than one closure argument to a function.
Erik Strottmann #1801
Bug Fixes
-
Fix false positive on
force_unwrappingrule when declaring local variable with implicity unwrapped type.
Otávio Lima #1710 -
Fix the warning message and autocorrection of
vertical_whitespacerule to display the maximum empty lines allowed ifmax_empty_linesis greater than 1.
Hossam Ghareeb #1763 -
Fix for the wrong configuration being used when using
--pathand a configuration exists in a parent directory.
Marcelo Fabri #1744 -
Fix false positive on
unused_enumeratedrule with complex variable bindings.
Marcelo Fabri #1787 -
Fix incorrect violations and autocorrections on
unneeded_parentheses_in_closure_argumentrule that were generated in some cases (mainly when using chained method calls with closures).
Marcelo Fabri
0.21.0: Vintage Washboard
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 generation.
Marcelo Fabri #1078 -
Add
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 #1058 -
Add
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 #1577 -
Don'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 #1647 -
Add
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 Fabri -
Add
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 #54 -
Shebang (
#!) in the beginning of a file is now ignored by all rules.
Marcelo Fabri #1294 -
Add
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 #1512 -
Treat
yes,no,onandoffas strings (and not booleans) when loading configuration files.
Marcelo Fabri #1424 -
Add
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 #1029 -
Fix false positive in
empty_enum_argumentsrule when using wildcards andwhereclauses.
Marcelo Fabri #1722 -
Fix false positive in
large_tuplerule when using throwing closure.
Liquidsoul -
Make
vertical_parameter_alignmentmore robust, fixing false positives and detecting previously missed violations.
JP Simard #1488
0.20.1: More Liquid Fabric Softener
Breaking
- None.
Enhancements
- None.
Bug Fixes
-
Fix typo in
FatalErrorMessageRule.
Alexander Lash -
Don't trigger an
extension_access_modifierviolation when all extension members areopen, asopen extensionis not supported by Swift.
Marcelo Fabri #1629 -
Don't trigger a
vertical_parameter_alignment_on_callviolation when trailing closures are used.
Marcelo Fabri #1635 -
Make
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
0.20.0: Liquid Fabric Softener
Breaking
- None.
Enhancements
-
Detect more violations of
force_unwrappingwhen using subscripts.
Otávio Lima -
Match
(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 Coder -
Update
function_parameter_countrule to ignore overridden methods.
Markus Gasser #1562 -
Skip files with valid cache & no violations when auto correcting.
Marcelo Fabri #1554 -
Don't trigger violations from the
private_unit_testrule when a method has parameters.
Marcelo Fabri #1532 -
Don'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 #1525 -
Add
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 #1546 -
Add
vertical_parameter_alignment_on_callopt-in rule that validates that parameters are vertically aligned on a method call.
Marcelo Fabri #1037 -
Add
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 #1597 -
Fix 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 #1622 -
Use
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
0.19.0: Coin-Operated Machine
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 #1550 -
Add 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 #1326 -
Added
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 Moore -
Improve violation reason wording in
function_body_length,large_type, andtype_body_lengthrules.
ultimatedbz -
Add
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 #1194 -
Add option to
unused_optional_bindingrule to ignoretry?inguardstatements.
Sega-Zero #1432 -
Add
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 #1507 -
Add
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 #1429 -
Prevent false positive in
shorthand_operatorrule.
sammy-SC #1254 -
Fix typo in
DiscardedNotificationCenterObserverRule.
Spencer Kaiser -
Fix
empty_parametersrule with Swift 3.
Marcelo Fabri #1460 -
Prevent triggering
redundant_optional_initializationrule on alazy varsince it needs initialization.
Marcelo Fabri #1334 -
Fix
ignores_case_statementskey incyclomatic_complexitydescription.
Jeff Blagdon #1434 -
Fall 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 #1508 -
Fix 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
0.18.1: Misaligned Drum
Breaking
- None.
Enhancements
- None.
Bug Fixes
- Compile releases in the 'Release' configuration rather than 'Debug'.
JP Simard
0.18.0: Misaligned Drum
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 #1412 -
Yams 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.
JP Simard
Bug Fixes
-
Fix --lenient enforcement not being applied to all violations.
aaroncrespo #1391 -
Fix false positives in
unused_optional_bindingrule.
Daniel Rodríguez Troitiño #1376 -
Fix false positives in
redundant_discardable_letrule.
Jeremy David Giesbrecht #1415
0.17.0: Extra Rinse Cycle
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 #56 -
Performance improvements to
generic_type_name,redundant_nil_coalescing,mark,first_whereandvertical_whitespacerules.
Marcelo Fabri -
Add
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 #1062 -
Add
notification_center_detachmentrule that warns against an object removing itself fromNotificationCenterin an unsafe location.
Marcelo Fabri #1061 -
Accept
AnyObjectandNSObjectProtocolinclass_delegate_protocol.
Jon Shier #1261 -
Add
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 #1228 -
unused_enumeratedrule now warns when only the index is being used. You should use.indicesinstead of.enumerated()in this case.
Marcelo Fabri #1278 -
Add
ignores_case_statementsas option toCyclomaticComplexityRule.
Michael L. Welles #1298 -
Add correctable
redundant_discardable_letrule that warns whenlet _ = foo()is used to discard a result from a function instead of_ = foo().
Marcelo Fabri #1232 -
Accept 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 #1318 -
Add
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 #1322 -
Add
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 #1242 -
Retain closure parameter types when they are specified during autocorrect.
Allen Zeng #1175 -
Fix
redundant_void_returnmatches if return type starts with Void~.
Hayashi Tatsuya -
Ignore
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 #1257 -
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 #1237 -
Reimplement
switch_case_on_newlinerule to be anASTRuleand be more reliable, fixing some false negatives and false positives.
Marcelo Fabri #1268 -
Fix
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 #1304 -
Fix false negative on
unused_closure_parameterrule.
Hayashi Tatsuya -
Fix
checkstylereport format.
Yuki Oya
0.16.1: Commutative Fabric Sheets
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 #1163 -
Fix false positive on
redundant_optional_initializationrule.
Marcelo Fabri #1159 -
Fix false positive on
operator_usage_whitespacerule with decimal literals in exponent format.
Marcelo Fabri #1153 -
Fix
excludedconfiguration not excluding files.
Marcelo Fabri #1166 -
Disable 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
0.16.0: Maximum Energy Efficiency Setting
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.
JP Simard
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 #1077 -
Permit unsigned and explicitly-sized integer types in
valid_ibinspectable.
Daniel Duan -
Make
nimble_operatorrule correctable.
Vojta Stavik -
Add
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 Rubin -
Add
class_delegate_protocolrule that warns against protocol declarations that aren't marked as: classor@objc.
Marcelo Fabri #1039 -
Add correctable
redundant_optional_initializationrule that warns against initializing optional variables withnil.
Marcelo Fabri #1052 -
redundant_nil_coalescingrule is now correctable.
Marcelo Fabri -
Make
number_separatorrule correctable.
Marcelo Fabri -
empty_parentheses_with_trailing_closurerule is now correctable.
Marcelo Fabri -
Add 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 #900 -
type_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 #1109 -
Add
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 #1065 -
Add
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 #769 -
Add 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 #973 -
Add
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 #928 -
Fix 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 #1105 -
Fix
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 #1045 -
Fix false positive on
vertical_parameter_alignmentrule when breaking line in a default parameter declaration.
Marcelo Fabri #1129
0.15.0: Hand Washable Holiday Linens 🎄
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 Fabri -
HTML reports now display a relative path to files.
Jamie Edge -
colonrule 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 Hanika -
Grammar checks.
Michael Helmbrecht -
Fix the validity and styling of the HTML reporter.
Jamie Edge -
Fix false positive in
empty_parentheses_with_trailing_closurerule.
Marcelo Fabri #1021 -
Fix false positive in
switch_case_on_newlinewhen switching over a selector.
Marcelo Fabri #1020 -
Fix crash in
closure_parameter_positionrule.
Marcelo Fabri #1026 -
Fix false positive in
operator_usage_whitespacerule when using image literals.
Marcelo Fabri #1028
0.14.0: Super Awesome Retractable Drying Rack
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.soto be built and located in/usr/lib, or in another location specified by theLINUX_SOURCEKIT_LIB_PATHenvironment variable. A preconfigured Docker image is available on Docker Hub by the ID ofnorionomura/sourcekit:302.
JP Simard Norio Nomura #732 -
Add
dynamic_inlinerule to discourage combination of@inline(__always)anddynamicfunction attributes.
Daniel Duan -
Add
number_separatoropt-in rule that enforces that underscores are used as thousand separators in large numbers.
Marcelo Fabri #924 -
Add
file_headeropt-in rule that warns when a file contains a copyright comment header, such as the one Xcode adds by default.
Marcelo Fabri #844 -
FunctionParameterCountRulenow ignores initializers.
Denis Lebedev #544 -
Add
EmojiReporter: a human friendly reporter.
Michał Kałużny -
Add
redundant_string_enum_valuerule that warns against String enums with redundant value assignments.
Marcelo Fabri #946 -
Add
attributesopt-in rule which validates if an attribute (@objc,@IBOutlet,@discardableResult, etc) is in the right position:- If the attribute is
@IBActionor@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_lineandalways_on_line_abovekeys.
- If the attribute is
-
Add
empty_parentheses_with_trailing_closurerule that checks for empty parentheses after method call when using trailing closures.
Marcelo Fabri #885 -
Add
closure_parameter_positionrule that validates that closure parameters are in the same line as the opening brace.
Marcelo Fabri #931 -
type_namerule now validatestypealiasandassociatedtypetoo.
Marcelo Fabri #49 #956 -
Add
ProhibitedSuperRuleopt-in rule that warns about methods calling to super that should not, for exampleUIViewController.loadView().
Aaron McTavish #970 -
Add correctable
void_returnrule to validate usage of-> Voidover-> ().
Marcelo Fabri JP Simard #964 -
Add correctable
empty_parametersrule to validate usage of() ->overVoid ->.
Marcelo Fabri #573 -
Add
operator_usage_whitespaceopt-in rule to validate that operators are surrounded by a single whitespace when they are being used.
Marcelo Fabri #626 -
Add
unused_closure_parametercorrectable 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_enumeratedrule 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_delegaterule reporting a violation for variables containing but not ending indelegate.
Phil Webster -
Fix
weak_delegaterule reporting a violation for variables in protocol declarations.
Marcelo Fabri #934 -
Fix
trailing_commarule 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_positionrule when there are multi-byte characters in the file.
Marcelo Fabri
0.13.2: Light Cycle
Breaking
- None.
Enhancements
TrailingCommaRulenow only triggers when a declaration is multi-line when usingmandatory_comma: true.
Marcelo Fabri #910 #911
Bug Fixes
0.13.1: Heavy Cycle
Breaking
- None.
Enhancements
-
Add
ImplicitGetterRuleto warn against usinggeton computed read-only properties.
Marcelo Fabri #57 -
Add
WeakDelegateRulerule to enforce delegate instance variables to be marked asweak.
Olivier Halligon -
Add
SyntacticSugarrule that enforces that shorthanded syntax should be used when possible, for example[Int]instead ofArray<Int>.
Marcelo Fabri #319 -
Allow specifying multiple rule identifiers in comment commands. For example,
// swiftlint:disable:next force_cast force_try. Works with all command types (disable/enable) and modifiers (next,this,previousor blank).
JP Simard #861 -
Add
NimbleOperatorRuleopt-in rule that enforces using operator overloads instead of free matcher functions when using Nimble.
Marcelo Fabri #881 -
closure_spacingrule now accepts empty bodies with a space.
Marcelo Fabri #875 -
Add
TrailingCommaRuleto enforce/forbid trailing commas in arrays and dictionaries. The default is to forbid them, but this can be changed with themandatory_commaconfiguration.
Marcelo Fabri #883 -
Add support for
fileprivateinPrivateOutletRuleandPrivateUnitTestRule.
Marcelo Fabri #781 #831 -
Make
MarkRulecorrectable.
kohtenko
Bug Fixes
-
Rule out a few invalid
@IBInspectablecases invalid_ibinspectable.
Daniel Duan -
Fix a few edge cases where malformed
MARK:comments wouldn't trigger a violation.
JP Simard #805 -
Now lints single files passed to
--patheven if this file is excluded from the configuration file (.swiftlint.yml).
JP Simard -
Fixed error severity configuration in
colonrule.
Marcelo Fabri #863 -
switch_case_on_newlinerule should ignore trailing comments.
Marcelo Fabri #874 -
switch_case_on_newlinerule shouldn't trigger on enums.
Marcelo Fabri #878 -
Fix regex bug in Comma Rule causing some violations to not be triggered when there were consecutive violations in the same expression.
Savio Figueiredo #872
0.13.0: MakeYourClothesCleanAgain
Breaking
- None.
Enhancements
-
Add
ignores_commentconfiguration fortrailing_whitespacerule.
Javier Hernández #576 -
Added HTML reporter, identifier is
html.
Johnykutty Mathew -
Add
SuperCallRuleopt-in rule that warns about methods not calling to super.
Angel G. Olloqui #803 -
Add
RedundantNilCoalesingRuleopt-in rule that warns against?? nil.
Daniel Beard #764 -
Added opt-in rule to makes closure expressions spacing consistent.
J. Cheyo Jimenez #770 -
Adds
allow_private_setconfiguration for theprivate_outletrule.
Rohan Dhaimade -
Swift 2.3 support.
Norio Nomura Syo Ikeda -
Color literals count as single characters to avoid unintentional line length violations.
Jonas #742 -
Add
SwitchCaseOnNewlineRuleopt-in rule that enforces a newline aftercase pattern:in aswitch.
Marcelo Fabri #681 -
Add
ValidIBInspectableRulerule that checks if@IBInspectabledeclarations are valid. An@IBInspectableis valid if:- It's declared as a
var(notlet) - Its type is explicit (not inferred)
- Its type is one of the supported types
- It's declared as a
-
Add
ExplicitInitRuleopt-in rule to discourage callinginitdirectly.
Matt Taube #715
Bug Fixes
-
Fixed whitespace being added to TODO messages.
W. Bagdon #792 -
Fixed regex bug in Vertical Whitespace Rule by using SourceKitten instead. The rule now enabled by default again (no longer opt-in).
J. Cheyo Jimenez #772 -
Correctable rules no longer apply corrections if the rule is locally disabled.
J. Cheyo Jimenez #601 -
Fixed regex bug in Mark Rule where MARK could not be used with only a hyphen but no descriptive text:
// MARK: -.
Ruotger Deecke #778 -
Fixed: Private unit test rule not scoped to test classes.
Fixed: Private unit test rule config is ignored if regex is missing.
Cristian Filipov #786 -
Fixed:
ConditionalReturnsOnNewlinenow respects severity configuration.
Rohan Dhaimade #783 -
Fixed:
ConditionalReturnsOnNewlinenow checks ifreturnis a keyword, avoiding false positives.
Marcelo Fabri #784 -
ForceUnwrappingRuledid not recognize force unwraps in return statements using subscript.
Norio Nomura #813
0.12.0: Vertical Laundry
Breaking
- Fixed: SwiftLint assumes paths in the YAML config file are relative to the
current directory even when
--pathis passed as an argument.
Cristian Filipov
Enhancements
- Add
--enable-all-rulesCLI option tolintcommand to facilitate running all rules, even opt-in and disabled ones, ignoringwhitelist_rules.
JP Simard #1170
Bug Fixes
0.11.2: Communal Clothesline
This release has seen a phenomenal uptake in community contributions!
Breaking
- None.
Enhancements
-
Add
MarkRulerule to enforce// MARKsyntax.
Krzysztof Rodak #749 -
Add
PrivateOutletRuleopt-in rule to enforce@IBOutletinstance variables to beprivate.
Olivier Halligon -
Add content of the todo statement to message.
J. Cheyo Jimenez #478 -
Add
LegacyNSGeometryFunctionsRulerule. AddNSSize,NSPoint, andNSRectconstants and constructors to existing rules.
David Rönnqvist -
Added Vertical Whitespace Rule.
J. Cheyo Jimenez #548 -
Removed ConditionalBindingCascadeRule.
J. Cheyo Jimenez #701 -
Allow setting
flexible_right_spacingconfiguration for thecolonrule.
Shai Mishali #730 -
Add Junit reporter.
Matthew Ellis -
LeadingWhitespaceRule is now auto correctable.
masters3d -
Add included regex for custom rules to control what files are processed.
bootstraponline #689 -
Add rule to check for private unit tests (private unit tests don't get run by XCTest).
Cristian Filipov -
Add configuration for setting a warning threshold.
woodhamgh 696 -
Adds 'ConditionalReturnsOnNewLineRule' rule.
Rohan Dhaimade
Bug Fixes
-
Fixed CustomRule Regex.
J. Cheyo Jimenez #717 #726 -
Allow disabling custom rules in code.
J. Cheyo Jimenez #515 -
Fix LegacyConstructorRule when using variables instead of numbers.
Sarr Blaise #646 -
Fix force_unwrapping false positive inside strings.
Daniel Beard #721
0.11.1: Cuddles... Or Else!
Breaking
- None.
Enhancements
- Added
statement_modeconfiguration to thestatement_positionrule. Thedefaultmode keeps the current SwiftLint behavior of keepingelseandcatchstatements on the same line as the closing brace before them. Theuncuddled_elseconfiguration requires theelseandcatchto be on a new line with the same leading whitespace as the brace.
Mike Skiba #651
Bug Fixes
- Remove extraneous argument label added in LegacyCGGeometryFunctionsRule
autocorrect.
Sarr Blaise 643
0.11.0: Laundromat Format
Breaking
-
Now
type_nameallows lowercase enum values to match the Swift API Design Guidelines.
Jorge Bernal #654 -
Embedding frameworks needed by
swiftlintwas moved from SwiftLintFramework Xcode target to the swiftlint target. TheSwiftLintFramework.frameworkproduct built by the SwiftLintFramework target no longer contains unnecessary frameworks or multiple copies of the Swift libraries.
Norio Nomura
Enhancements
-
Add
--formatoption toautocorrectcommand which re-indents Swift files much like pasting into Xcode would. This option isn't currently configurable, but that can change if users request it.
JP Simard -
Improve error messages for invalid configuration files.
Brian Hardy -
Added the user-configurable option
ignores_empty_linesto thetrailing_whitespacerule. It can be used to control whether theTrailingWhitespaceRuleshould report and correct whitespace-indented empty lines. Defaults tofalse. Added unit tests.
Reimar Twelker
Bug Fixes
-
Fix false positive in conditional binding cascade violation.
Norio Nomura #642 -
Another conditional binding fix, this time for enum that has two parameters or an if statement with two case tests.
Andrew Rahn #667 -
Fix regression in CommaRule ignoring violations when the comma is followed by a comment.
Norio Nomura #683
0.10.0: laundry-select edition
Breaking
- None.
Enhancements
-
Now
libclang.dylibandsourcekitd.frameworkare dynamically loaded at runtime by SourceKittenFramework to use the versions included in the Xcode version specified byxcode-select -por custom toolchains.
Norio Nomura #167 -
Add
LegacyCGGeometryFunctionsRulerule.
Sarr Blaise #625 -
SwiftLint no longer crashes when SourceKitService crashes.
Norio Nomura -
Rewrite
conditional_binding_cascaderule.
Norio Nomura #617 -
Add autocorrect for
ReturnArrowWhitespaceRule.
Craig Siemens
Bug Fixes
-
Failed to launch swiftlint when Xcode.app was placed at non standard path.
Norio Nomura #593 -
ClosingBraceRuleno longer triggers across line breaks.
Josh Friend #592 -
LegacyConstantRuleandLegacyConstructorRulefailed toautocorrect.
Norio Nomura #623
0.9.2: Multiple Exhaust Codes
Breaking
- None.
Enhancements
-
Return different exit codes to distinguish between types of errors:
- 0: No errors, maybe warnings in non-strict mode
- 1: Usage or system error
- 2: Style violations of severity "Error"
- 3: No style violations of severity "Error", but violations of severity
"warning" with
--strict
-
VariableNameRulenow accepts symbols starting with more than one uppercase letter to allow for names like XMLString or MIMEType.
Erik Aigner #566
Bug Fixes
-
Avoid overwriting files whose contents have not changed.
Neil Gall #574 -
Fix
CommaRulemismatch between violations and corrections.
Norio Nomura #466 -
Fix more false positives in
ForceUnwrappingRule.
Norio Nomura #546 #547
0.9.1: Air Duct Cleaning
Breaking
- None.
Enhancements
- None.
Bug Fixes
-
Fix force unwrap rule missed cases with quotes.
Norio Nomura #535 -
Fix issues with nested
.swiftlint.ymlfile resolution.
Norio Nomura #543
0.9.0: Appliance Maintenance
Breaking
-
Linter.reporterhas been removed andConfiguration.reporterFromString(_:)has been renamed to a free function:reporterFromString(_:).
JP Simard -
_ConfigProviderRule&ConfigurableRulehave been removed and their requirements have been moved toRule.
JP Simard -
Configuration(path:optional:silent)has been changed toConfiguration(path:rootPath:optional:quiet:).
JP Simard -
The static function
Configuration.rulesFromDict(_:ruleList:)has been moved to an instance method:RuleList.configuredRulesWithDictionary(_:).
JP Simard -
The
rulesparameter in theConfigurationinitializer has been renamed toconfiguredRules.
JP Simard -
Removed a large number of declarations from the public SwiftLintFramework API. This is being done to minimize the API surface area in preparation of a 1.0 release. See #507 for a complete record of this change.
JP Simard #479 -
All instances of the abbreviation "config" in the API have been expanded to "configuration". The
--configcommand line parameter anduse_nested_configsconfiguration key are unaffected.
JP Simard -
The
use_nested_configsconfiguration key has been deprecated and its value is now ignored. Nested configuration files are now always considered.
JP Simard
Enhancements
-
swiftlint lintnow accepts an optional--reporterparameter which overrides existingreportervalues in the configuration file. Choose betweenxcode(default),json,csvorcheckstyle.
JP Simard #440 -
swiftlint rulesnow shows a configuration description for all rules.
JP Simard -
lintandautocorrectcommands now accept a--quietflag that prevents status messages likeLinting <file>&Done lintingfrom being logged.
JP Simard #386 -
All top-level keys in a configuration file that accept an array now also accept a single value.
e.g.included: Sourceis equivalent toincluded:\n - Source.
JP Simard #120 -
Improve performance of
FunctionParameterCountRule.
Norio Nomura -
Improve performance of
ColonRule.
Norio Nomura
Bug Fixes
-
Fix case sensitivity of keywords for
valid_docs.
Ankit Aggarwal #298 -
Fixed inconsistencies between violations & corrections in
StatementPositionRule.
JP Simard #466 -
A warning will now be logged when invalid top-level keys are included in the configuration file.
JP Simard #120 -
Fixed
LegacyConstructorRulefrom correcting legacy constructors in string literals.
JP Simard #466 -
Fixed an issue where
variable_nameortype_namewould always report a violation when configured with only awarningvalue on eithermin_lengthormax_length.
JP Simard #522
0.8.0: High Heat
Breaking
-
Setting only warning on
SeverityLevelsConfigrules now disables the error value.
Robin Kunde #409 -
enabled_ruleshas been renamed toopt_in_rules.
Daniel Beard
Enhancements
-
Add
whitelist_rulesrule whitelists in config files.
Daniel Beard #256 -
Improve performance of
ColonRule,LineLengthRule&syntaxKindsByLine.
Norio Nomura -
Add command to display rule description:
swiftlint rules <rule identifier>.
Tony Li #392 -
Add
FunctionParameterCountRule.
Denis Lebedev #415 -
Measure complexity of nested functions separately in
CyclomaticComplexityRule.
Denis Lebedev #424 -
Added exception for multi-line
if/guard/whileconditions to allow opening brace to be on a new line inOpeningBraceRule.
Scott Hoyt #355 -
The
rulescommand now prints a table containing values for:identifier,opt-in,correctable,enabled in your config&configuration.
JP Simard #392 -
Reduce maximum memory usage.
Norio Nomura
Bug Fixes
-
Fix more false positives in
ValidDocsRule.
diogoguimaraes #451 -
Fix
trailing_newlineautocorrect to handle more than one violation per line.
Daniel Beard #465 -
Fix complexity measurement for switch statements in
CyclomaticComplexityRule.
Denis Lebedev #461
0.7.2: Appliance Manual
Breaking
- None.
Enhancements
- None.
Bug Fixes
- Fix several false positives in
ValidDocsRule.
diogoguimaraes #375
0.7.1: Delicate Cycle
Breaking
- None.
Enhancements
-
Improve performance of
MissingDocsRule.
Norio Nomura -
Added
CustomRules.
Scott Hoyt #123 -
Added opt-in
ForceUnwrappingRuleto issue warnings for all forced unwrappings.
Benjamin Otto #55
Bug Fixes
- Fix several false positives in
ValidDocsRule.
diogoguimaraes #375
0.7.0: Automatic Permanent Press
Breaking
-
Replaced all uses of
XPCDictionarywith[String: SourceKitRepresentable].
JP Simard -
VariableNameMinLengthRuleandVariableNameMaxLengthRulehave been removed.VariableNameRulenow has this functionality.
Scott Hoyt -
ViolationLevelRulehas been removed. This functionality is now provided byConfigProviderRuleandSeverityLevelsConfig.
Scott Hoyt
Enhancements
-
TypeBodyLengthRulenow does not count comment or whitespace lines.
Marcelo Fabri #369 -
FunctionBodyLengthRulenow does not count comment or whitespace lines.
Marcelo Fabri #258 -
All
Rules are now configurable in at least their severity:SeverityConfig.
Scott Hoyt #371 #130 #268 -
TypeNameRuleandVariableNameRuleconform toConfigProviderRuleusingNameConfigto supportmin_length,max_length, andexcludednames.
Scott Hoyt #388 #259 #191 -
Add
CyclomaticComplexityRule.
Denis Lebedev
Bug Fixes
-
Fix crash caused by infinite recursion when using nested config files.
JP Simard #368 -
Fix crash when file contains NULL character.
Norio Nomura #379
0.6.0: Steam Cycle
Breaking
-
ParameterizedRuleis removed. UseConfigurableRuleinstead.
Scott Hoyt #353 -
To activate a
Rule, it must be added to the globalmasterRuleList.
Scott Hoyt
Enhancements
-
ConfigurableRuleprotocol allows for improved rule configuration. SeeCONTRIBUTINGfor more details.
Scott Hoyt #303 -
VariableNameMinLengthRulenow supports excluding certain variable names (e.g. "id").
Scott Hoyt #231 -
ViolationLevelRuleprovides defaultConfigurableRuleimplementation for rules that only need integer error and warning levels.
Scott Hoyt -
Add AutoCorrect for StatementPositionRule.
Raphael Randschau -
Add AutoCorrect for CommaRule.
Raphael Randschau -
Add AutoCorrect for LegacyConstructorRule.
Raphael Randschau -
Improve performance of
LineLengthRule.
Norio Nomura -
Add ConditionalBindingCascadeRule.
Aaron McTavish #202 -
Add LegacyConstantRule.
Aaron McTavish #319 -
Add opt-in rule to encourage checking
isEmptyover comparingcountto zero.
JP Simard #202 -
Add opt-in "Missing Docs" rule to detect undocumented public declarations.
JP Simard
Bug Fixes
- None.
0.5.6: Bug FixLint
Breaking
- None.
Enhancements
- Improve performance by reducing calls to SourceKit.
Norio Nomura
Bug Fixes
-
Fix homebrew deployment issues.
Norio Nomura -
AutoCorrect for TrailingNewlineRule only removes at most one line.
John Estropia -
valid_docsdid not detect tuple as return value.
Norio Nomura #324 -
Escape strings when using CSV reporter.
JP Simard
0.5.5: Magic Drying Fluff Balls™
http://www.amazon.com/Magic-Drying-Fluff-Balls-Softening/dp/B001EIW1SG
Breaking
- None.
Enhancements
- None.
Bug Fixes
-
Always fail if a YAML configuration file was found but could not be parsed.
JP Simard #310 -
Make commands with modifiers work for violations with line-only locations.
JP Simard #316
0.5.4: Bounce™
Breaking
- Remove
Location.init(file:offset:)in favor of the more explicitLocation.init(file:byteOffset:)&Location.init(file:characterOffset:).
JP Simard
Enhancements
-
Add
checkstylereporter to generate XML reports in the Checkstyle 4.3 format.
JP Simard #277 -
Support command comment modifiers (
previous,this&next) to limit the command's scope to a single line.
JP Simard #222 -
Add nested
.swiftlint.ymlconfiguration support.
Scott Hoyt #299
Bug Fixes
-
Fix an
NSRangeExceptioncrash.
Norio Nomura #294 -
The
valid_docsrule now handles multibyte characters.
Norio Nomura #295
0.5.3: Mountain Scent
Breaking
- None.
Enhancements
-
Improve autocorrect for OpeningBraceRule.
Yasuhiro Inami -
Add autocorrect for ColonRule.
Brian Partridge -
Add ClosingBraceRule.
Yasuhiro Inami
Bug Fixes
0.5.2: Snuggle™
Breaking
- None.
Enhancements
- Performance improvements & unicode fixes (via SourceKitten).
Norio Nomura
Bug Fixes
- Fix
ValidDocsRulefalse positive when documenting functions with closure parameters.
diogoguimaraes #267
0.5.1: Lint Tray Malfunction
Breaking
- None.
Enhancements
- None.
Bug Fixes
-
Make linting faster than 0.5.0, but slower than 0.4.0.
Norio Nomura #119 -
Re-introduce
--use-script-input-filesoption forlint&autocorrectcommands. Should also fix some issues when running SwiftLint from an Xcode build phase.
JP Simard #264
0.5.0: Downy™
Breaking
init()is no longer a member of theRuleprotocol.
JP Simard
Enhancements
-
Add legacy constructor rule.
Marcelo Fabri #202 -
The
VariableNameRulenow allows variable names when the entire name is capitalized. This allows stylistic usage common in cases likeURLand other acronyms.
Marcelo Fabri #161 -
Add
autocorrectcommand to automatically correct certain violations (currently onlytrailing_newline,trailing_semicolon&trailing_whitespace).
JP Simard #5 -
Allow to exclude files from
includeddirectory withexcluded.
Michal Laskowski
Bug Fixes
0.4.0: Wrinkle Release
Breaking
- API: Rename RuleExample to RuleDescription, remove StyleViolationType and
combine Rule().identifier and Rule().example into Rule.description.
JP Simard #183
Enhancements
-
The
VariableNameRulenow allows capitalized variable names when they are declared static. This allows stylistic usage common in cases likeOptionSetTypesubclasses.
Will Fleming -
Add
VariableNameMaxLengthRuleandVariableNameMinLengthRuleparameter rules. Remove length checks onVariableNameRule.
Mickael Morier -
Add trailing semicolon rule.
JP Simard -
Add force try rule.
JP Simard -
Support linting from Input Files provided by Run Script Phase of Xcode with
--use-script-input-files.
Norio Nomura #193
Bug Fixes
-
All rules now print their identifiers in reports.
JP Simard #180 -
ControlStatementRulenow detects all violations.
Mickael Morier #187 -
ControlStatementRuleno longer triggers a violation for acceptable use of parentheses.
Mickael Morier #189 -
Nesting rule no longer triggers a violation for enums nested one level deep.
JP Simard #190 -
ColonRulenow triggers a violation even if equal operator is collapse to type and value.
Mickael Morier #135 -
Fix an issue where logs would be printed asynchronously over each other.
JP Simard #200
0.3.0: Wrinkly Rules
Breaking
swiftlint rulesnow just prints a list of all available rules and their identifiers.
JP Simard
Enhancements
-
Support for Swift 2.1.
JP Simard -
Added
StatementPositionRuleto make sure that catch, else if and else statements are on the same line as closing brace preceding them and after one space.
Alex Culeva -
Added
Comma Ruleto ensure there is a single space after a comma.
Alex Culeva -
Add rule identifier to all linter reports.
zippy1978 -
Add
OpeningBraceRuleto make sure there is exactly a space before opening brace and it is on the same line as declaration.
Alex Culeva -
Print to stderr for all informational logs. Only reporter outputs is logged to stdout.
JP Simard -
JSON and CSV reporters now only print at the very end of the linting process.
JP Simard -
Add support for
guardstatements to ControlStatementRule.
David Potter -
Lint parameter variables.
JP Simard
Bug Fixes
0.2.0: Tumble Dry
Breaking
-
ViolationSeveritynow has an associated type ofStringand two members:.Warningand.Error.
JP Simard #113
Enhancements
-
Configure SwiftLint via a YAML file: Supports
disabled_rules,included,excludedand passing parameters to parameterized rules. Pass a configuration file path to--config, defaults to.swiftlint.yml.
JP Simard #1 #3 #20 #26 -
Updated
TypeNameRuleandVariableNameRuleto allow private type & variable names to start with an underscore.
JP Simard -
Disable and re-enable rules from within source code comments using
// swiftlint:disable $IDENTIFIERand// swiftlint:enable $IDENTIFIER.
JP Simard #4 -
Add
--strictlint flag which makes the lint fail if there are any warnings.
Keith Smiley -
Violations are now printed to stderr.
Keith Smiley -
Custom reporters are now supported. Specify a value for the
reporter:key in your configuration file. Available reporters arexcode(default),json,csv.
JP Simard #42
Bug Fixes
-
Improve performance of
TrailingWhitespaceRule.
Keith Smiley -
Allow newlines in function return arrow.
JP Simard
0.1.2: FabricSoftenerRule
Breaking
- None.
Enhancements
-
Added
OperatorFunctionWhitespaceRuleto make sure that you use whitespace around operators when defining them.
Akira Hirakawa #60 -
Added
ReturnArrowWhitespaceRuleto make sure that you have 1 space before return arrow and return type.
Akira Hirakawa -
Support linting from standard input (use
--use-stdin).
JP Simard #78 -
Improve performance of
TrailingNewlineRule.
Keith Smiley -
Lint parentheses around switch statements.
Keith Smiley
Bug Fixes
- None.
0.1.1: Top Loading
Breaking
-
The
RuleandASTRuleprotocol members are now non-static.
aarondaub -
Split
RuleintoRuleandParameterizedRuleprotocols.
aarondaub #21
Enhancements
-
Added a command line option
--pathto specify a path to lint.
Lars Lockefeer #16 -
swiftlint now returns a non-zero error code when a warning of high-severity or above is found in the source files being linted.
Pat Wallace #30 -
Added
rulescommand to display which rules are currently applied along with examples.
Chris Eidhof -
Cache parsing to reduce execution time by more than 50%.
Nikolaj Schumacher -
Added
ControlStatementRuleto make sure that if/for/while/do statements do not wrap their conditionals in parentheses.
Andrea Mazzini -
Character position is now included in violation location where appropriate.
JP Simard #62 -
The following rules now conform to
ASTRule: FunctionBodyLength, Nesting, TypeBodyLength, TypeName, VariableName.
JP Simard
Bug Fixes
0.1.0: Fresh Out Of The Dryer
First Version!