SwiftLint 自定义基于正则表达式的规则中的属性
Attributes in SwiftLint custom regex-based rules
我正在为 SwiftLint 创建自定义规则来检查 color
的拼写。我需要它不区分大小写。
我目前正在使用 regex: "([C|c]olour)"
进行匹配,但我想使用不区分大小写的修饰符 /i
。我尝试了以下规则,但它不起作用:
custom_rules:
color_us_english:
regex: "(colour)/i"
message: "Use US English spelling to match Apple's API."
severity: warning
如何在 SwiftLint 中使用修饰符?
可能是不支持以下内容:
"(colour)/i"
请尝试:
"(?i)(colour)"
看看这个example。
我正在为 SwiftLint 创建自定义规则来检查 color
的拼写。我需要它不区分大小写。
我目前正在使用 regex: "([C|c]olour)"
进行匹配,但我想使用不区分大小写的修饰符 /i
。我尝试了以下规则,但它不起作用:
custom_rules:
color_us_english:
regex: "(colour)/i"
message: "Use US English spelling to match Apple's API."
severity: warning
如何在 SwiftLint 中使用修饰符?
可能是不支持以下内容:
"(colour)/i"
请尝试:
"(?i)(colour)"
看看这个example。