Skip to content

Instantly share code, notes, and snippets.

@marcelofabri
Created January 2, 2017 00:26
Show Gist options
  • Save marcelofabri/7f568c40030bb672e62f72911e0392fc to your computer and use it in GitHub Desktop.
Save marcelofabri/7f568c40030bb672e62f72911e0392fc to your computer and use it in GitHub Desktop.

Rules

Attributes

Identifier Enabled by default Supports autocorrection
attributes Disabled No

Attributes should be on their own lines in functions and types, but on the same line as variables and imports.

Examples

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() {}
}
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

Class Delegate Protocol

Identifier Enabled by default Supports autocorrection
class_delegate_protocol Enabled No

Delegate protocols should be class-only so they can be weakly referenced.

Examples

Non Triggering Examples
protocol FooDelegate: class {}
protocol FooDelegate: class, BarDelegate {}
protocol Foo {}
class FooDelegate {}
@objc protocol FooDelegate {}
@objc(MyFooDelegate)
 protocol FooDelegate {}
protocol FooDelegate: BarDelegate {}
Triggering Examples
protocol FooDelegate {}
protocol FooDelegate: Bar {}

Closing Brace Spacing

Identifier Enabled by default Supports autocorrection
closing_brace Enabled Yes

Closing brace with closing parenthesis should not have any whitespaces in the middle.

Examples

Non Triggering Examples
[].map({ })
[].map(
  { }
)
Triggering Examples
[].map({ } )
[].map({ }	)

Closure End Indentation

Identifier Enabled by default Supports autocorrection
closure_end_indentation Disabled No

Closure end should have the same indentation as the line that started it.

Examples

Non Triggering Examples
SignalProducer(values: [1, 2, 3])
   .startWithNext { number in
       print(number)
   }
[1, 2].map { $0 + 1 }
return matchPattern(pattern, withSyntaxKinds: [.comment]).flatMap { range in
   return Command(string: contents, range: range)
}.flatMap { command in
   return command.expand()
}
Triggering Examples
SignalProducer(values: [1, 2, 3])
   .startWithNext { number in
       print(number)
}
return matchPattern(pattern, withSyntaxKinds: [.comment]).flatMap { range in
   return Command(string: contents, range: range)
   }.flatMap { command in
   return command.expand()
}

Closure Parameter Position

Identifier Enabled by default Supports autocorrection
closure_parameter_position Enabled No

Closure parameters should be on the same line as opening brace.

Examples

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 
}

Closure Spacing

Identifier Enabled by default Supports autocorrection
closure_spacing Disabled No

Closure expressions should have a single space inside each brace.

Examples

Non Triggering Examples
[].map ({ $0.description })
[].filter { $0.contains(location) }
extension UITableViewCell: ReusableView { }
extension UITableViewCell: ReusableView {}
Triggering Examples
[].filter({$0.contains(location)})
[].map({$0})

Colon

Identifier Enabled by default Supports autocorrection
colon Enabled Yes

Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.

Examples

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"]
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]

Comma Spacing

Identifier Enabled by default Supports autocorrection
comma Enabled Yes

There should be no space before and one after any comma.

Examples

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
)

Conditional Returns on Newline

Identifier Enabled by default Supports autocorrection
conditional_returns_on_newline Disabled No

Conditional statements should always return on the next line

Examples

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" }

Control Statement

Identifier Enabled by default Supports autocorrection
control_statement Enabled No

if,for,while,do statements shouldn't wrap their conditionals in parentheses.

Examples

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 {
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) {

Custom Rules

Identifier Enabled by default Supports autocorrection
custom_rules Enabled No

Create custom rules by providing a regex string. Optionally specify what syntax kinds to match against, the severity level, and what message to display.

Cyclomatic Complexity

Identifier Enabled by default Supports autocorrection
cyclomatic_complexity Enabled No

Complexity of function bodies should be limited.

Examples

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
    }
  }
}

Dynamic Inline

Identifier Enabled by default Supports autocorrection
dynamic_inline Enabled No

avoid using 'dynamic' and '@inline(__always)' together.

Examples

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() {}
}

Empty Count

Identifier Enabled by default Supports autocorrection
empty_count Disabled No

Prefer checking isEmpty over comparing count to zero.

Examples

Non Triggering Examples
var count = 0
[Int]().isEmpty
[Int]().count > 1
[Int]().count == 1
Triggering Examples
[Int]().count == 0
[Int]().count > 0
[Int]().count != 0

Empty Parameters

Identifier Enabled by default Supports autocorrection
empty_parameters Enabled Yes

Prefer () -> over Void -> .

Examples

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)

Empty Parentheses with Trailing Closure

Identifier Enabled by default Supports autocorrection
empty_parentheses_with_trailing_closure Enabled Yes

When using trailing closures, empty parentheses should be avoided after the method call.

Examples

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 
}

Explicit Init

Identifier Enabled by default Supports autocorrection
explicit_init Disabled Yes

Explicitly calling .init() should be avoided.

Examples

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) }

File Header

Identifier Enabled by default Supports autocorrection
file_header Disabled No

Files should have consistent header comments.

Examples

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.
//

File Line Length

Identifier Enabled by default Supports autocorrection
file_length Enabled No

Files should not span too many lines.

Examples

Non Triggering Examples
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
Triggering Examples
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

First Where

Identifier Enabled by default Supports autocorrection
first_where Disabled No

Prefer using .first(where:) over .filter { }.first in collections.

Examples

Non Triggering Examples
kinds.filter(excludingKinds.contains).isEmpty && kinds.first == .identifier
myList.first(where: { $0 % 2 == 0 })
matchPattern(pattern).filter { $0.first == .identifier }
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

Force Cast

Identifier Enabled by default Supports autocorrection
force_cast Enabled No

Force casts should be avoided.

Examples

Non Triggering Examples
NSNumber() as? Int
Triggering Examples
NSNumber() as! Int

Force Try

Identifier Enabled by default Supports autocorrection
force_try Enabled No

Force tries should be avoided.

Examples

Non Triggering Examples
func a() throws {}; do { try a() } catch {}
Triggering Examples
func a() throws {}; try! a()

Force Unwrapping

Identifier Enabled by default Supports autocorrection
force_unwrapping Disabled No

Force unwrapping should be avoided.

Examples

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)!")
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"]↓! }

Function Body Length

Identifier Enabled by default Supports autocorrection
function_body_length Enabled No

Functions bodies should not span too many lines.

Function Parameter Count

Identifier Enabled by default Supports autocorrection
function_parameter_count Enabled No

Number of function parameters should be low.

Examples

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] } ?? []}}
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) {}}

Implicit Getter

Identifier Enabled by default Supports autocorrection
implicit_getter Enabled No

Computed read-only properties should avoid using the get keyword.

Examples

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
  }
}
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 
} 
} 
}
}

Large Tuple

Identifier Enabled by default Supports autocorrection
large_tuple Enabled No

Tuples shouldn't have many members. Create a custom type instead.

Examples

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
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) {}

Leading Whitespace

Identifier Enabled by default Supports autocorrection
leading_whitespace Enabled Yes

Files should not contain leading whitespace.

Examples

Non Triggering Examples
//
Triggering Examples
 //

Legacy CGGeometry Functions

Identifier Enabled by default Supports autocorrection
legacy_cggeometry_functions Enabled Yes

Struct extension properties and methods are preferred over legacy functions

Examples

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)

Legacy Constant

Identifier Enabled by default Supports autocorrection
legacy_constant Enabled Yes

Struct-scoped constants are preferred over legacy global constants.

Examples

Non Triggering Examples
CGRect.infinite
CGPoint.zero
CGRect.zero
CGSize.zero
NSPoint.zero
NSRect.zero
NSSize.zero
CGRect.null
Triggering Examples
CGRectInfinite
CGPointZero
CGRectZero
CGSizeZero
NSZeroPoint
NSZeroRect
NSZeroSize
CGRectNull

Legacy Constructor

Identifier Enabled by default Supports autocorrection
legacy_constructor Enabled Yes

Swift constructors are preferred over legacy convenience functions.

Examples

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)

Legacy NSGeometry Functions

Identifier Enabled by default Supports autocorrection
legacy_nsgeometry_functions Enabled Yes

Struct extension properties and methods are preferred over legacy functions

Examples

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)

Line Length

Identifier Enabled by default Supports autocorrection
line_length Enabled No

Lines should not span too many characters.

Examples

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")

Mark

Identifier Enabled by default Supports autocorrection
mark Enabled Yes

MARK comment should be in valid format.

Examples

Non Triggering Examples
// MARK: good
// MARK: - good
// MARK: -
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

Missing Docs

Identifier Enabled by default Supports autocorrection
missing_docs Disabled No

Public declarations should be documented.

Examples

Non Triggering Examples
/// docs
public func a() {}
/** docs */
public func a() {}
func a() {}
internal func a() {}
private func a() {}
// regular comment
func a() {}
/* regular comment */
func a() {}
/// docs
public protocol A {
/// docs
var b: Int { get } }
/// docs
public struct C: A {
public let b: Int
}
/// docs
public class A {
/// docs
public func b() {}
}
/// docs
public class B: A { override public func b() {} }
import Foundation
/// docs
public class B: NSObject {
// no docs
override public var description: String { fatalError() } }
Triggering Examples
public func a() {}
// regular comment
public func a() {}
/* regular comment */
public func a() {}
/// docs
public protocol A {
// no docs
var b: Int { get } }
/// docs
public struct C: A {

public let b: Int
}

Nesting

Identifier Enabled by default Supports autocorrection
nesting Enabled No

Types should be nested at most 1 level deep, and statements should be nested at most 5 levels deep.

Examples

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() {
}
}
}
}
}
}
}

Nimble Operator

Identifier Enabled by default Supports autocorrection
nimble_operator Disabled No

Prefer Nimble operator overloads over free matcher functions.

Examples

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))

Number Separator

Identifier Enabled by default Supports autocorrection
number_separator Disabled Yes

Underscores should be used as thousand separator in large decimal numbers.

Examples

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 = ↓-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 = +↓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 = 1__000
let foo = 1.0001
let foo = 1_000_000.000000_1
let foo = 1000000.000000_1

Object Literal

Identifier Enabled by default Supports autocorrection
object_literal Disabled No

Prefer object literals over image and color inits.

Examples

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)

Opening Brace Spacing

Identifier Enabled by default Supports autocorrection
opening_brace Enabled Yes

Opening braces should be preceded by a single space and on the same line as the declaration.

Examples

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
{ }
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{ }

Operator Usage Whitespace

Identifier Enabled by default Supports autocorrection
operator_usage_whitespace Disabled Yes

Operators should be surrounded by a single whitespace when they are being used.

Examples

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)
array.removeAtIndex(-200)
let name = "image-1"
button.setImage(#imageLiteral(resourceName: "image-1"), for: .normal)
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

Operator Function Whitespace

Identifier Enabled by default Supports autocorrection
operator_whitespace Enabled No

Operators should be surrounded by a single whitespace when defining them.

Examples

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 {}

Overridden methods call super

Identifier Enabled by default Supports autocorrection
overridden_super_call Disabled No

Some overridden methods should always call super

Examples

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) {
	}
}
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() {
	}
}

Private Outlets

Identifier Enabled by default Supports autocorrection
private_outlet Disabled No

IBOutlets should be private to avoid leaking UIKit to higher layers.

Examples

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!
}

Private Unit Test

Identifier Enabled by default Supports autocorrection
private_unit_test Enabled No

Unit tests marked private are silently skipped.

Examples

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() {}
 }
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() {}
 privatefunc test4() {}
 }
internal class FooTest: XCTestCase { func test1() {}
 internal func test2() {}
 public func test3() {}
 privatefunc test4() {}
 }
public class FooTest: XCTestCase { func test1() {}
 internal func test2() {}
 public func test3() {}
 privatefunc test4() {}
 }

Prohibited calls to super

Identifier Enabled by default Supports autocorrection
prohibited_super_call Disabled No

Some methods should not call super

Examples

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()
	}
}

Redundant Nil Coalescing

Identifier Enabled by default Supports autocorrection
redundant_nil_coalescing Disabled Yes

nil coalescing operator is only evaluated if the lhs is nil , coalescing operator with nil as rhs is redundant

Examples

Non Triggering Examples
var myVar: Int?; myVar ?? 0
Triggering Examples
var myVar: Int? = nil; myVar ?? nil
var myVar: Int? = nil; myVar↓??nil

Redundant Optional Initialization

Identifier Enabled by default Supports autocorrection
redundant_optional_initialization Enabled Yes

Initializing an optional variable with nil is redundant.

Examples

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
Triggering Examples
var myVar: Int? = nil
var myVar: Optional<Int> = nil
var myVar: Int?↓=nil
var myVar: Optional<Int>↓=nil

Redudant String Enum Value

Identifier Enabled by default Supports autocorrection
redundant_string_enum_value Enabled No

String enum values can be omitted when they are equal to the enumcase name.

Examples

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"
}

Redundant Void Return

Identifier Enabled by default Supports autocorrection
redundant_void_return Enabled Yes

Returning Void in a function declaration is redundant.

Examples

Non Triggering Examples
func foo() {}
func foo() -> Int {}
func foo() -> Int -> Void {}
let foo: Int -> Void
func foo() -> Int -> () {}
let foo: Int -> ()
Triggering Examples
func foo() -> Void {}
protocol Foo {
 func foo() -> Void
}
func foo() -> () {}
protocol Foo {
 func foo() -> ()
}

Returning Whitespace

Identifier Enabled by default Supports autocorrection
return_arrow_whitespace Enabled Yes

Return arrow and return type should be separated by a single space or on a separate line.

Examples

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 }

Sorted Imports

Identifier Enabled by default Supports autocorrection
sorted_imports Disabled No

Imports should be sorted.

Examples

Non Triggering Examples
import AAA
import BBB
import CCC
import DDD
Triggering Examples
import AAA
import ZZZ
import BBB
import CCC

Statement Position

Identifier Enabled by default Supports autocorrection
statement_position Enabled Yes

Else and catch should be on the same line, one space after the previous declaration.

Examples

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 {

Switch Case on Newline

Identifier Enabled by default Supports autocorrection
switch_case_on_newline Disabled No

Cases inside a switch should always be on a newline

Examples

Non Triggering Examples
case 1:
 return true
default:
 return true
case let value:
 return true
/*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]) {
case .myCase: // error from network
case let .myCase(value) where value > 10:
 return false
enum Environment {
 case development
}
enum Environment {
 case development(url: URL)
}
enum Environment {
 case development(url: URL) // staging
}
case #selector(aFunction(_:)):
 return false
Triggering Examples
case 1: return true
case let value: return true
default: return true
case "a string": return false
case .myCase: return false // error from network
case let .myCase(value) where value > 10: return false
case #selector(aFunction(_:)): return false

Syntactic Sugar

Identifier Enabled by default Supports autocorrection
syntactic_sugar Enabled No

Shorthand syntactic sugar should be used, i.e. [Int] instead of Array

Examples

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
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)

Todo

Identifier Enabled by default Supports autocorrection
todo Enabled No

TODOs and FIXMEs should be avoided.

Examples

Non Triggering Examples
// notaTODO:
// notaFIXME:
Triggering Examples
// ↓TODO:
// ↓FIXME:
// ↓TODO(note)
// ↓FIXME(note)
/* ↓FIXME: */
/* ↓TODO: */
/** ↓FIXME: */
/** ↓TODO: */

Trailing Comma

Identifier Enabled by default Supports autocorrection
trailing_comma Enabled No

Trailing commas in arrays and dictionaries should be avoided/enforced.

Examples

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,
]
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,
]

Trailing Newline

Identifier Enabled by default Supports autocorrection
trailing_newline Enabled Yes

Files should have a single trailing newline.

Examples

Non Triggering Examples
let a = 0
Triggering Examples
let a = 0
let a = 0

Trailing Semicolon

Identifier Enabled by default Supports autocorrection
trailing_semicolon Enabled Yes

Lines should not have trailing semicolons.

Examples

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; ; ;

Trailing Whitespace

Identifier Enabled by default Supports autocorrection
trailing_whitespace Enabled Yes

Lines should not have trailing whitespace.

Examples

Non Triggering Examples
let name: String
//
// 
let name: String //
let name: String // 
Triggering Examples
let name: String 
/* */ let name: String 

Type Body Length

Identifier Enabled by default Supports autocorrection
type_body_length Enabled No

Type bodies should not span too many lines.

Examples

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
}

Type Name

Identifier Enabled by default Supports autocorrection
type_name Enabled No

Type name should only contain alphanumeric characters, start with an uppercase character and span between 3 and 40 characters in length.

Examples

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
 }

Unused Closure Parameter

Identifier Enabled by default Supports autocorrection
unused_closure_parameter Enabled Yes

Unused parameter in a closure should be replaced with _.

Examples

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)
}
}
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
}

Unused Enumerated

Identifier Enabled by default Supports autocorrection
unused_enumerated Enabled No

When the index is not used, .enumerated() can be removed.

Examples

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() { }
Triggering Examples
for (_, foo) in bar.enumerated() { }
for (_, foo) in abc.bar.enumerated() { }
for (_, foo) in abc.something().enumerated() { }

Valid Docs

Identifier Enabled by default Supports autocorrection
valid_docs Enabled No

Documented declarations should be valid.

Examples

Non Triggering Examples
/// docs
public func a() {}
/// docs
/// - parameter param: this is void
public func a(param: Void) {}
/// docs
/// - parameter label: this is void
public func a(label param: Void) {}
/// docs
/// - parameter param: this is void
public func a(label param: Void) {}
/// docs
/// - Parameter param: this is void
public func a(label param: Void) {}
/// docs
/// - returns: false
public func no() -> Bool { return false }
/// docs
/// - Returns: false
public func no() -> Bool { return false }
/// Returns false
public func no() -> Bool { return false }
/// Returns false
var no: Bool { return false }
/// docs
var no: Bool { return false }
/// docs
/// - throws: NSError
func a() throws {}
/// docs
/// - Throws: NSError
func a() throws {}
/// docs
/// - parameter param: this is void
/// - returns: false
public func no(param: (Void -> Void)?) -> Bool { return false }
/// docs
/// - parameter param: this is void
///- parameter param2: this is void too
/// - returns: false
public func no(param: (Void -> Void)?, param2: String->Void) -> Bool {return false}
/// docs
/// - parameter param: this is void
public func no(param: (Void -> Void)?) {}
/// docs
/// - parameter param: this is void
///- parameter param2: this is void too
public func no(param: (Void -> Void)?, param2: String->Void) {}
/// docs👨‍👩‍👧‍👧
/// - returns: false
public func no() -> Bool { return false }
/// docs
/// - returns: tuple
public func no() -> (Int, Int) {return (1, 2)}
/// docs
/// - returns: closure
public func no() -> (Void->Void) {}
/// docs
/// - parameter param: this is void
/// - parameter param2: this is void too
func no(param: (Void) -> Void, onError param2: ((NSError) -> Void)? = nil) {}
/// docs
/// - parameter param: this is a void closure
/// - parameter param2: this is a void closure too
/// - parameter param3: this is a void closure too
func a(param: () -> Void, param2: (parameter: Int) -> Void, param3: (parameter: Int) -> Void) {}
/// docs
/// - parameter param: this is a void closure
/// - Parameter param2: this is a void closure too
/// - Parameter param3: this is a void closure too
func a(param: () -> Void, param2: (parameter: Int) -> Void, param3: (parameter: Int) -> Void) {}
/// docs
/// - parameter param: this is a void closure
/// - returns: Foo<Void>
func a(param: () -> Void) -> Foo<Void> {return Foo<Void>}
/// docs
/// - parameter param: this is a void closure
/// - returns: Foo<Void>
func a(param: () -> Void) -> Foo<[Int]> {return Foo<[Int]>}
/// docs
/// - throws: NSError
/// - returns: false
func a() throws -> Bool { return true }
/// docs
/// - parameter param: this is a closure
/// - returns: Bool
func a(param: (Void throws -> Bool)) -> Bool { return true }
Triggering Examples
/// docs
public func a(param: Void) {}
/// docs
/// - parameter invalid: this is void
public func a(param: Void) {}
/// docs
/// - parameter invalid: this is void
public func a(label param: Void) {}
/// docs
/// - parameter invalid: this is void
public func a() {}
/// docs
public func no() -> Bool { return false }
/// Returns false
public func a() {}
/// docs
/// - throws: NSError
func a() {}
/// docs
func a() throws {}
/// docs
/// - parameter param: this is void
public func no(param: (Void -> Void)?) -> Bool { return false }
/// docs
/// - parameter param: this is void
///- parameter param2: this is void too
public func no(param: (Void -> Void)?, param2: String->Void) -> Bool {return false}
/// docs
/// - parameter param: this is void
/// - returns: false
public func no(param: (Void -> Void)?) {}
/// docs
/// - parameter param: this is void
///- parameter param2: this is void too
/// - returns: false
public func no(param: (Void -> Void)?, param2: String->Void) {}
/// docs
public func no() -> (Int, Int) {return (1, 2)}
/// docs
/// - parameter param: this is void
///- parameter param2: this is void too
///- returns: closure
func no(param: (Void) -> Void, onError param2: ((NSError) -> Void)? = nil) {}
/// docs
/// - parameter param: this is a void closure
func a(param: () -> Void) -> Foo<Void> {return Foo<Void>}
/// docs
/// - parameter param: this is a void closure
func a(param: () -> Void) -> Foo<[Int]> {return Foo<[Int]>}
/// docs
func a() throws -> Bool { return true }

Valid IBInspectable

Identifier Enabled by default Supports autocorrection
valid_ibinspectable Enabled No

@IBInspectable should be applied to variables only, have its type explicit and be of a supported type

Examples

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
}
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>
}

Variable Name

Identifier Enabled by default Supports autocorrection
variable_name Enabled No

Variable 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.

Examples

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
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

Vertical Parameter Alignment

Identifier Enabled by default Supports autocorrection
vertical_parameter_alignment Enabled No

Function parameters should be aligned vertically if they're in multiple lines in a declaration.

Examples

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]
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]) { }

Vertical Whitespace

Identifier Enabled by default Supports autocorrection
vertical_whitespace Enabled Yes

Limit vertical whitespace to a single empty line.

Examples

Non Triggering Examples
let abc = 0
let abc = 0
/* bcs 



*/
// bca 
Triggering Examples
let aaaa = 0

struct AAAA {}


class BBBB {}

Void Return

Identifier Enabled by default Supports autocorrection
void_return Enabled Yes

Prefer -> Void over -> ().

Examples

Non Triggering Examples
let abc: () -> Void = {}
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: () ->() = {}
func foo(completion: () ->())
func foo(completion: () ->(   ))
let foo: (ConfigurationTests) -> () throws ->())

Weak Delegate

Identifier Enabled by default Supports autocorrection
weak_delegate Enabled No

Delegates should be weak to avoid reference cycles.

Examples

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?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment