Пример определения пользовательского правила приведен здесь (сам не проверял, возможно, регулярное выражение потребует некоторой переделки). Вы можете проверить образец из swiftlint, предоставленной на странице https://github.com/realm/SwiftLint, в разделе Определение пользовательских правил.
custom_rules:
uiwebview_deprecated: # rule identifier
included: ".*\\.swift" # regex that defines paths to include during linting. optional.
excluded: ".*Test\\.swift" # regex that defines paths to exclude during linting. optional
name: "UIWebView deprecated" # rule name. optional.
regex: "(UIWebView)" # matching pattern
capture_group: 0 # number of regex capture group to highlight the rule violation at. optional.
match_kinds: # SyntaxKinds to match. optional.
- comment
- identifier
message: "UIWebView are deprecated, use WKWebView instead." # violation message. optional.
severity: error # violation severity. optional.
no_hiding_in_strings:
regex: "(UIWebView)"
match_kinds: string