Releases: realm/SwiftLint
0.46.0: Detergent Container
Breaking
- The
weak_delegate
rule has been deprecated due to its high false
positive rate. The identifier will become invalid in a future
release.
JP Simard
#2786
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_value
for overrides.
Adrian Debbeler
#2585
Bug Fixes
-
Fix
convenience_type
false positives when using actors.
JP Simard
#3770 -
Fix false positives in the
prefer_self_in_static_references
rule.
SimplyDanny
#3768 -
Fix the regex for expiring TODO comments.
Sergei Shirokov
#3767 -
Fix crash when parsing multi-line attributes with the
attributes
rule.
JP Simard
#3761 -
Fix false positives in
unused_closure_parameter
when 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_references
rule to warn if the
type name is used to reference static members the same type.
Prefer usingSelf
instead 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_import
rule incorrectly consideringSwiftShims
as a
used import.
JP Simard -
Fix false positives on
large_tuple
rule when usingasync
closures.
Kaitlin Mahar
#3753 -
Fix false positive on
legacy_objc_type
rule 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_initialization
rule to catch uses ofself
inside an inline closure used for initializing a variable. In this case,
self
refers to theNSObject.self
method and likely won't be what you
expect. You can make the variablelazy
to be able to refer to the current
instance withself
or useMyClass.self
if you really want to reference
the method.
Marcelo Fabri -
Exclude
id
fromidentifier_name
by default.
Artem Garmash
#3651 -
Handle
get async
andget throws
(introduced in Swift 5.5) in the
implicit_getter
rule.
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_docs
rule where
excludes_inherited_types
would 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_switch
rule 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_docs
rule:excludes_extensions
defaults totrue
to skip reporting violations
for extensions with missing documentation comments.excludes_inherited_types
defaults totrue
to skip reporting
violations for inherited declarations, like subclass overrides.
Ben Fox
-
Fix false negative on
redundant_optional_initialization
rule when variable
has observers.
Isaac Ressler
#3621 -
Make
test_case_accessibility
rule identify invalid test functions
with parameters.
Keith Smiley
#3612 -
Add
duplicated_key_in_dictionary_literal
rule 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_name
opt-in rule to discourage naming cases and
static/class members "none", which can conflict with Swift's
Optional<T>.none
when checking equality.
Kane Cheshire
#3624 -
Improve language and positioning of
file_length
warnings when
ignore_comment_only_lines: true
.
Steven Grosmark
#3654 -
Add
anonymous_argument_in_multiline_closure
opt-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_arguments
rule when comparing values
with a static member (e.g.if number == .zero
).
Marcelo Fabri
#3562 -
Fix
type_contents_order
initializer detection.
StevenMagdy -
Fix autocorrect when there's no space between the tuple the
in
keyword
onunneeded_parentheses_in_closure_argument
rule.
p-x9
#3633 -
Fix
unused_capture_list
,empty_enum_arguments
,implicit_return
and
explicit_type_interface
rules when using Swift 5.4.
Marcelo Fabri
#3615
#3685 -
Fix Xcode build logs with spaces in paths preventing
analyze
from running.
adamawolf
0.43.1: Laundroformat
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 --help
orswiftlint -h
now work as expected.
The help output from various commands has greatly improved as well.
Notably:swiftlint autocorrect
was removed in favor of
swiftlint --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
/excluded
relative 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_observer
is now opt-in due to some
difficult to resolve false positives, such as
#3498.
JP Simard
Experimental
- None.
Enhancements
-
Added
allows_single_line
option inmultiline_parameters
rule
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_assert
to encourage the use of
assertionFailure()
and/orpreconditionFailure()
over
assert(false)
.
Otavio Cordeiro -
Adds
balanced_xctest_lifecycle
opt-in rule to enforce balancedsetUp
andtearDown
methods 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 therelated_usrs_to_skip
key.
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_iboutlet
rule correctable.
MaxHaertwig -
Add
legacy_objc_type
opt-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_spacing
rule.
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_variable
analyzer 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_import
by setting theSWIFTLINT_LOG_MODULE_USAGE=<module-name>
environment
variable when running analyze.
jpsim -
Add opt-in rule
private_subject
rule which warns against
public Combine subjects.
Otavio Cordeiro
Bug Fixes
-
Fix
custom_rules
merging when the parent configuration is based on
only_rules
.
Frederick Pietschmann
#3468 -
Fix misleading warnings about rules defined in the
custom_rules
not
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_name
rule.
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 inexplicit_self
rule.
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.43.0-rc.4: Clothes Line Interface
This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:
- Downloading the attached
SwiftLint.pkg
installer and launching it - Downloading the attached
portable_swiftlint.zip
archive, extracting it and moving the binary fromportable_swiftlint/swiftlint
to/usr/local/bin
or elsewhere in yourPATH
- Using Mint:
mint install realm/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.4 && make install
Changes from 0.43.0-rc.3: 0.43.0-rc.3...0.43.0-rc.4
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 --help
orswiftlint -h
now work as expected.
The help output from various commands has greatly improved as well.
Notably:swiftlint autocorrect
was removed in favor of
swiftlint --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
/excluded
relative 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_observer
is now opt-in due to some
difficult to resolve false positives, such as
#3498.
JP Simard
Experimental
- None.
Enhancements
-
Added
allows_single_line
option inmultiline_parameters
rule
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_assert
to encourage the use of
assertionFailure()
and/orpreconditionFailure()
over
assert(false)
.
Otavio Cordeiro -
Add opt-in rule
private_subject
rule which warns against
public Combine subjects.
Otavio Cordeiro -
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 therelated_usrs_to_skip
key.
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_iboutlet
rule correctable.
MaxHaertwig -
Add
legacy_objc_type
opt-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_spacing
rule.
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 -
Log references to a specified module when running the
unused_import
by setting theSWIFTLINT_LOG_MODULE_USAGE=<module-name>
environment
variable when running analyze.
jpsim
Bug Fixes
-
Fix
custom_rules
merging when the parent configuration is based on
only_rules
.
Frederick Pietschmann
#3468 -
Fix misleading warnings about rules defined in the
custom_rules
not
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_name
rule.
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 inexplicit_self
rule.
JP Simard -
Fix false positives with result builders in
unused_declaration
.
JP Simard
0.43.0-rc.3: Clothes Line Interface
This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:
- Downloading the attached
SwiftLint.pkg
installer and launching it - Downloading the attached
portable_swiftlint.zip
archive, extracting it and moving the binary fromportable_swiftlint/swiftlint
to/usr/local/bin
or elsewhere in yourPATH
- Using Mint:
mint install realm/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.3 && make install
Changes from 0.43.0-rc.2: 0.43.0-rc.2...0.43.0-rc.3
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 --help
orswiftlint -h
now work as expected.
The help output from various commands has greatly improved as well.
Notably:swiftlint autocorrect
was removed in favor of
swiftlint --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
Experimental
- None.
Enhancements
-
Added
allows_single_line
option inmultiline_parameters
rule
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_assert
to encourage the use of
assertionFailure()
and/orpreconditionFailure()
over
assert(false)
.
Otavio Cordeiro -
Add opt-in rule
private_subject
rule which warns against
public Combine subjects.
Otavio Cordeiro -
Allow configuring related USRs to skip in UnusedDeclarationRule by
specifying a list of USRs in therelated_usrs_to_skip
key.
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
Bug Fixes
0.43.0-rc.2: Clothes Line Interface
This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:
- Downloading the attached
SwiftLint.pkg
installer and launching it - Downloading the attached
portable_swiftlint.zip
archive, extracting it and moving the binary fromportable_swiftlint/swiftlint
to/usr/local/bin
or elsewhere in yourPATH
- Using Mint:
mint install realm/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.2 && make install
Changes from 0.43.0-rc.1: 0.43.0-rc.1...0.43.0-rc.2
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 --help
orswiftlint -h
now work as expected.
The help output from various commands has greatly improved as well.
Notably:swiftlint autocorrect
was removed in favor of
swiftlint --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
Experimental
- None.
Enhancements
-
Support relative paths in compilation databases for SwiftLint analyzer
rules.
JP Simard -
Add opt-in rule
discouraged_assert
to encourage the use of
assertionFailure()
and/orpreconditionFailure()
over
assert(false)
.
Otavio Cordeiro
Bug Fixes
0.43.0-rc.1: Clothes Line Interface
This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:
- Downloading the attached
SwiftLint.pkg
installer and launching it - Downloading the attached
portable_swiftlint.zip
archive, extracting it and moving the binary fromportable_swiftlint/swiftlint
to/usr/local/bin
or elsewhere in yourPATH
- Using Mint:
mint install realm/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.43.0-rc.1 && make install
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 --help
orswiftlint -h
now work as expected.
The help output from various commands has greatly improved as well.
Notably:swiftlint autocorrect
was removed in favor of
swiftlint --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
Experimental
- None.
Enhancements
- Support relative paths in compilation databases for SwiftLint analyzer
rules.
JP Simard
Bug Fixes
- Fix typos in configuration options for
file_name
rule.
advantis