LoginSignup
6
5

More than 5 years have passed since last update.

SwiftLintの.swiftlint.ymlで起きたエラーへの対処

Last updated at Posted at 2016-01-14

エラー内容

Loading configuration from '.swiftlint.yml'
Linting Swift files in current working directory
No lintable files found at path ''
Command /bin/sh failed with exit code 1

状況

  1. homebrewでSwiftLintをインストール
  2. .swiftlint.ymlを記述して、ルートディレクトリに配置
  3. ビルド

↑ここで先ほどのエラー

.swiftlint.ymlを置くパスが間違っているわけではないはずなのに何だろうか?と思って色々といじってみました。

原因

includedの指定が間違っていたことが原因でした。

swiftlint.yml
included: 
  - hogehoge

ここには本来Lintの対象とするファイルのあるパスを記述すべきでした。

解決法

includedにはプロジェクト名を指定すれば大丈夫なようです。

swiftlint.yml
included: 
  - <プロジェクト名>

おまけ

includedのパス指定ですが、絶対パスを指定してもエラーは解消されました。
ただし、全く同じ設定が適用されているわけではありません。
警告が出たファイルを見てみると、絶対パスを指定した時だけ、XCTest, UITestクラスにもLintチェックが入っていました。

6
5
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
6
5