Skip to content

Commit 93da14d

Browse files
committed
Modify the diagnostic message of DontRepeatTypeInStaticProperties appropriately
1 parent 6e64b26 commit 93da14d

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Sources/SwiftFormat/Rules/DontRepeatTypeInStaticProperties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public final class DontRepeatTypeInStaticProperties: SyntaxLintRule {
6666

6767
extension Finding.Message {
6868
fileprivate static func removeTypeFromName(name: String, type: Substring) -> Finding.Message {
69-
"remove the suffix '\(type)' from the name of the variable '\(name)'"
69+
"remove '\(type)' from the name of the variable '\(name)'"
7070
}
7171
}
7272

Tests/SwiftFormatTests/Rules/DontRepeatTypeInStaticPropertiesTests.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ final class DontRepeatTypeInStaticPropertiesTests: LintOrFormatRuleTestCase {
3636
}
3737
""",
3838
findings: [
39-
FindingSpec("1️⃣", message: "remove the suffix 'Color' from the name of the variable 'redColor'"),
40-
FindingSpec("2️⃣", message: "remove the suffix 'Color' from the name of the variable 'blueColor'"),
41-
FindingSpec("3️⃣", message: "remove the suffix 'Sandwich' from the name of the variable 'bolognaSandwich'"),
42-
FindingSpec("4️⃣", message: "remove the suffix 'Sandwich' from the name of the variable 'hamSandwich'"),
43-
FindingSpec("5️⃣", message: "remove the suffix 'Person' from the name of the variable 'youngPerson'"),
44-
FindingSpec("6️⃣", message: "remove the suffix 'Game' from the name of the variable 'basketballGame'"),
45-
FindingSpec("7️⃣", message: "remove the suffix 'Game' from the name of the variable 'baseballGame'"),
46-
FindingSpec("8️⃣", message: "remove the suffix 'Session' from the name of the variable 'sharedSession'"),
47-
FindingSpec("9️⃣", message: "remove the suffix 'Cookie' from the name of the variable 'chocolateChipCookie'"),
39+
FindingSpec("1️⃣", message: "remove 'Color' from the name of the variable 'redColor'"),
40+
FindingSpec("2️⃣", message: "remove 'Color' from the name of the variable 'blueColor'"),
41+
FindingSpec("3️⃣", message: "remove 'Sandwich' from the name of the variable 'bolognaSandwich'"),
42+
FindingSpec("4️⃣", message: "remove 'Sandwich' from the name of the variable 'hamSandwich'"),
43+
FindingSpec("5️⃣", message: "remove 'Person' from the name of the variable 'youngPerson'"),
44+
FindingSpec("6️⃣", message: "remove 'Game' from the name of the variable 'basketballGame'"),
45+
FindingSpec("7️⃣", message: "remove 'Game' from the name of the variable 'baseballGame'"),
46+
FindingSpec("8️⃣", message: "remove 'Session' from the name of the variable 'sharedSession'"),
47+
FindingSpec("9️⃣", message: "remove 'Cookie' from the name of the variable 'chocolateChipCookie'"),
4848
]
4949
)
5050
}
@@ -70,7 +70,7 @@ final class DontRepeatTypeInStaticPropertiesTests: LintOrFormatRuleTestCase {
7070
}
7171
""",
7272
findings: [
73-
FindingSpec("1️⃣", message: "remove the suffix 'Thing' from the name of the variable 'defaultThing'")
73+
FindingSpec("1️⃣", message: "remove 'Thing' from the name of the variable 'defaultThing'")
7474
]
7575
)
7676
}
@@ -86,9 +86,8 @@ final class DontRepeatTypeInStaticPropertiesTests: LintOrFormatRuleTestCase {
8686
}
8787
""",
8888
findings: [
89-
FindingSpec("1️⃣", message: "remove the suffix 'Foo' from the name of the variable 'alternateFoo'")
89+
FindingSpec("1️⃣", message: "remove 'Foo' from the name of the variable 'alternateFoo'")
9090
]
9191
)
9292
}
93-
9493
}

0 commit comments

Comments
 (0)