mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
d305e03905
Current events have renewed the conversation in our community about the roles of terminology with racist connotations in our software. Many companies and developers are now taking appropriate steps to remove this terminology from their codebases and products. (e.g. [GitHub](https://twitter.com/natfriedman/status/1271253144442253312)) This small rule prevents the use of declarations that contain any of the terms: whitelist, blacklist, master, and slave. It may be appropriate to add more terms to this list now or in the future.
74 lines
1.9 KiB
Swift
74 lines
1.9 KiB
Swift
internal struct InclusiveLanguageRuleExamples {
|
|
// MARK: - Default config
|
|
|
|
static let nonTriggeringExamples: [Example] = [
|
|
Example("let foo = \"abc\""),
|
|
Example("""
|
|
enum AllowList {
|
|
case foo, bar
|
|
}
|
|
"""),
|
|
Example("func updateAllowList(add: String) {}")
|
|
]
|
|
|
|
static let triggeringExamples: [Example] = [
|
|
Example("let ↓slave = \"abc\""),
|
|
Example("""
|
|
enum ↓BlackList {
|
|
case foo, bar
|
|
}
|
|
"""),
|
|
Example("func ↓updateWhiteList(add: String) {}"),
|
|
Example("""
|
|
enum ListType {
|
|
case ↓whitelist
|
|
case ↓blacklist
|
|
}
|
|
"""),
|
|
Example("↓init(master: String, slave: String) {}"),
|
|
Example("""
|
|
final class FooBar {
|
|
func register<↓Master, ↓Slave>(one: Master, two: Slave) {}
|
|
}
|
|
""")
|
|
]
|
|
|
|
// MARK: - Non-default config
|
|
|
|
static let nonTriggeringExamplesWithConfig: [Example] = [
|
|
Example("""
|
|
public let blackList = [
|
|
"foo", "bar"
|
|
]
|
|
""", configuration: [
|
|
"override_terms": ["abc123"]
|
|
]),
|
|
Example("""
|
|
private func doThisThing() {}
|
|
""", configuration: [
|
|
"override_terms": ["abc123"],
|
|
"additional_terms": ["xyz789"]
|
|
])
|
|
]
|
|
|
|
static let triggeringExamplesWithConfig: [Example] = [
|
|
Example("""
|
|
enum Things {
|
|
case foo, ↓fizzBuzz
|
|
}
|
|
""", configuration: [
|
|
"additional_terms": ["fizzbuzz"]
|
|
]),
|
|
Example("""
|
|
private func ↓thisIsASwiftyFunction() {}
|
|
""", configuration: [
|
|
"additional_terms": ["swift"]
|
|
]),
|
|
Example("""
|
|
private var ↓fooBar = "abc"
|
|
""", configuration: [
|
|
"additional_terms": ["FoObAr"]
|
|
])
|
|
]
|
|
}
|