mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
Fixing existing violations
This commit is contained in:
@@ -31,7 +31,7 @@ public struct ExplicitInitRule: ASTRule, ConfigurationProviderRule, CorrectableR
|
||||
"[String.self].map { Type in Type↓.init(1) }" // starting with capital assumes as type
|
||||
],
|
||||
corrections: [
|
||||
"[1].flatMap{String↓.init($0)}" : "[1].flatMap{String($0)}"
|
||||
"[1].flatMap{String↓.init($0)}": "[1].flatMap{String($0)}"
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ public struct StatementPositionRule: CorrectableRule, ConfigurationProviderRule
|
||||
"↓}\n\t catch {"
|
||||
],
|
||||
corrections: [
|
||||
" }else if {":" }\n else if {",
|
||||
"}\n else {":"}\nelse {",
|
||||
" }\ncatch {":" }\n catch {",
|
||||
"}\n\t catch {":"}\ncatch {"
|
||||
" }else if {": " }\n else if {",
|
||||
"}\n else {": "}\nelse {",
|
||||
" }\ncatch {": " }\n catch {",
|
||||
"}\n\t catch {": "}\ncatch {"
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class ConfigurationTests: XCTestCase {
|
||||
|
||||
func testWhitelistRules() {
|
||||
let whitelist = ["nesting", "todo"]
|
||||
let config = Configuration(dict: ["whitelist_rules": whitelist])!
|
||||
let config = Configuration(dict: ["whitelist_rules": whitelist])!
|
||||
let configuredIdentifiers = config.rules.map {
|
||||
type(of: $0).description.identifier
|
||||
}.sorted()
|
||||
@@ -85,7 +85,7 @@ class ConfigurationTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testDisabledRules() {
|
||||
let disabledConfig = Configuration(dict: ["disabled_rules": ["nesting", "todo"]])!
|
||||
let disabledConfig = Configuration(dict: ["disabled_rules": ["nesting", "todo"]])!
|
||||
XCTAssertEqual(disabledConfig.disabledRules,
|
||||
["nesting", "todo"],
|
||||
"initializing Configuration with valid rules in Dictionary should succeed")
|
||||
@@ -97,7 +97,7 @@ class ConfigurationTests: XCTestCase {
|
||||
XCTAssertEqual(expectedIdentifiers, configuredIdentifiers)
|
||||
|
||||
// Duplicate
|
||||
let duplicateConfig = Configuration(dict: ["disabled_rules": ["todo", "todo"]])
|
||||
let duplicateConfig = Configuration(dict: ["disabled_rules": ["todo", "todo"]])
|
||||
XCTAssert(duplicateConfig == nil, "initializing Configuration with duplicate rules in " +
|
||||
"Dictionary should fail")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user