SwiftLint v0.28.0 Release Notes
-
๐ฅ Breaking
- ๐ Completely remove the
--use-tabs
option of theautocorrect
command that was deprecated in 0.24.1. In its place, define anindentation
key in your configuration files.
JP Simard
Experimental
โ Add a new
swiftlint analyze
command which can lint Swift files using the full type-checked AST. Rules of theAnalyzerRule
type will be added over time. The compiler log path containing the cleanswiftc
build command invocation (incremental builds will fail) must be passed toanalyze
via the--compiler-log-path
flag. e.g.--compiler-log-path /path/to/xcodebuild.log
JP Simardโ Add an
explicit_self
analyzer rule to enforce the use of explicit references toself.
when accessing instance variables or functions.
JP Simard #321โ Add an
unused_import
analyzer rule to lint for unnecessary imports.
JP Simard #2248Add an
unused_private_declaration
analyzer rule to lint for unused private declarations.
JP Simard
โจ Enhancements
โ Add
legacy_random
opt-in rule to encourage the use of.random(in:)
instead ofarc4random
,arc4random_uniform
, anddrand48
.
Joshua Kaplan๐ Improve performance of
line_length
andmultiple_closures_with_trailing_closure
rules.
Marcelo FabriAdd
closure_body_length
opt-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 #2350Add
prohibited_interface_builder
opt-in rule to validate that@IBOutlet
s and@IBAction
s are not used.
Marcelo Fabri #2365โ Add
inert_defer
rule to validate thatdefer
is not used at the end of a scope.
Marcelo Fabri #2123โ Add
toggle_bool
opt-in rule which suggests usingsomeBool.toggle()
oversomeBool = !someBool
. Requires Swift 4.2.
Dalton Claybrook #2369โ Add
identical_operands
opt-in rule to validate that operands are different expressions in comparisons.
Marcelo Fabri #1371โ Add
collection_alignment
opt-in rule to validate that all elements in a collection literal are aligned vertically.
Dalton Claybrook #2326โ Add
static_operator
opt-in rule to enforce that operators are declared as static functions instead of free functions.
Marcelo Fabri #2395Specify what type of compiler protocol initializer violated the
compiler_protocol_init
rule.
Timofey Solonin #2422
๐ Bug Fixes
๐ Fix
comma
rule false positives on object literals (for example, images).
Marcelo Fabri #2345๐ Fix false positive on
file_name
rule when using nested types.
Marcelo Fabri #2325Fix crash on
multiline_function_chains
rule when using some special characters inside the function calls.
Marcelo Fabri #2360๐ Change
autocorrect --format
to 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_count
rule when assessing binary, octal and hexadecimal integer literals.
Timofey Solonin #2423
- ๐ Completely remove the