- Array Init
- Attributes
- Block Based KVO
- Class Delegate Protocol
- Closing Brace Spacing
- Closure End Indentation
- Closure Parameter Position
- Closure Spacing
- Colon
- Comma Spacing
- Compiler Protocol Init
- Conditional Returns on Newline
- Contains over first not nil
- Control Statement
- Custom Rules
- Cyclomatic Complexity
- Discarded Notification Center Observer
- Discouraged Direct Initialization
- Dynamic Inline
- Empty Count
- Empty Enum Arguments
- Empty Parameters
- Empty Parentheses with Trailing Closure
- Explicit Enum Raw Value
- Explicit Init
- Explicit Top Level ACL
- Explicit Type Interface
- Extension Access Modifier
- Fallthrough
- Fatal Error Message
- File Header
- File Line Length
- First Where
- For Where
- Force Cast
- Force Try
- Force Unwrapping
- Function Body Length
- Function Parameter Count
- Generic Type Name
- Identifier Name
- Implicit Getter
- Implicit Return
- Implicitly Unwrapped Optional
- Is Disjoint
- Joined Default Parameter
- Large Tuple
- Leading Whitespace
- Legacy CGGeometry Functions
- Legacy Constant
- Legacy Constructor
- Legacy NSGeometry Functions
- Variable Declaration Whitespace
- Line Length
- Literal Expression End Indentation
- Mark
- Multiline Arguments
- Multiline Parameters
- Multiple Closures with Trailing Closure
- Nesting
- Nimble Operator
- No Extension Access Modifier
- No Grouping Extension
- Notification Center Detachment
- Number Separator
- Object Literal
- Opening Brace Spacing
- Operator Usage Whitespace
- Operator Function Whitespace
- Overridden methods call super
- Override in Extension
- Pattern Matching Keywords
- Private Actions
- Private Outlets
- Private over fileprivate
- Private Unit Test
- Prohibited calls to super
- Protocol Property Accessors Order
- Quick Discouraged Call
- Quick Discouraged Focused Test
- Quick Discouraged Pending Test
- Redundant Discardable Let
- Redundant Nil Coalescing
- Redundant Optional Initialization
- Redundant String Enum Value
- Redundant Void Return
- Returning Whitespace
- Shorthand Operator
- Single Test Class
- Min or Max over Sorted First or Last
- Sorted Imports
- Statement Position
- Strict fileprivate
- Superfluous Disable Command
- Switch and Case Statement Alignment
- Switch Case on Newline
- Syntactic Sugar
- Todo
- Trailing Closure
- Trailing Comma
- Trailing Newline
- Trailing Semicolon
- Trailing Whitespace
- Type Body Length
- Type Name
- Unneeded Break in Switch
- Unneeded Parentheses in Closure Argument
- Unused Closure Parameter
- Unused Enumerated
- Unused Optional Binding
- Valid IBInspectable
- Vertical Parameter Alignment
- Vertical Parameter Alignment On Call
- Vertical Whitespace
- Void Return
- Weak Delegate
- XCTFail Message
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
array_init |
Disabled | No | lint |
Prefer using Array(seq) than seq.map { $0 } to convert a sequence into an Array.
Non Triggering Examples
Array(foo)
foo.map { $0.0 }
foo.map { $1 }
foo.map { $0() }
foo.map { ((), $0) }
foo.map { $0! }
foo.map { $0! /* force unwrap */ }
foo.something { RouteMapper.map($0) }
Triggering Examples
↓foo.map({ $0 })
↓foo.map { $0 }
↓foo.map { return $0 }
↓foo.map { elem in
elem
}
↓foo.map { elem in
return elem
}
↓foo.map { (elem: String) in
elem
}
↓foo.map { elem -> String in
elem
}
↓foo.map { $0 /* a comment */ }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
attributes |
Disabled | No | style |
Attributes should be on their own lines in functions and types, but on the same line as variables and imports.
Non Triggering Examples
@objc var x: String
@objc private var x: String
@nonobjc var x: String
@IBOutlet private var label: UILabel
@IBOutlet @objc private var label: UILabel
@NSCopying var name: NSString
@NSManaged var name: String?
@IBInspectable var cornerRadius: CGFloat
@available(iOS 9.0, *)
let stackView: UIStackView
@NSManaged func addSomeObject(book: SomeObject)
@IBAction func buttonPressed(button: UIButton)
@objc
@IBAction func buttonPressed(button: UIButton)
@available(iOS 9.0, *)
func animate(view: UIStackView)
@available(iOS 9.0, *, message="A message")
func animate(view: UIStackView)
@nonobjc
final class X
@available(iOS 9.0, *)
class UIStackView
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate
@UIApplicationMain
class AppDelegate: NSObject, UIApplicationDelegate
@IBDesignable
class MyCustomView: UIView
@testable import SourceKittenFramework
@objc(foo_x)
var x: String
@available(iOS 9.0, *)
@objc(abc_stackView)
let stackView: UIStackView
@objc(abc_addSomeObject:)
@NSManaged func addSomeObject(book: SomeObject)
@objc(ABCThing)
@available(iOS 9.0, *)
class Thing
class Foo: NSObject {
override var description: String { return "" }
}
class Foo: NSObject {
override func setUp() {}
}
@objc
class ⽺ {}
extension Property {
@available(*, unavailable, renamed: "isOptional")
public var optional: Bool { fatalError() }
}
@GKInspectable var maxSpeed: Float
@discardableResult
func a() -> Int
@objc
@discardableResult
func a() -> Int
func increase(f: @autoclosure () -> Int) -> Int
func foo(completionHandler: @escaping () -> Void)
Triggering Examples
@objc
↓var x: String
@objc
↓var x: String
@objc
private ↓var x: String
@nonobjc
↓var x: String
@IBOutlet
private ↓var label: UILabel
@IBOutlet
private ↓var label: UILabel
@NSCopying
↓var name: NSString
@NSManaged
↓var name: String?
@IBInspectable
↓var cornerRadius: CGFloat
@available(iOS 9.0, *) ↓let stackView: UIStackView
@NSManaged
↓func addSomeObject(book: SomeObject)
@IBAction
↓func buttonPressed(button: UIButton)
@IBAction
@objc
↓func buttonPressed(button: UIButton)
@available(iOS 9.0, *) ↓func animate(view: UIStackView)
@nonobjc final ↓class X
@available(iOS 9.0, *) ↓class UIStackView
@available(iOS 9.0, *)
@objc ↓class UIStackView
@available(iOS 9.0, *) @objc
↓class UIStackView
@available(iOS 9.0, *)
↓class UIStackView
@UIApplicationMain ↓class AppDelegate: NSObject, UIApplicationDelegate
@IBDesignable ↓class MyCustomView: UIView
@testable
↓import SourceKittenFramework
@testable
↓import SourceKittenFramework
@objc(foo_x) ↓var x: String
@available(iOS 9.0, *) @objc(abc_stackView)
↓let stackView: UIStackView
@objc(abc_addSomeObject:) @NSManaged
↓func addSomeObject(book: SomeObject)
@objc(abc_addSomeObject:)
@NSManaged
↓func addSomeObject(book: SomeObject)
@available(iOS 9.0, *)
@objc(ABCThing) ↓class Thing
@GKInspectable
↓var maxSpeed: Float
@discardableResult ↓func a() -> Int
@objc
@discardableResult ↓func a() -> Int
@objc
@discardableResult
↓func a() -> Int
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
block_based_kvo |
Enabled | No | idiomatic |
Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.
Non Triggering Examples
let observer = foo.observe(\.value, options: [.new]) { (foo, change) in
print(change.newValue)
}
Triggering Examples
class Foo: NSObject {
override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
change: [NSKeyValueChangeKey : Any]?,
context: UnsafeMutableRawPointer?) {}
}
class Foo: NSObject {
override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
change: Dictionary<NSKeyValueChangeKey, Any>?,
context: UnsafeMutableRawPointer?) {}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
class_delegate_protocol |
Enabled | No | lint |
Delegate protocols should be class-only so they can be weakly referenced.
Non Triggering Examples
protocol FooDelegate: class {}
protocol FooDelegate: class, BarDelegate {}
protocol Foo {}
class FooDelegate {}
@objc protocol FooDelegate {}
@objc(MyFooDelegate)
protocol FooDelegate {}
protocol FooDelegate: BarDelegate {}
protocol FooDelegate: AnyObject {}
protocol FooDelegate: NSObjectProtocol {}
Triggering Examples
↓protocol FooDelegate {}
↓protocol FooDelegate: Bar {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
closing_brace |
Enabled | Yes | style |
Closing brace with closing parenthesis should not have any whitespaces in the middle.
Non Triggering Examples
[].map({ })
[].map(
{ }
)
Triggering Examples
[].map({ ↓} )
[].map({ ↓} )
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
closure_end_indentation |
Disabled | No | style |
Closure end should have the same indentation as the line that started it.
Non Triggering Examples
SignalProducer(values: [1, 2, 3])
.startWithNext { number in
print(number)
}
[1, 2].map { $0 + 1 }
return match(pattern: pattern, with: [.comment]).flatMap { range in
return Command(string: contents, range: range)
}.flatMap { command in
return command.expand()
}
foo(foo: bar,
options: baz) { _ in }
someReallyLongProperty.chainingWithAnotherProperty
.foo { _ in }
foo(abc, 123)
{ _ in }
Triggering Examples
SignalProducer(values: [1, 2, 3])
.startWithNext { number in
print(number)
↓}
return match(pattern: pattern, with: [.comment]).flatMap { range in
return Command(string: contents, range: range)
↓}.flatMap { command in
return command.expand()
↓}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
closure_parameter_position |
Enabled | No | style |
Closure parameters should be on the same line as opening brace.
Non Triggering Examples
[1, 2].map { $0 + 1 }
[1, 2].map({ $0 + 1 })
[1, 2].map { number in
number + 1
}
[1, 2].map { number -> Int in
number + 1
}
[1, 2].map { (number: Int) -> Int in
number + 1
}
[1, 2].map { [weak self] number in
number + 1
}
[1, 2].something(closure: { number in
number + 1
})
let isEmpty = [1, 2].isEmpty()
rlmConfiguration.migrationBlock.map { rlmMigration in
return { migration, schemaVersion in
rlmMigration(migration.rlmMigration, schemaVersion)
}
}
let mediaView: UIView = { [weak self] index in
return UIView()
}(index)
Triggering Examples
[1, 2].map {
↓number in
number + 1
}
[1, 2].map {
↓number -> Int in
number + 1
}
[1, 2].map {
(↓number: Int) -> Int in
number + 1
}
[1, 2].map {
[weak self] ↓number in
number + 1
}
[1, 2].map { [weak self]
↓number in
number + 1
}
[1, 2].map({
↓number in
number + 1
})
[1, 2].something(closure: {
↓number in
number + 1
})
[1, 2].reduce(0) {
↓sum, ↓number in
number + sum
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
closure_spacing |
Disabled | Yes | style |
Closure expressions should have a single space inside each brace.
Non Triggering Examples
[].map ({ $0.description })
[].filter { $0.contains(location) }
extension UITableViewCell: ReusableView { }
extension UITableViewCell: ReusableView {}
Triggering Examples
[].filter(↓{$0.contains(location)})
[].map(↓{$0})
(↓{each in return result.contains(where: ↓{e in return e}) }).count
filter ↓{ sorted ↓{ $0 < $1}}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
colon |
Enabled | Yes | style |
Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.
Non Triggering Examples
let abc: Void
let abc: [Void: Void]
let abc: (Void, Void)
let abc: ([Void], String, Int)
let abc: [([Void], String, Int)]
let abc: String="def"
let abc: Int=0
let abc: Enum=Enum.Value
func abc(def: Void) {}
func abc(def: Void, ghi: Void) {}
// 周斌佳年周斌佳
let abc: String = "abc:"
let abc = [Void: Void]()
let abc = [1: [3: 2], 3: 4]
let abc = ["string": "string"]
let abc = ["string:string": "string"]
let abc: [String: Int]
func foo(bar: [String: Int]) {}
func foo() -> [String: Int] { return [:] }
let abc: Any
let abc: [Any: Int]
let abc: [String: Any]
class Foo: Bar {}
class Foo<T: Equatable> {}
switch foo {
case .bar:
_ = something()
}
object.method(x: 5, y: "string")
object.method(x: 5, y:
"string")
object.method(5, y: "string")
Triggering Examples
let ↓abc:Void
let ↓abc: Void
let ↓abc :Void
let ↓abc : Void
let ↓abc : [Void: Void]
let ↓abc : (Void, String, Int)
let ↓abc : ([Void], String, Int)
let ↓abc : [([Void], String, Int)]
let ↓abc: (Void, String, Int)
let ↓abc: ([Void], String, Int)
let ↓abc: [([Void], String, Int)]
let ↓abc :String="def"
let ↓abc :Int=0
let ↓abc :Int = 0
let ↓abc:Int=0
let ↓abc:Int = 0
let ↓abc:Enum=Enum.Value
func abc(↓def:Void) {}
func abc(↓def: Void) {}
func abc(↓def :Void) {}
func abc(↓def : Void) {}
func abc(def: Void, ↓ghi :Void) {}
let abc = [Void↓:Void]()
let abc = [Void↓ : Void]()
let abc = [Void↓: Void]()
let abc = [Void↓ : Void]()
let abc = [1: [3↓ : 2], 3: 4]
let abc = [1: [3↓ : 2], 3↓: 4]
let abc: [↓String : Int]
let abc: [↓String:Int]
func foo(bar: [↓String : Int]) {}
func foo(bar: [↓String:Int]) {}
func foo() -> [↓String : Int] { return [:] }
func foo() -> [↓String:Int] { return [:] }
let ↓abc : Any
let abc: [↓Any : Int]
let abc: [↓String : Any]
class ↓Foo : Bar {}
class ↓Foo:Bar {}
class Foo<↓T:Equatable> {}
class Foo<↓T : Equatable> {}
object.method(x: 5, y↓ : "string")
object.method(x↓:5, y: "string")
object.method(x↓: 5, y: "string")
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
comma |
Enabled | Yes | style |
There should be no space before and one after any comma.
Non Triggering Examples
func abc(a: String, b: String) { }
abc(a: "string", b: "string"
enum a { case a, b, c }
func abc(
a: String, // comment
bcd: String // comment
) {
}
func abc(
a: String,
bcd: String
) {
}
Triggering Examples
func abc(a: String↓ ,b: String) { }
func abc(a: String↓ ,b: String↓ ,c: String↓ ,d: String) { }
abc(a: "string"↓,b: "string"
enum a { case a↓ ,b }
let result = plus(
first: 3↓ , // #683
second: 4
)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
compiler_protocol_init |
Enabled | No | lint |
The initializers declared in compiler protocols such as ExpressibleByArrayLiteral
shouldn't be called directly.
Non Triggering Examples
let set: Set<Int> = [1, 2]
let set = Set(array)
Triggering Examples
let set = ↓Set(arrayLiteral: 1, 2)
let set = ↓Set.init(arrayLiteral: 1, 2)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
conditional_returns_on_newline |
Disabled | No | style |
Conditional statements should always return on the next line
Non Triggering Examples
guard true else {
return true
}
guard true,
let x = true else {
return true
}
if true else {
return true
}
if true,
let x = true else {
return true
}
if textField.returnKeyType == .Next {
if true { // return }
/*if true { */ return }
Triggering Examples
↓guard true else { return }
↓if true { return }
↓if true { break } else { return }
↓if true { break } else { return }
↓if true { return "YES" } else { return "NO" }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
contains_over_first_not_nil |
Disabled | No | performance |
Prefer contains
over first(where:) != nil
Non Triggering Examples
let first = myList.first(where: { $0 % 2 == 0 })
let first = myList.first { $0 % 2 == 0 }
Triggering Examples
↓myList.first { $0 % 2 == 0 } != nil
↓myList.first(where: { $0 % 2 == 0 }) != nil
↓myList.map { $0 + 1 }.first(where: { $0 % 2 == 0 }) != nil
↓myList.first(where: someFunction) != nil
↓myList.map { $0 + 1 }.first { $0 % 2 == 0 } != nil
(↓myList.first { $0 % 2 == 0 }) != nil
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
control_statement |
Enabled | No | style |
if,for,while,do,catch statements shouldn't wrap their conditionals or arguments in parentheses.
Non Triggering Examples
if condition {
if (a, b) == (0, 1) {
if (a || b) && (c || d) {
if (min...max).contains(value) {
if renderGif(data) {
renderGif(data)
for item in collection {
for (key, value) in dictionary {
for (index, value) in enumerate(array) {
for var index = 0; index < 42; index++ {
guard condition else {
while condition {
} while condition {
do { ; } while condition {
switch foo {
do {
} catch let error as NSError {
}
Triggering Examples
↓if (condition) {
↓if(condition) {
↓if ((a || b) && (c || d)) {
↓if ((min...max).contains(value)) {
↓for (item in collection) {
↓for (var index = 0; index < 42; index++) {
↓for(item in collection) {
↓for(var index = 0; index < 42; index++) {
↓guard (condition) else {
↓while (condition) {
↓while(condition) {
} ↓while (condition) {
} ↓while(condition) {
do { ; } ↓while(condition) {
do { ; } ↓while (condition) {
↓switch (foo) {
do {
} ↓catch(let error as NSError) {
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
custom_rules |
Enabled | No | style |
Create custom rules by providing a regex string. Optionally specify what syntax kinds to match against, the severity level, and what message to display.
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
cyclomatic_complexity |
Enabled | No | metrics |
Complexity of function bodies should be limited.
Non Triggering Examples
func f1() {
if true {
for _ in 1..5 { } }
if false { }
}
func f(code: Int) -> Int {switch code {
case 0: fallthrough
case 0: return 1
case 0: return 1
case 0: return 1
case 0: return 1
case 0: return 1
case 0: return 1
case 0: return 1
case 0: return 1
default: return 1}}
func f1() {if true {}; if true {}; if true {}; if true {}; if true {}; if true {}
func f2() {
if true {}; if true {}; if true {}; if true {}; if true {}
}}
Triggering Examples
↓func f1() {
if true {
if true {
if false {}
}
}
if false {}
let i = 0
switch i {
case 1: break
case 2: break
case 3: break
case 4: break
default: break
}
for _ in 1...5 {
guard true else {
return
}
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
discarded_notification_center_observer |
Enabled | No | lint |
When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later.
Non Triggering Examples
let foo = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
let foo = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
func foo() -> Any {
return nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
}
Triggering Examples
↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
@discardableResult func foo() -> Any {
return ↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
discouraged_direct_init |
Enabled | No | lint |
Discouraged direct initialization of types that can be harmful.
Non Triggering Examples
let foo = UIDevice.current
let foo = Bundle.main
let foo = Bundle(path: "bar")
let foo = Bundle(identifier: "bar")
let foo = Bundle.init(path: "bar")
let foo = Bundle.init(identifier: "bar")
Triggering Examples
↓UIDevice()
↓Bundle()
let foo = ↓UIDevice()
let foo = ↓Bundle()
let foo = bar(bundle: ↓Bundle(), device: ↓UIDevice())
↓UIDevice.init()
↓Bundle.init()
let foo = ↓UIDevice.init()
let foo = ↓Bundle.init()
let foo = bar(bundle: ↓Bundle.init(), device: ↓UIDevice.init())
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
dynamic_inline |
Enabled | No | lint |
Avoid using 'dynamic' and '@inline(__always)' together.
Non Triggering Examples
class C {
dynamic func f() {}}
class C {
@inline(__always) func f() {}}
class C {
@inline(never) dynamic func f() {}}
Triggering Examples
class C {
@inline(__always) dynamic ↓func f() {}
}
class C {
@inline(__always) public dynamic ↓func f() {}
}
class C {
@inline(__always) dynamic internal ↓func f() {}
}
class C {
@inline(__always)
dynamic ↓func f() {}
}
class C {
@inline(__always)
dynamic
↓func f() {}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
empty_count |
Disabled | No | performance |
Prefer checking isEmpty
over comparing count
to zero.
Non Triggering Examples
var count = 0
[Int]().isEmpty
[Int]().count > 1
[Int]().count == 1
discount == 0
order.discount == 0
Triggering Examples
[Int]().↓count == 0
[Int]().↓count > 0
[Int]().↓count != 0
↓count == 0
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
empty_enum_arguments |
Enabled | Yes | style |
Arguments can be omitted when matching enums with associated types if they are not used.
Non Triggering Examples
switch foo {
case .bar: break
}
switch foo {
case .bar(let x): break
}
switch foo {
case let .bar(x): break
}
switch (foo, bar) {
case (_, _): break
}
switch foo {
case "bar".uppercased(): break
}
switch (foo, bar) {
case (_, _) where !something: break
}
Triggering Examples
switch foo {
case .bar↓(_): break
}
switch foo {
case .bar↓(): break
}
switch foo {
case .bar↓(_), .bar2↓(_): break
}
switch foo {
case .bar↓() where method() > 2: break
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
empty_parameters |
Enabled | Yes | style |
Prefer () ->
over Void ->
.
Non Triggering Examples
let abc: () -> Void = {}
func foo(completion: () -> Void)
func foo(completion: () thows -> Void)
let foo: (ConfigurationTests) -> Void throws -> Void)
let foo: (ConfigurationTests) -> Void throws -> Void)
let foo: (ConfigurationTests) ->Void throws -> Void)
Triggering Examples
let abc: ↓(Void) -> Void = {}
func foo(completion: ↓(Void) -> Void)
func foo(completion: ↓(Void) throws -> Void)
let foo: ↓(Void) -> () throws -> Void)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
empty_parentheses_with_trailing_closure |
Enabled | Yes | style |
When using trailing closures, empty parentheses should be avoided after the method call.
Non Triggering Examples
[1, 2].map { $0 + 1 }
[1, 2].map({ $0 + 1 })
[1, 2].reduce(0) { $0 + $1 }
[1, 2].map { number in
number + 1
}
let isEmpty = [1, 2].isEmpty()
UIView.animateWithDuration(0.3, animations: {
self.disableInteractionRightView.alpha = 0
}, completion: { _ in
()
})
Triggering Examples
[1, 2].map↓() { $0 + 1 }
[1, 2].map↓( ) { $0 + 1 }
[1, 2].map↓() { number in
number + 1
}
[1, 2].map↓( ) { number in
number + 1
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
explicit_enum_raw_value |
Disabled | No | idiomatic |
Enums should be explicitly assigned their raw values.
Non Triggering Examples
enum Numbers {
case int(Int)
case short(Int16)
}
enum Numbers: Int {
case one = 1
case two = 2
}
enum Numbers: Double {
case one = 1.1
case two = 2.2
}
enum Numbers: String {
case one = "one"
case two = "two"
}
protocol Algebra {}
enum Numbers: Algebra {
case one
}
Triggering Examples
enum Numbers: Int {
case one = 10, ↓two, three = 30
}
enum Numbers: NSInteger {
case ↓one
}
enum Numbers: String {
case ↓one
case ↓two
}
enum Numbers: String {
case ↓one, two = "two"
}
enum Numbers: Decimal {
case ↓one, ↓two
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
explicit_init |
Disabled | Yes | idiomatic |
Explicitly calling .init() should be avoided.
Non Triggering Examples
import Foundation; class C: NSObject { override init() { super.init() }}
struct S { let n: Int }; extension S { init() { self.init(n: 1) } }
[1].flatMap(String.init)
[String.self].map { $0.init(1) }
[String.self].map { type in type.init(1) }
Triggering Examples
[1].flatMap{String↓.init($0)}
[String.self].map { Type in Type↓.init(1) }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
explicit_top_level_acl |
Disabled | No | idiomatic |
Top-level declarations should specify Access Control Level keywords explicitly.
Non Triggering Examples
internal enum A {}
public final class B {}
private struct C {}
internal enum A {
enum B {}
}
internal final class Foo {}
internal
class Foo {}
internal func a() {}
Triggering Examples
enum A {}
final class B {}
struct C {}
func a() {}
internal let a = 0
func b() {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
explicit_type_interface |
Disabled | No | idiomatic |
Properties should have a type interface
Non Triggering Examples
class Foo {
var myVar: Int? = 0
}
class Foo {
let myVar: Int? = 0
}
class Foo {
static var myVar: Int? = 0
}
class Foo {
class var myVar: Int? = 0
}
Triggering Examples
class Foo {
↓var myVar = 0
}
class Foo {
↓let mylet = 0
}
class Foo {
↓static var myStaticVar = 0
}
class Foo {
↓class var myClassVar = 0
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
extension_access_modifier |
Disabled | No | idiomatic |
Prefer to use extension access modifiers
Non Triggering Examples
extension Foo: SomeProtocol {
public var bar: Int { return 1 }
}
extension Foo {
private var bar: Int { return 1 }
public var baz: Int { return 1 }
}
extension Foo {
private var bar: Int { return 1 }
public func baz() {}
}
extension Foo {
var bar: Int { return 1 }
var baz: Int { return 1 }
}
public extension Foo {
var bar: Int { return 1 }
var baz: Int { return 1 }
}
extension Foo {
private bar: Int { return 1 }
private baz: Int { return 1 }
}
extension Foo {
open bar: Int { return 1 }
open baz: Int { return 1 }
}
Triggering Examples
↓extension Foo {
public var bar: Int { return 1 }
public var baz: Int { return 1 }
}
↓extension Foo {
public var bar: Int { return 1 }
public func baz() {}
}
public extension Foo {
public ↓func bar() {}
public ↓func baz() {}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
fallthrough |
Enabled | No | idiomatic |
Fallthrough should be avoided.
Non Triggering Examples
switch foo {
case .bar, .bar2, .bar3:
something()
}
Triggering Examples
switch foo {
case .bar:
↓fallthrough
case .bar2:
something()
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
fatal_error_message |
Disabled | No | idiomatic |
A fatalError call should have a message.
Non Triggering Examples
func foo() {
fatalError("Foo")
}
func foo() {
fatalError(x)
}
Triggering Examples
func foo() {
↓fatalError("")
}
func foo() {
↓fatalError()
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
file_header |
Disabled | No | style |
Header comments should be consistent with project patterns.
Non Triggering Examples
let foo = "Copyright"
let foo = 2 // Copyright
let foo = 2
// Copyright
Triggering Examples
// ↓Copyright
//
// ↓Copyright
//
// FileHeaderRule.swift
// SwiftLint
//
// Created by Marcelo Fabri on 27/11/16.
// ↓Copyright © 2016 Realm. All rights reserved.
//
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
file_length |
Enabled | No | metrics |
Files should not span too many lines.
Non Triggering Examples
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
Triggering Examples
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
print("swiftlint")
//
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
first_where |
Disabled | No | performance |
Prefer using .first(where:)
over .filter { }.first
in collections.
Non Triggering Examples
kinds.filter(excludingKinds.contains).isEmpty && kinds.first == .identifier
myList.first(where: { $0 % 2 == 0 })
match(pattern: pattern).filter { $0.first == .identifier }
(myList.filter { $0 == 1 }.suffix(2)).first
Triggering Examples
↓myList.filter { $0 % 2 == 0 }.first
↓myList.filter({ $0 % 2 == 0 }).first
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).first
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).first?.something()
↓myList.filter(someFunction).first
↓myList.filter({ $0 % 2 == 0 })
.first
(↓myList.filter { $0 == 1 }).first
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
for_where |
Enabled | No | idiomatic |
where
clauses are preferred over a single if
inside a for
.
Non Triggering Examples
for user in users where user.id == 1 { }
for user in users {
if let id = user.id { }
}
for user in users {
if var id = user.id { }
}
for user in users {
if user.id == 1 { } else { }
}
for user in users {
if user.id == 1 {
} else if user.id == 2 { }
}
for user in users {
if user.id == 1 { }
print(user)
}
for user in users {
let id = user.id
if id == 1 { }
}
for user in users {
if user.id == 1 { }
return true
}
for user in users {
if user.id == 1 && user.age > 18 { }
}
Triggering Examples
for user in users {
↓if user.id == 1 { return true }
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
force_cast |
Enabled | No | idiomatic |
Force casts should be avoided.
Non Triggering Examples
NSNumber() as? Int
Triggering Examples
NSNumber() ↓as! Int
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
force_try |
Enabled | No | idiomatic |
Force tries should be avoided.
Non Triggering Examples
func a() throws {}; do { try a() } catch {}
Triggering Examples
func a() throws {}; ↓try! a()
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
force_unwrapping |
Disabled | No | idiomatic |
Force unwrapping should be avoided.
Non Triggering Examples
if let url = NSURL(string: query)
navigationController?.pushViewController(viewController, animated: true)
let s as! Test
try! canThrowErrors()
let object: Any!
@IBOutlet var constraints: [NSLayoutConstraint]!
setEditing(!editing, animated: true)
navigationController.setNavigationBarHidden(!navigationController.navigationBarHidden, animated: true)
if addedToPlaylist && (!self.selectedFilters.isEmpty || self.searchBar?.text?.isEmpty == false) {}
print("\(xVar)!")
var test = (!bar)
var a: [Int]!
private var myProperty: (Void -> Void)!
func foo(_ options: [AnyHashable: Any]!) {
Triggering Examples
let url = NSURL(string: query)↓!
navigationController↓!.pushViewController(viewController, animated: true)
let unwrapped = optional↓!
return cell↓!
let url = NSURL(string: "http://www.google.com")↓!
let dict = ["Boooo": "👻"]func bla() -> String { return dict["Boooo"]↓! }
let dict = ["Boooo": "👻"]func bla() -> String { return dict["Boooo"]↓!.contains("B") }
let a = dict["abc"]↓!.contains("B")
dict["abc"]↓!.bar("B")
if dict["a"]↓!!!! {
var foo: [Bool]! = dict["abc"]↓!
context("abc") {
var foo: [Bool]! = dict["abc"]↓!
}
open var computed: String { return foo.bar↓! }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
function_body_length |
Enabled | No | metrics |
Functions bodies should not span too many lines.
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
function_parameter_count |
Enabled | No | metrics |
Number of function parameters should be low.
Non Triggering Examples
init(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
init (a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
`init`(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
init?(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
init?<T>(a: T, b: Int, c: Int, d: Int, e: Int, f: Int) {}
init?<T: String>(a: T, b: Int, c: Int, d: Int, e: Int, f: Int) {}
func f2(p1: Int, p2: Int) { }
func f(a: Int, b: Int, c: Int, d: Int, x: Int = 42) {}
func f(a: [Int], b: Int, c: Int, d: Int, f: Int) -> [Int] {
let s = a.flatMap { $0 as? [String: Int] } ?? []}}
override func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
Triggering Examples
↓func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
↓func initialValue(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
↓func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int = 2, g: Int) {}
struct Foo {
init(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
↓func bar(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
generic_type_name |
Enabled | No | idiomatic |
Generic type name should only contain alphanumeric characters, start with an uppercase character and span between 1 and 20 characters in length.
Non Triggering Examples
func foo<T>() {}
func foo<T>() -> T {}
func foo<T, U>(param: U) -> T {}
func foo<T: Hashable, U: Rule>(param: U) -> T {}
struct Foo<T> {}
class Foo<T> {}
enum Foo<T> {}
func run(_ options: NoOptions<CommandantError<()>>) {}
func foo(_ options: Set<type>) {}
func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool
func configureWith(data: Either<MessageThread, (project: Project, backing: Backing)>)
typealias StringDictionary<T> = Dictionary<String, T>
typealias BackwardTriple<T1, T2, T3> = (T3, T2, T1)
typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
Triggering Examples
func foo<↓T_Foo>() {}
func foo<T, ↓U_Foo>(param: U_Foo) -> T {}
func foo<↓TTTTTTTTTTTTTTTTTTTTT>() {}
func foo<↓type>() {}
typealias StringDictionary<↓T_Foo> = Dictionary<String, T_Foo>
typealias BackwardTriple<T1, ↓T2_Bar, T3> = (T3, T2_Bar, T1)
typealias DictionaryOfStrings<↓T_Foo: Hashable> = Dictionary<T, String>
class Foo<↓T_Foo> {}
class Foo<T, ↓U_Foo> {}
class Foo<↓T_Foo, ↓U_Foo> {}
class Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
class Foo<↓type> {}
struct Foo<↓T_Foo> {}
struct Foo<T, ↓U_Foo> {}
struct Foo<↓T_Foo, ↓U_Foo> {}
struct Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
struct Foo<↓type> {}
enum Foo<↓T_Foo> {}
enum Foo<T, ↓U_Foo> {}
enum Foo<↓T_Foo, ↓U_Foo> {}
enum Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
enum Foo<↓type> {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
identifier_name |
Enabled | No | style |
Identifier names should only contain alphanumeric characters and start with a lowercase character or should only contain capital letters. In an exception to the above, variable names may start with a capital letter when they are declared static and immutable. Variable names should not be too long or too short.
Non Triggering Examples
let myLet = 0
var myVar = 0
private let _myLet = 0
class Abc { static let MyLet = 0 }
let URL: NSURL? = nil
let XMLString: String? = nil
override var i = 0
enum Foo { case myEnum }
func isOperator(name: String) -> Bool
func typeForKind(_ kind: SwiftDeclarationKind) -> String
func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool
override func IsOperator(name: String) -> Bool
Triggering Examples
↓let MyLet = 0
↓let _myLet = 0
private ↓let myLet_ = 0
↓let myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
↓var myExtremelyVeryVeryVeryVeryVeryVeryLongVar = 0
private ↓let _myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
↓let i = 0
↓var id = 0
private ↓let _i = 0
↓func IsOperator(name: String) -> Bool
enum Foo { case ↓MyEnum }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
implicit_getter |
Enabled | No | style |
Computed read-only properties should avoid using the get keyword.
Non Triggering Examples
class Foo {
var foo: Int {
get {
return 3
}
set {
_abc = newValue
}
}
}
class Foo {
var foo: Int {
return 20
}
}
}
class Foo {
static var foo: Int {
return 20
}
}
}
class Foo {
static foo: Int {
get {
return 3
}
set {
_abc = newValue
}
}
}
class Foo {
var foo: Int
}
class Foo {
var foo: Int {
return getValueFromDisk()
}
}
}
class Foo {
var foo: String {
return "get"
}
}
}
protocol Foo {
var foo: Int { get }
protocol Foo {
var foo: Int { get set }
class Foo {
var foo: Int {
struct Bar {
var bar: Int {
get { return 1 }
set { _ = newValue }
}
}
return Bar().bar
}
}
var _objCTaggedPointerBits: UInt {
@inline(__always) get { return 0 }
}
var next: Int? {
mutating get {
defer { self.count += 1 }
return self.count
}
}
Triggering Examples
class Foo {
var foo: Int {
↓get {
return 20
}
}
}
}
class Foo {
var foo: Int {
↓get{
return 20
}
}
}
}
class Foo {
static var foo: Int {
↓get {
return 20
}
}
}
}
var foo: Int {
↓get {
return 20
}
}
}
class Foo {
@objc func bar() { }
var foo: Int {
↓get {
return 20
}
}
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
implicit_return |
Disabled | Yes | style |
Prefer implicit returns in closures.
Non Triggering Examples
foo.map { $0 + 1 }
foo.map({ $0 + 1 })
foo.map { value in value + 1 }
func foo() -> Int {
return 0
}
if foo {
return 0
}
var foo: Bool { return true }
Triggering Examples
foo.map { value in
↓return value + 1
}
foo.map {
↓return $0 + 1
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
implicitly_unwrapped_optional |
Disabled | No | idiomatic |
Implicitly unwrapped optionals should be avoided when possible.
Non Triggering Examples
@IBOutlet private var label: UILabel!
@IBOutlet var label: UILabel!
@IBOutlet var label: [UILabel!]
if !boolean {}
let int: Int? = 42
let int: Int? = nil
Triggering Examples
let label: UILabel!
let IBOutlet: UILabel!
let labels: [UILabel!]
var ints: [Int!] = [42, nil, 42]
let label: IBOutlet!
let int: Int! = 42
let int: Int! = nil
var int: Int! = 42
let int: ImplicitlyUnwrappedOptional<Int>
let collection: AnyCollection<Int!>
func foo(int: Int!) {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
is_disjoint |
Enabled | No | idiomatic |
Prefer using Set.isDisjoint(with:)
over Set.intersection(_:).isEmpty
.
Non Triggering Examples
_ = Set(syntaxKinds).isDisjoint(with: commentAndStringKindsSet)
let isObjc = !objcAttributes.isDisjoint(with: dictionary.enclosedSwiftAttributes)
_ = Set(syntaxKinds).intersection(commentAndStringKindsSet)
_ = !objcAttributes.intersection(dictionary.enclosedSwiftAttributes)
Triggering Examples
_ = Set(syntaxKinds).↓intersection(commentAndStringKindsSet).isEmpty
let isObjc = !objcAttributes.↓intersection(dictionary.enclosedSwiftAttributes).isEmpty
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
joined_default_parameter |
Disabled | Yes | idiomatic |
Discouraged explicit usage of the default separator.
Non Triggering Examples
let foo = bar.joined()
let foo = bar.joined(separator: ",")
let foo = bar.joined(separator: toto)
Triggering Examples
let foo = bar.joined(↓separator: "")
let foo = bar.filter(toto)
.joined(↓separator: "")
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
large_tuple |
Enabled | No | metrics |
Tuples shouldn't have too many members. Create a custom type instead.
Non Triggering Examples
let foo: (Int, Int)
let foo: (start: Int, end: Int)
let foo: (Int, (Int, String))
func foo() -> (Int, Int)
func foo() -> (Int, Int) {}
func foo(bar: String) -> (Int, Int)
func foo(bar: String) -> (Int, Int) {}
func foo() throws -> (Int, Int)
func foo() throws -> (Int, Int) {}
let foo: (Int, Int, Int) -> Void
let foo: (Int, Int, Int) throws -> Void
func foo(bar: (Int, String, Float) -> Void)
func foo(bar: (Int, String, Float) throws -> Void)
var completionHandler: ((_ data: Data?, _ resp: URLResponse?, _ e: NSError?) -> Void)!
func getDictionaryAndInt() -> (Dictionary<Int, String>, Int)?
func getGenericTypeAndInt() -> (Type<Int, String, Float>, Int)?
Triggering Examples
↓let foo: (Int, Int, Int)
↓let foo: (start: Int, end: Int, value: String)
↓let foo: (Int, (Int, Int, Int))
func foo(↓bar: (Int, Int, Int))
func foo() -> ↓(Int, Int, Int)
func foo() -> ↓(Int, Int, Int) {}
func foo(bar: String) -> ↓(Int, Int, Int)
func foo(bar: String) -> ↓(Int, Int, Int) {}
func foo() throws -> ↓(Int, Int, Int)
func foo() throws -> ↓(Int, Int, Int) {}
func foo() throws -> ↓(Int, ↓(String, String, String), Int) {}
func getDictionaryAndInt() -> (Dictionary<Int, ↓(String, String, String)>, Int)?
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
leading_whitespace |
Enabled | Yes | style |
Files should not contain leading whitespace.
Non Triggering Examples
//
Triggering Examples
//
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
legacy_cggeometry_functions |
Enabled | Yes | idiomatic |
Struct extension properties and methods are preferred over legacy functions
Non Triggering Examples
rect.width
rect.height
rect.minX
rect.midX
rect.maxX
rect.minY
rect.midY
rect.maxY
rect.isNull
rect.isEmpty
rect.isInfinite
rect.standardized
rect.integral
rect.insetBy(dx: 5.0, dy: -7.0)
rect.offsetBy(dx: 5.0, dy: -7.0)
rect1.union(rect2)
rect1.intersect(rect2)
rect1.contains(rect2)
rect.contains(point)
rect1.intersects(rect2)
Triggering Examples
↓CGRectGetWidth(rect)
↓CGRectGetHeight(rect)
↓CGRectGetMinX(rect)
↓CGRectGetMidX(rect)
↓CGRectGetMaxX(rect)
↓CGRectGetMinY(rect)
↓CGRectGetMidY(rect)
↓CGRectGetMaxY(rect)
↓CGRectIsNull(rect)
↓CGRectIsEmpty(rect)
↓CGRectIsInfinite(rect)
↓CGRectStandardize(rect)
↓CGRectIntegral(rect)
↓CGRectInset(rect, 10, 5)
↓CGRectOffset(rect, -2, 8.3)
↓CGRectUnion(rect1, rect2)
↓CGRectIntersection(rect1, rect2)
↓CGRectContainsRect(rect1, rect2)
↓CGRectContainsPoint(rect, point)
↓CGRectIntersectsRect(rect1, rect2)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
legacy_constant |
Enabled | Yes | idiomatic |
Struct-scoped constants are preferred over legacy global constants.
Non Triggering Examples
CGRect.infinite
CGPoint.zero
CGRect.zero
CGSize.zero
NSPoint.zero
NSRect.zero
NSSize.zero
CGRect.null
CGFloat.pi
Float.pi
Triggering Examples
↓CGRectInfinite
↓CGPointZero
↓CGRectZero
↓CGSizeZero
↓NSZeroPoint
↓NSZeroRect
↓NSZeroSize
↓CGRectNull
↓CGFloat(M_PI)
↓Float(M_PI)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
legacy_constructor |
Enabled | Yes | idiomatic |
Swift constructors are preferred over legacy convenience functions.
Non Triggering Examples
CGPoint(x: 10, y: 10)
CGPoint(x: xValue, y: yValue)
CGSize(width: 10, height: 10)
CGSize(width: aWidth, height: aHeight)
CGRect(x: 0, y: 0, width: 10, height: 10)
CGRect(x: xVal, y: yVal, width: aWidth, height: aHeight)
CGVector(dx: 10, dy: 10)
CGVector(dx: deltaX, dy: deltaY)
NSPoint(x: 10, y: 10)
NSPoint(x: xValue, y: yValue)
NSSize(width: 10, height: 10)
NSSize(width: aWidth, height: aHeight)
NSRect(x: 0, y: 0, width: 10, height: 10)
NSRect(x: xVal, y: yVal, width: aWidth, height: aHeight)
NSRange(location: 10, length: 1)
NSRange(location: loc, length: len)
UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
UIEdgeInsets(top: aTop, left: aLeft, bottom: aBottom, right: aRight)
NSEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
NSEdgeInsets(top: aTop, left: aLeft, bottom: aBottom, right: aRight)
Triggering Examples
↓CGPointMake(10, 10)
↓CGPointMake(xVal, yVal)
↓CGSizeMake(10, 10)
↓CGSizeMake(aWidth, aHeight)
↓CGRectMake(0, 0, 10, 10)
↓CGRectMake(xVal, yVal, width, height)
↓CGVectorMake(10, 10)
↓CGVectorMake(deltaX, deltaY)
↓NSMakePoint(10, 10)
↓NSMakePoint(xVal, yVal)
↓NSMakeSize(10, 10)
↓NSMakeSize(aWidth, aHeight)
↓NSMakeRect(0, 0, 10, 10)
↓NSMakeRect(xVal, yVal, width, height)
↓NSMakeRange(10, 1)
↓NSMakeRange(loc, len)
↓UIEdgeInsetsMake(0, 0, 10, 10)
↓UIEdgeInsetsMake(top, left, bottom, right)
↓NSEdgeInsetsMake(0, 0, 10, 10)
↓NSEdgeInsetsMake(top, left, bottom, right)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
legacy_nsgeometry_functions |
Enabled | Yes | idiomatic |
Struct extension properties and methods are preferred over legacy functions
Non Triggering Examples
rect.width
rect.height
rect.minX
rect.midX
rect.maxX
rect.minY
rect.midY
rect.maxY
rect.isEmpty
rect.integral
rect.insetBy(dx: 5.0, dy: -7.0)
rect.offsetBy(dx: 5.0, dy: -7.0)
rect1.union(rect2)
rect1.intersect(rect2)
rect1.contains(rect2)
rect.contains(point)
rect1.intersects(rect2)
Triggering Examples
↓NSWidth(rect)
↓NSHeight(rect)
↓NSMinX(rect)
↓NSMidX(rect)
↓NSMaxX(rect)
↓NSMinY(rect)
↓NSMidY(rect)
↓NSMaxY(rect)
↓NSEqualRects(rect1, rect2)
↓NSEqualSizes(size1, size2)
↓NSEqualPoints(point1, point2)
↓NSEdgeInsetsEqual(insets2, insets2)
↓NSIsEmptyRect(rect)
↓NSIntegralRect(rect)
↓NSInsetRect(rect, 10, 5)
↓NSOffsetRect(rect, -2, 8.3)
↓NSUnionRect(rect1, rect2)
↓NSIntersectionRect(rect1, rect2)
↓NSContainsRect(rect1, rect2)
↓NSPointInRect(rect, point)
↓NSIntersectsRect(rect1, rect2)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
let_var_whitespace |
Disabled | No | style |
Let and var should be separated from other statements by a blank line.
Non Triggering Examples
let a = 0
var x = 1
x = 2
a = 5
var x = 1
struct X {
var a = 0
}
let a = 1 +
2
let b = 5
var x: Int {
return 0
}
var x: Int {
let a = 0
return a
}
#if os(macOS)
let a = 0
#endif
@available(swift 4)
let a = 0
class C {
@objc
var s: String = ""
}
class C {
@objc
func a() {}
}
class C {
var x = 0
lazy
var y = 0
}
@available(OSX, introduced: 10.6)
@available(*, deprecated)
var x = 0
// swiftlint:disable superfluous_disable_command
// swiftlint:disable force_cast
let x = bar as! Bar
Triggering Examples
var x = 1
↓x = 2
a = 5
↓var x = 1
struct X {
let a
↓func x() {}
}
var x = 0
↓@objc func f() {}
var x = 0
↓@objc
func f() {}
@objc func f() {
}
↓var x = 0
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
line_length |
Enabled | No | metrics |
Lines should not span too many characters.
Non Triggering Examples
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")
Triggering Examples
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
literal_expression_end_indentation |
Disabled | No | style |
Array and dictionary literal end should have the same indentation as the line that started it.
Non Triggering Examples
[1, 2, 3]
[1,
2
]
[
1,
2
]
[
1,
2]
let x = [
1,
2
]
[key: 2, key2: 3]
[key: 1,
key2: 2
]
[
key: 0,
key2: 20
]
Triggering Examples
let x = [
1,
2
↓]
let x = [
1,
2
↓]
let x = [
key: value
↓]
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
mark |
Enabled | Yes | lint |
MARK comment should be in valid format. e.g. '// MARK: ...' or '// MARK: - ...'
Non Triggering Examples
// MARK: good
// MARK: - good
// MARK: -
// BOOKMARK
//BOOKMARK
// BOOKMARKS
Triggering Examples
↓//MARK: bad
↓// MARK:bad
↓//MARK:bad
↓// MARK: bad
↓// MARK: bad
↓// MARK: -bad
↓// MARK:- bad
↓// MARK:-bad
↓//MARK: - bad
↓//MARK:- bad
↓//MARK: -bad
↓//MARK:-bad
↓//Mark: bad
↓// Mark: bad
↓// MARK bad
↓//MARK bad
↓// MARK - bad
↓//MARK:- Top-Level bad mark
↓//MARK:- Another bad mark
struct MarkTest {}
↓// MARK:- Bad mark
extension MarkTest {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
multiline_arguments |
Disabled | No | style |
Arguments should be either on the same line, or one per line.
Non Triggering Examples
foo()
foo(
)
foo { }
foo {
}
foo(0)
foo(0, 1)
foo(0, 1) { }
foo(0, param1: 1)
foo(0, param1: 1) { }
foo(param1: 1)
foo(param1: 1) { }
foo(param1: 1, param2: true) { }
foo(param1: 1, param2: true, param3: [3]) { }
foo(param1: 1, param2: true, param3: [3]) {
bar()
}
foo(param1: 1,
param2: true,
param3: [3])
foo(
param1: 1, param2: true, param3: [3]
)
foo(
param1: 1,
param2: true,
param3: [3]
)
Triggering Examples
foo(0,
param1: 1, ↓param2: true, ↓param3: [3])
foo(0, ↓param1: 1,
param2: true, ↓param3: [3])
foo(0, ↓param1: 1, ↓param2: true,
param3: [3])
foo(
0, ↓param1: 1,
param2: true, ↓param3: [3]
)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
multiline_parameters |
Disabled | No | style |
Functions and methods parameters should be either on the same line, or one per line.
Non Triggering Examples
func foo() { }
func foo(param1: Int) { }
func foo(param1: Int, param2: Bool) { }
func foo(param1: Int, param2: Bool, param3: [String]) { }
func foo(param1: Int,
param2: Bool,
param3: [String]) { }
func foo(_ param1: Int, param2: Int, param3: Int) -> (Int) -> Int {
return { x in x + param1 + param2 + param3 }
}
static func foo() { }
static func foo(param1: Int) { }
static func foo(param1: Int, param2: Bool) { }
static func foo(param1: Int, param2: Bool, param3: [String]) { }
static func foo(param1: Int,
param2: Bool,
param3: [String]) { }
protocol Foo {
func foo() { }
}
protocol Foo {
func foo(param1: Int) { }
}
protocol Foo {
func foo(param1: Int, param2: Bool) { }
}
protocol Foo {
func foo(param1: Int, param2: Bool, param3: [String]) { }
}
protocol Foo {
func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
protocol Foo {
static func foo(param1: Int, param2: Bool, param3: [String]) { }
}
protocol Foo {
static func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
protocol Foo {
class func foo(param1: Int, param2: Bool, param3: [String]) { }
}
protocol Foo {
class func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
enum Foo {
func foo() { }
}
enum Foo {
func foo(param1: Int) { }
}
enum Foo {
func foo(param1: Int, param2: Bool) { }
}
enum Foo {
func foo(param1: Int, param2: Bool, param3: [String]) { }
}
enum Foo {
func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
enum Foo {
static func foo(param1: Int, param2: Bool, param3: [String]) { }
}
enum Foo {
static func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
struct Foo {
func foo() { }
}
struct Foo {
func foo(param1: Int) { }
}
struct Foo {
func foo(param1: Int, param2: Bool) { }
}
struct Foo {
func foo(param1: Int, param2: Bool, param3: [String]) { }
}
struct Foo {
func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
struct Foo {
static func foo(param1: Int, param2: Bool, param3: [String]) { }
}
struct Foo {
static func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
class Foo {
func foo() { }
}
class Foo {
func foo(param1: Int) { }
}
class Foo {
func foo(param1: Int, param2: Bool) { }
}
class Foo {
func foo(param1: Int, param2: Bool, param3: [String]) { }
}
class Foo {
func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
class Foo {
class func foo(param1: Int, param2: Bool, param3: [String]) { }
}
class Foo {
class func foo(param1: Int,
param2: Bool,
param3: [String]) { }
}
class Foo {
class func foo(param1: Int,
param2: Bool,
param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
}
class Foo {
class func foo(param1: Int,
param2: Bool,
param3: @escaping (Int) -> Void = { _ in }) { }
}
class Foo {
class func foo(param1: Int,
param2: Bool,
param3: @escaping ((Int) -> Void)? = nil) { }
}
class Foo {
class func foo(param1: Int,
param2: Bool,
param3: @escaping ((Int) -> Void)? = { _ in }) { }
}
class Foo {
class func foo(param1: Int,
param2: @escaping ((Int) -> Void)? = { _ in },
param3: Bool) { }
}
class Foo {
class func foo(param1: Int,
param2: @escaping ((Int) -> Void)? = { _ in },
param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
}
class Foo {
class func foo(param1: Int,
param2: Bool,
param3: @escaping (Int) -> Void = { (x: Int) in }) { }
}
class Foo {
class func foo(param1: Int,
param2: Bool,
param3: @escaping (Int, (Int) -> Void) -> Void = { (x: Int, f: (Int) -> Void) in }) { }
}
Triggering Examples
func ↓foo(_ param1: Int,
param2: Int, param3: Int) -> (Int) -> Int {
return { x in x + param1 + param2 + param3 }
}
protocol Foo {
func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
protocol Foo {
func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
protocol Foo {
static func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
protocol Foo {
static func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
protocol Foo {
class func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
protocol Foo {
class func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
enum Foo {
func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
enum Foo {
func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
enum Foo {
static func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
enum Foo {
static func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
struct Foo {
func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
struct Foo {
func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
struct Foo {
static func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
struct Foo {
static func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
class Foo {
func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
class Foo {
func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
class Foo {
class func ↓foo(param1: Int,
param2: Bool, param3: [String]) { }
}
class Foo {
class func ↓foo(param1: Int, param2: Bool,
param3: [String]) { }
}
class Foo {
class func ↓foo(param1: Int,
param2: Bool, param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
}
class Foo {
class func ↓foo(param1: Int,
param2: Bool, param3: @escaping (Int) -> Void = { (x: Int) in }) { }
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
multiple_closures_with_trailing_closure |
Enabled | No | style |
Trailing closure syntax should not be used when passing more than one closure argument.
Non Triggering Examples
foo.map { $0 + 1 }
foo.reduce(0) { $0 + $1 }
if let foo = bar.map({ $0 + 1 }) {
}
foo.something(param1: { $0 }, param2: { $0 + 1 })
UIView.animate(withDuration: 1.0) {
someView.alpha = 0.0
}
Triggering Examples
foo.something(param1: { $0 }) ↓{ $0 + 1 }
UIView.animate(withDuration: 1.0, animations: {
someView.alpha = 0.0
}) ↓{ _ in
someView.removeFromSuperview()
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
nesting |
Enabled | No | metrics |
Types should be nested at most 1 level deep, and statements should be nested at most 5 levels deep.
Non Triggering Examples
class Class0 { class Class1 {} }
func func0() {
func func1() {
func func2() {
func func3() {
func func4() { func func5() {
}
}
}
}
}
}
struct Class0 { struct Class1 {} }
func func0() {
func func1() {
func func2() {
func func3() {
func func4() { func func5() {
}
}
}
}
}
}
enum Class0 { enum Class1 {} }
func func0() {
func func1() {
func func2() {
func func3() {
func func4() { func func5() {
}
}
}
}
}
}
enum Enum0 { enum Enum1 { case Case } }
Triggering Examples
class A { class B { ↓class C {} } }
struct A { struct B { ↓struct C {} } }
enum A { enum B { ↓enum C {} } }
func func0() {
func func1() {
func func2() {
func func3() {
func func4() { func func5() {
↓func func6() {
}
}
}
}
}
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
nimble_operator |
Disabled | Yes | idiomatic |
Prefer Nimble operator overloads over free matcher functions.
Non Triggering Examples
expect(seagull.squawk) != "Hi!"
expect("Hi!") == "Hi!"
expect(10) > 2
expect(10) >= 10
expect(10) < 11
expect(10) <= 10
expect(x) === x
expect(10) == 10
expect(object.asyncFunction()).toEventually(equal(1))
expect(actual).to(haveCount(expected))
Triggering Examples
↓expect(seagull.squawk).toNot(equal("Hi"))
↓expect(12).toNot(equal(10))
↓expect(10).to(equal(10))
↓expect(10).to(beGreaterThan(8))
↓expect(10).to(beGreaterThanOrEqualTo(10))
↓expect(10).to(beLessThan(11))
↓expect(10).to(beLessThanOrEqualTo(10))
↓expect(x).to(beIdenticalTo(x))
expect(10) > 2
↓expect(10).to(beGreaterThan(2))
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
no_extension_access_modifier |
Disabled | No | idiomatic |
Prefer not to use extension access modifiers
Non Triggering Examples
extension String {}
extension String {}
Triggering Examples
↓private extension String {}
↓public
extension String {}
↓open extension String {}
↓internal extension String {}
↓fileprivate extension String {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
no_grouping_extension |
Disabled | No | idiomatic |
Extensions shouldn't be used to group code within the same source file.
Non Triggering Examples
protocol Food {}
extension Food {}
class Apples {}
extension Oranges {}
Triggering Examples
enum Fruit {}
↓extension Fruit {}
↓extension Tea: Error {}
struct Tea {}
class Ham { class Spam {}}
↓extension Ham.Spam {}
extension External { struct Gotcha {}}
↓extension External.Gotcha {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
notification_center_detachment |
Enabled | No | lint |
An object should only remove itself as an observer in deinit
.
Non Triggering Examples
class Foo {
deinit {
NotificationCenter.default.removeObserver(self)
}
}
class Foo {
func bar() {
NotificationCenter.default.removeObserver(otherObject)
}
}
Triggering Examples
class Foo {
func bar() {
↓NotificationCenter.default.removeObserver(self)
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
number_separator |
Disabled | Yes | style |
Underscores should be used as thousand separator in large decimal numbers.
Non Triggering Examples
let foo = -100
let foo = -1_000
let foo = -1_000_000
let foo = -1.000_1
let foo = -1_000_000.000_000_1
let binary = -0b10000
let binary = -0b1000_0001
let hex = -0xA
let hex = -0xAA_BB
let octal = -0o21
let octal = -0o21_1
let exp = -1_000_000.000_000e2
let foo = +100
let foo = +1_000
let foo = +1_000_000
let foo = +1.000_1
let foo = +1_000_000.000_000_1
let binary = +0b10000
let binary = +0b1000_0001
let hex = +0xA
let hex = +0xAA_BB
let octal = +0o21
let octal = +0o21_1
let exp = +1_000_000.000_000e2
let foo = 100
let foo = 1_000
let foo = 1_000_000
let foo = 1.000_1
let foo = 1_000_000.000_000_1
let binary = 0b10000
let binary = 0b1000_0001
let hex = 0xA
let hex = 0xAA_BB
let octal = 0o21
let octal = 0o21_1
let exp = 1_000_000.000_000e2
Triggering Examples
let foo = ↓-10_0
let foo = ↓-1000
let foo = ↓-1000e2
let foo = ↓-1000E2
let foo = ↓-1__000
let foo = ↓-1.0001
let foo = ↓-1_000_000.000000_1
let foo = ↓-1000000.000000_1
let foo = +↓10_0
let foo = +↓1000
let foo = +↓1000e2
let foo = +↓1000E2
let foo = +↓1__000
let foo = +↓1.0001
let foo = +↓1_000_000.000000_1
let foo = +↓1000000.000000_1
let foo = ↓10_0
let foo = ↓1000
let foo = ↓1000e2
let foo = ↓1000E2
let foo = ↓1__000
let foo = ↓1.0001
let foo = ↓1_000_000.000000_1
let foo = ↓1000000.000000_1
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
object_literal |
Disabled | No | idiomatic |
Prefer object literals over image and color inits.
Non Triggering Examples
let image = #imageLiteral(resourceName: "image.jpg")
let color = #colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
let image = UIImage(named: aVariable)
let image = UIImage(named: "interpolated \(variable)")
let color = UIColor(red: value, green: value, blue: value, alpha: 1)
let image = NSImage(named: aVariable)
let image = NSImage(named: "interpolated \(variable)")
let color = NSColor(red: value, green: value, blue: value, alpha: 1)
Triggering Examples
let image = ↓UIImage(named: "foo")
let color = ↓UIColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
let color = ↓UIColor(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
let color = ↓UIColor(white: 0.5, alpha: 1)
let image = ↓NSImage(named: "foo")
let color = ↓NSColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
let color = ↓NSColor(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
let color = ↓NSColor(white: 0.5, alpha: 1)
let image = ↓UIImage.init(named: "foo")
let color = ↓UIColor.init(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
let color = ↓UIColor.init(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
let color = ↓UIColor.init(white: 0.5, alpha: 1)
let image = ↓NSImage.init(named: "foo")
let color = ↓NSColor.init(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
let color = ↓NSColor.init(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
let color = ↓NSColor.init(white: 0.5, alpha: 1)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
opening_brace |
Enabled | Yes | style |
Opening braces should be preceded by a single space and on the same line as the declaration.
Non Triggering Examples
func abc() {
}
[].map() { $0 }
[].map({ })
if let a = b { }
while a == b { }
guard let a = b else { }
if
let a = b,
let c = d
where a == c
{ }
while
let a = b,
let c = d
where a == c
{ }
guard
let a = b,
let c = d
where a == c else
{ }
struct Rule {}
struct Parent {
struct Child {
let foo: Int
}
}
Triggering Examples
func abc()↓{
}
func abc()
↓{ }
[].map()↓{ $0 }
[].map( ↓{ } )
if let a = b↓{ }
while a == b↓{ }
guard let a = b else↓{ }
if
let a = b,
let c = d
where a == c↓{ }
while
let a = b,
let c = d
where a == c↓{ }
guard
let a = b,
let c = d
where a == c else↓{ }
struct Rule↓{}
struct Rule
↓{
}
struct Rule
↓{
}
struct Parent {
struct Child
↓{
let foo: Int
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
operator_usage_whitespace |
Disabled | Yes | style |
Operators should be surrounded by a single whitespace when they are being used.
Non Triggering Examples
let foo = 1 + 2
let foo = 1 > 2
let foo = !false
let foo: Int?
let foo: Array<String>
let foo: [String]
let foo = 1 +
2
let range = 1...3
let range = 1 ... 3
let range = 1..<3
#if swift(>=3.0)
foo()
#endif
array.removeAtIndex(-200)
let name = "image-1"
button.setImage(#imageLiteral(resourceName: "image-1"), for: .normal)
let doubleValue = -9e-11
Triggering Examples
let foo = 1↓+2
let foo = 1↓ + 2
let foo = 1↓ + 2
let foo = 1↓ + 2
let foo↓=1↓+2
let foo↓=1 + 2
let foo↓=bar
let range = 1↓ ..< 3
let foo = bar↓ ?? 0
let foo = bar↓??0
let foo = bar↓ != 0
let foo = bar↓ !== bar2
let v8 = Int8(1)↓ << 6
let v8 = 1↓ << (6)
let v8 = 1↓ << (6)
let foo = 1 > 2
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
operator_whitespace |
Enabled | No | style |
Operators should be surrounded by a single whitespace when defining them.
Non Triggering Examples
func <| (lhs: Int, rhs: Int) -> Int {}
func <|< <A>(lhs: A, rhs: A) -> A {}
func abc(lhs: Int, rhs: Int) -> Int {}
Triggering Examples
↓func <|(lhs: Int, rhs: Int) -> Int {}
↓func <|<<A>(lhs: A, rhs: A) -> A {}
↓func <| (lhs: Int, rhs: Int) -> Int {}
↓func <|< <A>(lhs: A, rhs: A) -> A {}
↓func <| (lhs: Int, rhs: Int) -> Int {}
↓func <|< <A>(lhs: A, rhs: A) -> A {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
overridden_super_call |
Disabled | No | lint |
Some overridden methods should always call super
Non Triggering Examples
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
}
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {
self.method1()
super.viewWillAppear(animated)
self.method2()
}
}
class VC: UIViewController {
override func loadView() {
}
}
class Some {
func viewWillAppear(_ animated: Bool) {
}
}
class VC: UIViewController {
override func viewDidLoad() {
defer {
super.viewDidLoad()
}
}
}
Triggering Examples
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {↓
//Not calling to super
self.method()
}
}
class VC: UIViewController {
override func viewWillAppear(_ animated: Bool) {↓
super.viewWillAppear(animated)
//Other code
super.viewWillAppear(animated)
}
}
class VC: UIViewController {
override func didReceiveMemoryWarning() {↓
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
override_in_extension |
Disabled | No | lint |
Extensions shouldn't override declarations.
Non Triggering Examples
extension Person {
var age: Int { return 42 }
}
extension Person {
func celebrateBirthday() {}
}
class Employee: Person {
override func celebrateBirthday() {}
}
class Foo: NSObject {}
extension Foo {
override var description: String { return "" }
}
struct Foo {
class Bar: NSObject {}
}
extension Foo.Bar {
override var description: String { return "" }
}
Triggering Examples
extension Person {
override ↓var age: Int { return 42 }
}
extension Person {
override ↓func celebrateBirthday() {}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
pattern_matching_keywords |
Disabled | No | idiomatic |
Combine multiple pattern matching bindings by moving keywords out of tuples.
Non Triggering Examples
switch foo {
default: break
}
switch foo {
case 1: break
}
switch foo {
case bar: break
}
switch foo {
case let (x, y): break
}
switch foo {
case .foo(let x): break
}
switch foo {
case let .foo(x, y): break
}
switch foo {
case .foo(let x), .bar(let x): break
}
switch foo {
case .foo(let x, var y): break
}
switch foo {
case var (x, y): break
}
switch foo {
case .foo(var x): break
}
switch foo {
case var .foo(x, y): break
}
Triggering Examples
switch foo {
case (↓let x, ↓let y): break
}
switch foo {
case .foo(↓let x, ↓let y): break
}
switch foo {
case (.yamlParsing(↓let x), .yamlParsing(↓let y)): break
}
switch foo {
case (↓var x, ↓var y): break
}
switch foo {
case .foo(↓var x, ↓var y): break
}
switch foo {
case (.yamlParsing(↓var x), .yamlParsing(↓var y)): break
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
private_action |
Disabled | No | lint |
IBActions should be private.
Non Triggering Examples
class Foo {
@IBAction private func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction private func barButtonTapped(_ sender: UIButton) {}
}
class Foo {
@IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
}
private extension Foo {
@IBAction func barButtonTapped(_ sender: UIButton) {}
}
fileprivate extension Foo {
@IBAction func barButtonTapped(_ sender: UIButton) {}
}
Triggering Examples
class Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
class Foo {
@IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
}
class Foo {
@IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
}
struct Foo {
@IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
}
extension Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
extension Foo {
@IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
}
extension Foo {
@IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
}
public extension Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
internal extension Foo {
@IBAction ↓func barButtonTapped(_ sender: UIButton) {}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
private_outlet |
Disabled | No | lint |
IBOutlets should be private to avoid leaking UIKit to higher layers.
Non Triggering Examples
class Foo {
@IBOutlet private var label: UILabel?
}
class Foo {
@IBOutlet private var label: UILabel!
}
class Foo {
var notAnOutlet: UILabel
}
class Foo {
@IBOutlet weak private var label: UILabel?
}
class Foo {
@IBOutlet private weak var label: UILabel?
}
Triggering Examples
class Foo {
@IBOutlet ↓var label: UILabel?
}
class Foo {
@IBOutlet ↓var label: UILabel!
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
private_over_fileprivate |
Enabled | Yes | idiomatic |
Prefer private
over fileprivate
declarations.
Non Triggering Examples
extension String {}
private extension String {}
public
enum MyEnum {}
open extension
String {}
internal extension String {}
extension String {
fileprivate func Something(){}
}
class MyClass {
fileprivate let myInt = 4
}
class MyClass {
fileprivate(set) var myInt = 4
}
struct Outter {
struct Inter {
fileprivate struct Inner {}
}
}
Triggering Examples
↓fileprivate enum MyEnum {}
↓fileprivate class MyClass {
fileprivate(set) var myInt = 4
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
private_unit_test |
Enabled | No | lint |
Unit tests marked private are silently skipped.
Non Triggering Examples
class FooTest: XCTestCase { func test1() {}
internal func test2() {}
public func test3() {}
}
internal class FooTest: XCTestCase { func test1() {}
internal func test2() {}
public func test3() {}
}
public class FooTest: XCTestCase { func test1() {}
internal func test2() {}
public func test3() {}
}
private class Foo: NSObject { func test1() {}
internal func test2() {}
public func test3() {}
}
private class Foo { func test1() {}
internal func test2() {}
public func test3() {}
}
public class FooTest: XCTestCase { func test1(param: Int) {}
}
Triggering Examples
private ↓class FooTest: XCTestCase { func test1() {}
internal func test2() {}
public func test3() {}
private func test4() {}
}
class FooTest: XCTestCase { func test1() {}
internal func test2() {}
public func test3() {}
private ↓func test4() {}
}
internal class FooTest: XCTestCase { func test1() {}
internal func test2() {}
public func test3() {}
private ↓func test4() {}
}
public class FooTest: XCTestCase { func test1() {}
internal func test2() {}
public func test3() {}
private ↓func test4() {}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
prohibited_super_call |
Disabled | No | lint |
Some methods should not call super
Non Triggering Examples
class VC: UIViewController {
override func loadView() {
}
}
class NSView {
func updateLayer() {
self.method1() }
}
Triggering Examples
class VC: UIViewController {
override func loadView() {↓
super.loadView()
}
}
class VC: NSFileProviderExtension {
override func providePlaceholder(at url: URL,completionHandler: @escaping (Error?) -> Void) {↓
self.method1()
super.providePlaceholder(at:url, completionHandler: completionHandler)
}
}
class VC: NSView {
override func updateLayer() {↓
self.method1()
super.updateLayer()
self.method2()
}
}
class VC: NSView {
override func updateLayer() {↓
defer {
super.updateLayer()
}
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
protocol_property_accessors_order |
Enabled | Yes | style |
When declaring properties in protocols, the order of accessors should be get set
.
Non Triggering Examples
protocol Foo {
var bar: String { get set }
}
protocol Foo {
var bar: String { get }
}
protocol Foo {
var bar: String { set }
}
Triggering Examples
protocol Foo {
var bar: String { ↓set get }
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
quick_discouraged_call |
Disabled | No | lint |
Discouraged call inside 'describe' and/or 'context' block.
Non Triggering Examples
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
beforeEach {
let foo = Foo()
foo.toto()
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
beforeEach {
let foo = Foo()
foo.toto()
}
afterEach {
let foo = Foo()
foo.toto()
}
describe("bar") {
}
context("bar") {
}
it("bar") {
let foo = Foo()
foo.toto()
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
itBehavesLike("bar")
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
it("does something") {
let foo = Foo()
foo.toto()
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
context("foo") {
afterEach { toto.append(foo) }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
xcontext("foo") {
afterEach { toto.append(foo) }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
xdescribe("foo") {
afterEach { toto.append(foo) }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
xit("does something") {
let foo = Foo()
foo.toto()
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
fcontext("foo") {
afterEach { toto.append(foo) }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
fdescribe("foo") {
afterEach { toto.append(foo) }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
fit("does something") {
let foo = Foo()
foo.toto()
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
fitBehavesLike("foo")
}
}
class TotoTests: QuickSpec {
override func spec() {
xitBehavesLike("foo")
}
}
Triggering Examples
class TotoTests {
override func spec() {
describe("foo") {
let foo = Foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
let foo = ↓Foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
let foo = ↓Foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
context("foo") {
let foo = ↓Foo()
}
context("bar") {
let foo = ↓Foo()
↓foo.bar()
it("does something") {
let foo = Foo()
foo.toto()
}
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
context("foo") {
context("foo") {
beforeEach {
let foo = Foo()
foo.toto()
}
it("bar") {
}
context("foo") {
let foo = ↓Foo()
}
}
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
context("foo") {
let foo = ↓Foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
sharedExamples("foo") {
let foo = ↓Foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
↓foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
context("foo") {
↓foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
sharedExamples("foo") {
↓foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
xdescribe("foo") {
let foo = ↓Foo()
}
fdescribe("foo") {
let foo = ↓Foo()
}
}
}
class TotoTests: QuickSpec {
override func spec() {
xcontext("foo") {
let foo = ↓Foo()
}
fcontext("foo") {
let foo = ↓Foo()
}
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
quick_discouraged_focused_test |
Disabled | No | lint |
Discouraged focused test. Other tests won't run while this one is focused.
Non Triggering Examples
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
describe("bar") { }
context("bar") {
it("bar") { }
}
it("bar") { }
itBehavesLike("bar")
}
}
}
Triggering Examples
class TotoTests: QuickSpec {
override func spec() {
↓fdescribe("foo") { }
}
}
class TotoTests: QuickSpec {
override func spec() {
↓fcontext("foo") { }
}
}
class TotoTests: QuickSpec {
override func spec() {
↓fit("foo") { }
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
↓fit("bar") { }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
context("foo") {
↓fit("bar") { }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
context("bar") {
↓fit("toto") { }
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
↓fitBehavesLike("foo")
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
quick_discouraged_pending_test |
Disabled | No | lint |
Discouraged pending test. This test won't run while it's marked as pending.
Non Triggering Examples
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
describe("bar") { }
context("bar") {
it("bar") { }
}
it("bar") { }
itBehavesLike("bar")
}
}
}
Triggering Examples
class TotoTests: QuickSpec {
override func spec() {
↓xdescribe("foo") { }
}
}
class TotoTests: QuickSpec {
override func spec() {
↓xcontext("foo") { }
}
}
class TotoTests: QuickSpec {
override func spec() {
↓xit("foo") { }
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
↓xit("bar") { }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
context("foo") {
↓xit("bar") { }
}
}
}
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
context("bar") {
↓xit("toto") { }
}
}
}
}
class TotoTests: QuickSpec {
override func spec() {
↓pending("foo")
}
}
class TotoTests: QuickSpec {
override func spec() {
↓xitBehavesLike("foo")
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
redundant_discardable_let |
Enabled | Yes | style |
Prefer _ = foo()
over let _ = foo()
when discarding a result from a function.
Non Triggering Examples
_ = foo()
if let _ = foo() { }
guard let _ = foo() else { return }
let _: ExplicitType = foo()
while let _ = SplashStyle(rawValue: maxValue) { maxValue += 1 }
Triggering Examples
↓let _ = foo()
if _ = foo() { ↓let _ = bar() }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
redundant_nil_coalescing |
Disabled | Yes | idiomatic |
nil coalescing operator is only evaluated if the lhs is nil, coalescing operator with nil as rhs is redundant
Non Triggering Examples
var myVar: Int?; myVar ?? 0
Triggering Examples
var myVar: Int? = nil; myVar↓ ?? nil
var myVar: Int? = nil; myVar↓??nil
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
redundant_optional_initialization |
Enabled | Yes | idiomatic |
Initializing an optional variable with nil is redundant.
Non Triggering Examples
var myVar: Int?
let myVar: Int? = nil
var myVar: Int? = 0
func foo(bar: Int? = 0) { }
var myVar: Optional<Int>
let myVar: Optional<Int> = nil
var myVar: Optional<Int> = 0
var foo: Int? {
if bar != nil { }
return 0
}
var foo: Int? = {
if bar != nil { }
return 0
}()
lazy var test: Int? = nil
Triggering Examples
var myVar: Int?↓ = nil
var myVar: Optional<Int>↓ = nil
var myVar: Int?↓=nil
var myVar: Optional<Int>↓=nil
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
redundant_string_enum_value |
Enabled | No | idiomatic |
String enum values can be omitted when they are equal to the enumcase name.
Non Triggering Examples
enum Numbers: String {
case one
case two
}
enum Numbers: Int {
case one = 1
case two = 2
}
enum Numbers: String {
case one = "ONE"
case two = "TWO"
}
enum Numbers: String {
case one = "ONE"
case two = "two"
}
enum Numbers: String {
case one, two
}
Triggering Examples
enum Numbers: String {
case one = ↓"one"
case two = ↓"two"
}
enum Numbers: String {
case one = ↓"one", two = ↓"two"
}
enum Numbers: String {
case one, two = ↓"two"
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
redundant_void_return |
Enabled | Yes | idiomatic |
Returning Void in a function declaration is redundant.
Non Triggering Examples
func foo() {}
func foo() -> Int {}
func foo() -> Int -> Void {}
func foo() -> VoidResponse
let foo: Int -> Void
func foo() -> Int -> () {}
let foo: Int -> ()
func foo() -> ()?
func foo() -> ()!
func foo() -> Void?
func foo() -> Void!
Triggering Examples
func foo()↓ -> Void {}
protocol Foo {
func foo()↓ -> Void
}
func foo()↓ -> () {}
protocol Foo {
func foo()↓ -> ()
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
return_arrow_whitespace |
Enabled | Yes | style |
Return arrow and return type should be separated by a single space or on a separate line.
Non Triggering Examples
func abc() -> Int {}
func abc() -> [Int] {}
func abc() -> (Int, Int) {}
var abc = {(param: Int) -> Void in }
func abc() ->
Int {}
func abc()
-> Int {}
Triggering Examples
func abc()↓->Int {}
func abc()↓->[Int] {}
func abc()↓->(Int, Int) {}
func abc()↓-> Int {}
func abc()↓ ->Int {}
func abc()↓ -> Int {}
var abc = {(param: Int)↓ ->Bool in }
var abc = {(param: Int)↓->Bool in }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
shorthand_operator |
Enabled | No | style |
Prefer shorthand operators (+=, -=, *=, /=) over doing the operation and assigning.
Non Triggering Examples
foo -= 1
foo -= variable
foo -= bar.method()
self.foo = foo - 1
foo = self.foo - 1
page = ceilf(currentOffset - pageWidth)
foo = aMethod(foo - bar)
foo = aMethod(bar - foo)
foo /= 1
foo /= variable
foo /= bar.method()
self.foo = foo / 1
foo = self.foo / 1
page = ceilf(currentOffset / pageWidth)
foo = aMethod(foo / bar)
foo = aMethod(bar / foo)
foo += 1
foo += variable
foo += bar.method()
self.foo = foo + 1
foo = self.foo + 1
page = ceilf(currentOffset + pageWidth)
foo = aMethod(foo + bar)
foo = aMethod(bar + foo)
foo *= 1
foo *= variable
foo *= bar.method()
self.foo = foo * 1
foo = self.foo * 1
page = ceilf(currentOffset * pageWidth)
foo = aMethod(foo * bar)
foo = aMethod(bar * foo)
var helloWorld = "world!"
helloWorld = "Hello, " + helloWorld
angle = someCheck ? angle : -angle
seconds = seconds * 60 + value
Triggering Examples
↓foo = foo - 1
↓foo = foo - aVariable
↓foo = foo - bar.method()
↓foo.aProperty = foo.aProperty - 1
↓self.aProperty = self.aProperty - 1
↓foo = foo / 1
↓foo = foo / aVariable
↓foo = foo / bar.method()
↓foo.aProperty = foo.aProperty / 1
↓self.aProperty = self.aProperty / 1
↓foo = foo + 1
↓foo = foo + aVariable
↓foo = foo + bar.method()
↓foo.aProperty = foo.aProperty + 1
↓self.aProperty = self.aProperty + 1
↓foo = foo * 1
↓foo = foo * aVariable
↓foo = foo * bar.method()
↓foo.aProperty = foo.aProperty * 1
↓self.aProperty = self.aProperty * 1
n = n + i / outputLength
n = n - i / outputLength
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
single_test_class |
Disabled | No | style |
Test files should contain a single QuickSpec or XCTestCase class.
Non Triggering Examples
class FooTests { }
class FooTests: QuickSpec { }
class FooTests: XCTestCase { }
Triggering Examples
↓class FooTests: QuickSpec { }
↓class BarTests: QuickSpec { }
↓class FooTests: QuickSpec { }
↓class BarTests: QuickSpec { }
↓class TotoTests: QuickSpec { }
↓class FooTests: XCTestCase { }
↓class BarTests: XCTestCase { }
↓class FooTests: XCTestCase { }
↓class BarTests: XCTestCase { }
↓class TotoTests: XCTestCase { }
↓class FooTests: QuickSpec { }
↓class BarTests: XCTestCase { }
↓class FooTests: QuickSpec { }
↓class BarTests: XCTestCase { }
class TotoTests { }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
sorted_first_last |
Disabled | No | performance |
Prefer using min()
or max()
over sorted().first
or sorted().last
Non Triggering Examples
let min = myList.min()
let min = myList.min(by: { $0 < $1 })
let min = myList.min(by: >)
let min = myList.max()
let min = myList.max(by: { $0 < $1 })
Triggering Examples
↓myList.sorted().first
↓myList.sorted(by: { $0.description < $1.description }).first
↓myList.sorted(by: >).first
↓myList.map { $0 + 1 }.sorted().first
↓myList.sorted(by: someFunction).first
↓myList.map { $0 + 1 }.sorted { $0.description < $1.description }.first
↓myList.sorted().last
↓myList.sorted().last?.something()
↓myList.sorted(by: { $0.description < $1.description }).last
↓myList.map { $0 + 1 }.sorted().last
↓myList.sorted(by: someFunction).last
↓myList.map { $0 + 1 }.sorted { $0.description < $1.description }.last
↓myList.map { $0 + 1 }.sorted { $0.first < $1.first }.last
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
sorted_imports |
Disabled | Yes | style |
Imports should be sorted.
Non Triggering Examples
import AAA
import BBB
import CCC
import DDD
import Alamofire
import API
import labc
import Ldef
import BBB
// comment
import AAA
import CCC
@testable import AAA
import CCC
import AAA
@testable import CCC
import EEE.A
import FFF.B
#if os(Linux)
import DDD.A
import EEE.B
#else
import CCC
import DDD.B
#endif
import AAA
import BBB
Triggering Examples
import AAA
import ZZZ
import ↓BBB
import CCC
import DDD
// comment
import CCC
import ↓AAA
@testable import CCC
import ↓AAA
import CCC
@testable import ↓AAA
import FFF.B
import ↓EEE.A
#if os(Linux)
import DDD.A
import EEE.B
#else
import DDD.B
import ↓CCC
#endif
import AAA
import BBB
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
statement_position |
Enabled | Yes | style |
Else and catch should be on the same line, one space after the previous declaration.
Non Triggering Examples
} else if {
} else {
} catch {
"}else{"
struct A { let catchphrase: Int }
let a = A(
catchphrase: 0
)
struct A { let `catch`: Int }
let a = A(
`catch`: 0
)
Triggering Examples
↓}else if {
↓} else {
↓}
catch {
↓}
catch {
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
strict_fileprivate |
Disabled | No | idiomatic |
fileprivate
should be avoided.
Non Triggering Examples
extension String {}
private extension String {}
public
extension String {}
open extension
String {}
internal extension String {}
Triggering Examples
↓fileprivate extension String {}
↓fileprivate
extension String {}
↓fileprivate extension
String {}
extension String {
↓fileprivate func Something(){}
}
class MyClass {
↓fileprivate let myInt = 4
}
class MyClass {
↓fileprivate(set) var myInt = 4
}
struct Outter {
struct Inter {
↓fileprivate struct Inner {}
}
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
superfluous_disable_command |
Enabled | No | lint |
SwiftLint 'disable' commands are superfluous when the disabled rule would not have triggered a violation in the disabled region.
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
switch_case_alignment |
Enabled | No | style |
Case statements should vertically align with the enclosing switch statement.
Non Triggering Examples
switch someBool {
case true: // case 1
print('red')
case false:
/*
case 2
*/
if case let .someEnum(val) = someFunc() {
print('blue')
}
}
enum SomeEnum {
case innocent
}
if aBool {
switch someBool {
case true:
print('red')
case false:
print('blue')
}
}
switch someInt {
// comments ignored
case 0:
// zero case
print('Zero')
case 1:
print('One')
default:
print('Some other number')
}
Triggering Examples
switch someBool {
↓case true:
print('red')
↓case false:
print('blue')
}
if aBool {
switch someBool {
↓case true:
print('red')
case false:
print('blue')
}
}
switch someInt {
↓case 0:
print('Zero')
case 1:
print('One')
↓default:
print('Some other number')
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
switch_case_on_newline |
Disabled | No | style |
Cases inside a switch should always be on a newline
Non Triggering Examples
/*case 1: */return true
//case 1:
return true
let x = [caseKey: value]
let x = [key: .default]
if case let .someEnum(value) = aFunction([key: 2]) { }
guard case let .someEnum(value) = aFunction([key: 2]) { }
for case let .someEnum(value) = aFunction([key: 2]) { }
enum Environment {
case development
}
enum Environment {
case development(url: URL)
}
enum Environment {
case development(url: URL) // staging
}
switch foo {
case 1:
return true
}
switch foo {
default:
return true
}
switch foo {
case let value:
return true
}
switch foo {
case .myCase: // error from network
return true
}
switch foo {
case let .myCase(value) where value > 10:
return false
}
switch foo {
case let .myCase(value)
where value > 10:
return false
}
switch foo {
case let .myCase(code: lhsErrorCode, description: _)
where lhsErrorCode > 10:
return false
}
switch foo {
case #selector(aFunction(_:)):
return false
}
Triggering Examples
switch foo {
↓case 1: return true
}
switch foo {
↓case let value: return true
}
switch foo {
↓default: return true
}
switch foo {
↓case "a string": return false
}
switch foo {
↓case .myCase: return false // error from network
}
switch foo {
↓case let .myCase(value) where value > 10: return false
}
switch foo {
↓case #selector(aFunction(_:)): return false
}
switch foo {
↓case let .myCase(value)
where value > 10: return false
}
switch foo {
↓case .first,
.second: return false
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
syntactic_sugar |
Enabled | No | idiomatic |
Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.
Non Triggering Examples
let x: [Int]
let x: [Int: String]
let x: Int?
func x(a: [Int], b: Int) -> [Int: Any]
let x: Int!
extension Array {
func x() { }
}
extension Dictionary {
func x() { }
}
let x: CustomArray<String>
var currentIndex: Array<OnboardingPage>.Index?
func x(a: [Int], b: Int) -> Array<Int>.Index
unsafeBitCast(nonOptionalT, to: Optional<T>.self)
type is Optional<String>.Type
let x: Foo.Optional<String>
Triggering Examples
let x: ↓Array<String>
let x: ↓Dictionary<Int, String>
let x: ↓Optional<Int>
let x: ↓ImplicitlyUnwrappedOptional<Int>
func x(a: ↓Array<Int>, b: Int) -> [Int: Any]
func x(a: [Int], b: Int) -> ↓Dictionary<Int, String>
func x(a: ↓Array<Int>, b: Int) -> ↓Dictionary<Int, String>
let x = ↓Array<String>.array(of: object)
let x: ↓Swift.Optional<String>
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
todo |
Enabled | No | lint |
TODOs and FIXMEs should be avoided.
Non Triggering Examples
// notaTODO:
// notaFIXME:
Triggering Examples
// ↓TODO:
// ↓FIXME:
// ↓TODO(note)
// ↓FIXME(note)
/* ↓FIXME: */
/* ↓TODO: */
/** ↓FIXME: */
/** ↓TODO: */
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
trailing_closure |
Disabled | No | style |
Trailing closure syntax should be used whenever possible.
Non Triggering Examples
foo.map { $0 + 1 }
foo.bar()
foo.reduce(0) { $0 + 1 }
if let foo = bar.map({ $0 + 1 }) { }
foo.something(param1: { $0 }, param2: { $0 + 1 })
offsets.sorted { $0.offset < $1.offset }
Triggering Examples
↓foo.map({ $0 + 1 })
↓foo.reduce(0, combine: { $0 + 1 })
↓offsets.sorted(by: { $0.offset < $1.offset })
↓foo.something(0, { $0 + 1 })
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
trailing_comma |
Enabled | Yes | style |
Trailing commas in arrays and dictionaries should be avoided/enforced.
Non Triggering Examples
let foo = [1, 2, 3]
let foo = []
let foo = [:]
let foo = [1: 2, 2: 3]
let foo = [Void]()
let example = [ 1,
2
// 3,
]
foo([1: "\(error)"])
Triggering Examples
let foo = [1, 2, 3↓,]
let foo = [1, 2, 3↓, ]
let foo = [1, 2, 3 ↓,]
let foo = [1: 2, 2: 3↓, ]
struct Bar {
let foo = [1: 2, 2: 3↓, ]
}
let foo = [1, 2, 3↓,] + [4, 5, 6↓,]
let example = [ 1,
2↓,
// 3,
]
let foo = ["אבג", "αβγ", "🇺🇸"↓,]
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
trailing_newline |
Enabled | Yes | style |
Files should have a single trailing newline.
Non Triggering Examples
let a = 0
Triggering Examples
let a = 0
let a = 0
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
trailing_semicolon |
Enabled | Yes | idiomatic |
Lines should not have trailing semicolons.
Non Triggering Examples
let a = 0
Triggering Examples
let a = 0↓;
let a = 0↓;
let b = 1
let a = 0↓;;
let a = 0↓; ;;
let a = 0↓; ; ;
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
trailing_whitespace |
Enabled | Yes | style |
Lines should not have trailing whitespace.
Non Triggering Examples
let name: String
//
//
let name: String //
let name: String //
Triggering Examples
let name: String
/* */ let name: String
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
type_body_length |
Enabled | No | metrics |
Type bodies should not span too many lines.
Non Triggering Examples
class Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
}
class Abc {
}
class Abc {
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
}
class Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
/* this is
a multiline comment
*/
}
struct Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
}
struct Abc {
}
struct Abc {
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
}
struct Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
/* this is
a multiline comment
*/
}
enum Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
}
enum Abc {
}
enum Abc {
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
// this is a comment
}
enum Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
/* this is
a multiline comment
*/
}
Triggering Examples
↓class Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
}
↓struct Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
}
↓enum Abc {
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
let abc = 0
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
type_name |
Enabled | No | idiomatic |
Type name should only contain alphanumeric characters, start with an uppercase character and span between 3 and 40 characters in length.
Non Triggering Examples
class MyType {}
private class _MyType {}
class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
struct MyType {}
private struct _MyType {}
struct AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
enum MyType {}
private enum _MyType {}
enum AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
typealias Foo = Void
private typealias Foo = Void
protocol Foo {
associatedtype Bar
}
protocol Foo {
associatedtype Bar: Equatable
}
enum MyType {
case value
}
Triggering Examples
↓class myType {}
↓class _MyType {}
private ↓class MyType_ {}
↓class My {}
↓class AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
↓struct myType {}
↓struct _MyType {}
private ↓struct MyType_ {}
↓struct My {}
↓struct AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
↓enum myType {}
↓enum _MyType {}
private ↓enum MyType_ {}
↓enum My {}
↓enum AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
typealias ↓X = Void
private typealias ↓Foo_Bar = Void
private typealias ↓foo = Void
typealias ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA = Void
protocol Foo {
associatedtype ↓X
}
protocol Foo {
associatedtype ↓Foo_Bar: Equatable
}
protocol Foo {
associatedtype ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
unneeded_break_in_switch |
Enabled | No | idiomatic |
Avoid using unneeded break statements.
Non Triggering Examples
switch foo {
case .bar:
break
}
switch foo {
default:
break
}
switch foo {
case .bar:
for i in [0, 1, 2] { break }
}
switch foo {
case .bar:
if true { break }
}
switch foo {
case .bar:
something()
}
Triggering Examples
switch foo {
case .bar:
something()
↓break
}
switch foo {
case .bar:
something()
↓break // comment
}
switch foo {
default:
something()
↓break
}
switch foo {
case .foo, .foo2 where condition:
something()
↓break
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
unneeded_parentheses_in_closure_argument |
Disabled | Yes | style |
Parentheses are not needed when declaring closure arguments.
Non Triggering Examples
let foo = { (bar: Int) in }
let foo = { bar in }
let foo = { bar -> Bool in return true }
Triggering Examples
call(arg: { ↓(bar) in })
let foo = { ↓(bar) -> Bool in return true }
foo.map { ($0, $0) }.forEach { ↓(x, y) in }
foo.bar { [weak self] ↓(x, y) in }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
unused_closure_parameter |
Enabled | Yes | lint |
Unused parameter in a closure should be replaced with _.
Non Triggering Examples
[1, 2].map { $0 + 1 }
[1, 2].map({ $0 + 1 })
[1, 2].map { number in
number + 1
}
[1, 2].map { _ in
3
}
[1, 2].something { number, idx in
return number * idx
}
let isEmpty = [1, 2].isEmpty()
violations.sorted(by: { lhs, rhs in
return lhs.location > rhs.location
})
rlmConfiguration.migrationBlock.map { rlmMigration in
return { migration, schemaVersion in
rlmMigration(migration.rlmMigration, schemaVersion)
}
}
genericsFunc { (a: Type, b) in
a + b
}
var label: UILabel = { (lbl: UILabel) -> UILabel in
lbl.backgroundColor = .red
return lbl
}(UILabel())
hoge(arg: num) { num in
return num
}
Triggering Examples
[1, 2].map { ↓number in
return 3
}
[1, 2].map { ↓number in
return numberWithSuffix
}
[1, 2].map { ↓number in
return 3 // number
}
[1, 2].map { ↓number in
return 3 "number"
}
[1, 2].something { number, ↓idx in
return number
}
genericsFunc { (↓number: TypeA, idx: TypeB) in return idx
}
hoge(arg: num) { ↓num in
}
fooFunc { ↓아 in
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
unused_enumerated |
Enabled | No | idiomatic |
When the index or the item is not used, .enumerated()
can be removed.
Non Triggering Examples
for (idx, foo) in bar.enumerated() { }
for (_, foo) in bar.enumerated().something() { }
for (_, foo) in bar.something() { }
for foo in bar.enumerated() { }
for foo in bar { }
for (idx, _) in bar.enumerated().something() { }
for (idx, _) in bar.something() { }
for idx in bar.indices { }
for (section, (event, _)) in data.enumerated() {}
Triggering Examples
for (↓_, foo) in bar.enumerated() { }
for (↓_, foo) in abc.bar.enumerated() { }
for (↓_, foo) in abc.something().enumerated() { }
for (idx, ↓_) in bar.enumerated() { }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
unused_optional_binding |
Enabled | No | style |
Prefer != nil
over let _ =
Non Triggering Examples
if let bar = Foo.optionalValue {
}
if let (_, second) = getOptionalTuple() {
}
if let (_, asd, _) = getOptionalTuple(), let bar = Foo.optionalValue {
}
if foo() { let _ = bar() }
if foo() { _ = bar() }
if case .some(_) = self {}
if let point = state.find({ _ in true }) {}
Triggering Examples
if let ↓_ = Foo.optionalValue {
}
if let a = Foo.optionalValue, let ↓_ = Foo.optionalValue2 {
}
guard let a = Foo.optionalValue, let ↓_ = Foo.optionalValue2 {
}
if let (first, second) = getOptionalTuple(), let ↓_ = Foo.optionalValue {
}
if let (first, _) = getOptionalTuple(), let ↓_ = Foo.optionalValue {
}
if let (_, second) = getOptionalTuple(), let ↓_ = Foo.optionalValue {
}
if let ↓(_, _, _) = getOptionalTuple(), let bar = Foo.optionalValue {
}
func foo() {
if let ↓_ = bar {
}
if case .some(let ↓_) = self {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
valid_ibinspectable |
Enabled | No | lint |
@IBInspectable should be applied to variables only, have its type explicit and be of a supported type
Non Triggering Examples
class Foo {
@IBInspectable private var x: Int
}
class Foo {
@IBInspectable private var x: String?
}
class Foo {
@IBInspectable private var x: String!
}
class Foo {
@IBInspectable private var count: Int = 0
}
class Foo {
private var notInspectable = 0
}
class Foo {
private let notInspectable: Int
}
class Foo {
private let notInspectable: UInt8
}
Triggering Examples
class Foo {
@IBInspectable private ↓let count: Int
}
class Foo {
@IBInspectable private ↓var insets: UIEdgeInsets
}
class Foo {
@IBInspectable private ↓var count = 0
}
class Foo {
@IBInspectable private ↓var count: Int?
}
class Foo {
@IBInspectable private ↓var count: Int!
}
class Foo {
@IBInspectable private ↓var x: ImplicitlyUnwrappedOptional<Int>
}
class Foo {
@IBInspectable private ↓var count: Optional<Int>
}
class Foo {
@IBInspectable private ↓var x: Optional<String>
}
class Foo {
@IBInspectable private ↓var x: ImplicitlyUnwrappedOptional<String>
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
vertical_parameter_alignment |
Enabled | No | style |
Function parameters should be aligned vertically if they're in multiple lines in a declaration.
Non Triggering Examples
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]) -> [StyleViolation]
func foo(bar: Int)
func foo(bar: Int) -> String
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable])
-> [StyleViolation]
func validateFunction(
_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]) -> [StyleViolation]
func validateFunction(
_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]
) -> [StyleViolation]
func regex(_ pattern: String,
options: NSRegularExpression.Options = [.anchorsMatchLines,
.dotMatchesLineSeparators]) -> NSRegularExpression
func foo(a: Void,
b: [String: String] =
[:]) {
}
func foo(data: (size: CGSize,
identifier: String)) {}
Triggering Examples
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
↓dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
↓dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(_ file: File,
↓kind: SwiftDeclarationKind,
↓dictionary: [String: SourceKitRepresentable]) { }
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
vertical_parameter_alignment_on_call |
Disabled | No | style |
Function parameters should be aligned vertically if they're in multiple lines in a method call.
Non Triggering Examples
foo(param1: 1, param2: bar
param3: false, param4: true)
foo(param1: 1, param2: bar)
foo(param1: 1, param2: bar
param3: false,
param4: true)
foo(
param1: 1
) { _ in }
UIView.animate(withDuration: 0.4, animations: {
blurredImageView.alpha = 1
}, completion: { _ in
self.hideLoading()
})
UIView.animate(withDuration: 0.4, animations: {
blurredImageView.alpha = 1
},
completion: { _ in
self.hideLoading()
})
foo(param1: 1, param2: { _ in },
param3: false, param4: true)
foo({ _ in
bar()
},
completion: { _ in
baz()
}
)
foo(param1: 1, param2: [
0,
1
], param3: 0)
Triggering Examples
foo(param1: 1, param2: bar
↓param3: false, param4: true)
foo(param1: 1, param2: bar
↓param3: false, param4: true)
foo(param1: 1, param2: bar
↓param3: false,
↓param4: true)
foo(param1: 1,
↓param2: { _ in })
foo(param1: 1,
param2: { _ in
}, param3: 2,
↓param4: 0)
foo(param1: 1, param2: { _ in },
↓param3: false, param4: true)
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
vertical_whitespace |
Enabled | Yes | style |
Limit vertical whitespace to a single empty line.
Non Triggering Examples
let abc = 0
let abc = 0
/* bcs
*/
// bca
Triggering Examples
let aaaa = 0
struct AAAA {}
class BBBB {}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
void_return |
Enabled | Yes | style |
Prefer -> Void
over -> ()
.
Non Triggering Examples
let abc: () -> Void = {}
let abc: () -> (VoidVoid) = {}
func foo(completion: () -> Void)
let foo: (ConfigurationTests) -> () throws -> Void)
let foo: (ConfigurationTests) -> () throws -> Void)
let foo: (ConfigurationTests) ->() throws -> Void)
let foo: (ConfigurationTests) -> () -> Void)
Triggering Examples
let abc: () -> ↓() = {}
let abc: () -> ↓(Void) = {}
let abc: () -> ↓( Void ) = {}
func foo(completion: () -> ↓())
func foo(completion: () -> ↓( ))
func foo(completion: () -> ↓(Void))
let foo: (ConfigurationTests) -> () throws -> ↓())
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
weak_delegate |
Enabled | No | lint |
Delegates should be weak to avoid reference cycles.
Non Triggering Examples
class Foo {
weak var delegate: SomeProtocol?
}
class Foo {
weak var someDelegate: SomeDelegateProtocol?
}
class Foo {
weak var delegateScroll: ScrollDelegate?
}
class Foo {
var scrollHandler: ScrollDelegate?
}
func foo() {
var delegate: SomeDelegate
}
class Foo {
var delegateNotified: Bool?
}
protocol P {
var delegate: AnyObject? { get set }
}
class Foo {
protocol P {
var delegate: AnyObject? { get set }
}
}
class Foo {
var computedDelegate: ComputedDelegate {
return bar()
}
}
Triggering Examples
class Foo {
↓var delegate: SomeProtocol?
}
class Foo {
↓var scrollDelegate: ScrollDelegate?
}
Identifier | Enabled by default | Supports autocorrection | Kind |
---|---|---|---|
xctfail_message |
Enabled | No | idiomatic |
An XCTFail call should include a description of the assertion.
Non Triggering Examples
func testFoo() {
XCTFail("bar")
}
func testFoo() {
XCTFail(bar)
}
Triggering Examples
func testFoo() {
↓XCTFail()
}
func testFoo() {
↓XCTFail("")
}