пользовательское предупреждение swift-lint для использования UIWebview - PullRequest
0 голосов
/ 19 марта 2020

, так как apple больше не поддерживает UIWebview, возможно ли иметь предупреждение swift-lint для этого.

Как сделать пользовательское предупреждение UIWebview swift-lint предупреждением или ошибкой.

1 Ответ

0 голосов
/ 19 марта 2020

Пример определения пользовательского правила приведен здесь (сам не проверял, возможно, регулярное выражение потребует некоторой переделки). Вы можете проверить образец из 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
...