Identifier Name

Identifier names should only contain alphanumeric characters and start with a lowercase character or should only contain capital letters. In an exception to the above, variable names may start with a capital letter when they are declared as static. Variable names should not be too long or too short.

  • Identifier: identifier_name
  • Enabled by default: Yes
  • Supports autocorrection: No
  • Kind: style
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    min_length
    KeyValue
    warning 3
    error 2
    max_length
    KeyValue
    warning 40
    error 60
    excluded [“^id$”]
    allowed_symbols []
    unallowed_symbols_severity error
    validates_start_with_lowercase error

Non Triggering Examples

let myLet = 0
var myVar = 0
private let _myLet = 0
class Abc { static let MyLet = 0 }
let URL: NSURL? = nil
let XMLString: String? = nil
override var i = 0
enum Foo { case myEnum }
func isOperator(name: String) -> Bool
func typeForKind(_ kind: SwiftDeclarationKind) -> String
func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool
override func IsOperator(name: String) -> Bool
enum Foo { case `private` }
enum Foo { case value(String) }
class Foo {
   static let Bar = 0
}
class Foo {
   static var Bar = 0
}

Triggering Examples

let _myLet = 0
private let myLet_ = 0
let myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
var myExtremelyVeryVeryVeryVeryVeryVeryLongVar = 0
private let _myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
let i = 0
var aa = 0
private let _i = 0