1
2

【TCA】TCAFeatureActionが使用されていない時はSwiftLintで警告を出す

Posted at

はじめに

TCAFeatureActionについては以下の記事を見てください

簡単にいうとActionを種類別に分けて、見やすさを向上させよう的なことです

SwiftLintの設定

実装

.swiftlint.ymlcustom_rulesという項目を追加します

.swiftlint.yml
disabled_rules:
...

opt_in_rules:
...

analyzer_rules:
...

custom_rules:
  check_tca_feature_action_conformance:
    include: ".swift"
    name: "Check TCAFeatureAction Conformance"
    regex: "\\s+enum\\s+Action\\s*:\\s*Equatable\\s*\\{[^\\}]*\\}"
    message: "Action enum should conform to TCAFeatureAction"
    severity: warning

おわり

SwiftLintマジで便利ですね

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2