Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the diagnostic message of DontRepeatTypeInStaticProperties appropriately #918

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public final class DontRepeatTypeInStaticProperties: SyntaxLintRule {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ final class DontRepeatTypeInStaticPropertiesTests: LintOrFormatRuleTestCase {
}
""",
findings: [
FindingSpec("1️⃣", message: "remove the suffix 'Color' from the name of the variable 'redColor'"),
FindingSpec("2️⃣", message: "remove the suffix 'Color' from the name of the variable 'blueColor'"),
FindingSpec("3️⃣", message: "remove the suffix 'Sandwich' from the name of the variable 'bolognaSandwich'"),
FindingSpec("4️⃣", message: "remove the suffix 'Sandwich' from the name of the variable 'hamSandwich'"),
FindingSpec("5️⃣", message: "remove the suffix 'Person' from the name of the variable 'youngPerson'"),
FindingSpec("6️⃣", message: "remove the suffix 'Game' from the name of the variable 'basketballGame'"),
FindingSpec("7️⃣", message: "remove the suffix 'Game' from the name of the variable 'baseballGame'"),
FindingSpec("8️⃣", message: "remove the suffix 'Session' from the name of the variable 'sharedSession'"),
FindingSpec("9️⃣", message: "remove the suffix 'Cookie' from the name of the variable 'chocolateChipCookie'"),
FindingSpec("1️⃣", message: "remove 'Color' from the name of the variable 'redColor'"),
FindingSpec("2️⃣", message: "remove 'Color' from the name of the variable 'blueColor'"),
FindingSpec("3️⃣", message: "remove 'Sandwich' from the name of the variable 'bolognaSandwich'"),
FindingSpec("4️⃣", message: "remove 'Sandwich' from the name of the variable 'hamSandwich'"),
FindingSpec("5️⃣", message: "remove 'Person' from the name of the variable 'youngPerson'"),
FindingSpec("6️⃣", message: "remove 'Game' from the name of the variable 'basketballGame'"),
FindingSpec("7️⃣", message: "remove 'Game' from the name of the variable 'baseballGame'"),
FindingSpec("8️⃣", message: "remove 'Session' from the name of the variable 'sharedSession'"),
FindingSpec("9️⃣", message: "remove 'Cookie' from the name of the variable 'chocolateChipCookie'"),
]
)
}
Expand All @@ -70,7 +70,7 @@ final class DontRepeatTypeInStaticPropertiesTests: LintOrFormatRuleTestCase {
}
""",
findings: [
FindingSpec("1️⃣", message: "remove the suffix 'Thing' from the name of the variable 'defaultThing'")
FindingSpec("1️⃣", message: "remove 'Thing' from the name of the variable 'defaultThing'")
]
)
}
Expand All @@ -86,9 +86,8 @@ final class DontRepeatTypeInStaticPropertiesTests: LintOrFormatRuleTestCase {
}
""",
findings: [
FindingSpec("1️⃣", message: "remove the suffix 'Foo' from the name of the variable 'alternateFoo'")
FindingSpec("1️⃣", message: "remove 'Foo' from the name of the variable 'alternateFoo'")
]
)
}

}