mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
fcf848608e
* Add Example wrapper in order to display test failures inline when running in Xcode. * Stop using Swift 5.1-only features so we can compile on Xcode 10.2. * Wrap strings in Example. * Add Changelog entry. * Wrap all examples in Example struct. * Better and more complete capturing of line numbers. * Fix broken test. * Better test traceability. * Address or disable linting warnings. * Add documentation comments. * Disable linter for a few cases. * Limit mutability and add copy-and-mutate utility functions. * Limit scope of mutability.
33 lines
1.4 KiB
Swift
33 lines
1.4 KiB
Swift
internal struct IdentifierNameRuleExamples {
|
|
static let nonTriggeringExamples = [
|
|
Example("let myLet = 0"),
|
|
Example("var myVar = 0"),
|
|
Example("private let _myLet = 0"),
|
|
Example("class Abc { static let MyLet = 0 }"),
|
|
Example("let URL: NSURL? = nil"),
|
|
Example("let XMLString: String? = nil"),
|
|
Example("override var i = 0"),
|
|
Example("enum Foo { case myEnum }"),
|
|
Example("func isOperator(name: String) -> Bool"),
|
|
Example("func typeForKind(_ kind: SwiftDeclarationKind) -> String"),
|
|
Example("func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool"),
|
|
Example("override func IsOperator(name: String) -> Bool"),
|
|
Example("enum Foo { case `private` }"),
|
|
Example("enum Foo { case value(String) }")
|
|
]
|
|
|
|
static let triggeringExamples = [
|
|
Example("↓let MyLet = 0"),
|
|
Example("↓let _myLet = 0"),
|
|
Example("private ↓let myLet_ = 0"),
|
|
Example("↓let myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0"),
|
|
Example("↓var myExtremelyVeryVeryVeryVeryVeryVeryLongVar = 0"),
|
|
Example("private ↓let _myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0"),
|
|
Example("↓let i = 0"),
|
|
Example("↓var id = 0"),
|
|
Example("private ↓let _i = 0"),
|
|
Example("↓func IsOperator(name: String) -> Bool"),
|
|
Example("enum Foo { case ↓MyEnum }")
|
|
]
|
|
}
|