状況
Ansible向けに作成したYamlのスタイルチェックにyamllintを使っています。
文字数制限でErrorが出てしまいますが、使いやすさの問題からErrorを無視したいと思い調べたのでメモします。
※エラー出てしまうと、自動テストとかに組み込みづらいので
抑止前(エラー発生時)
$ yamllint misc.yaml
misc.yaml
3:81 error line too long (163 > 80 characters) (line-length)
4:81 error line too long (165 > 80 characters) (line-length)
5:81 error line too long (177 > 80 characters) (line-length)
6:81 error line too long (161 > 80 characters) (line-length)
7:81 error line too long (161 > 80 characters) (line-length)
8:81 error line too long (161 > 80 characters) (line-length)
9:81 error line too long (163 > 80 characters) (line-length)
10:81 error line too long (165 > 80 characters) (line-length)
11:81 error line too long (177 > 80 characters) (line-length)
12:81 error line too long (161 > 80 characters) (line-length)
13:81 error line too long (161 > 80 characters) (line-length)
14:81 error line too long (161 > 80 characters) (line-length)
Process finished with exit code 1
抑止方法
ファイルの上部に以下を追記
---
# yamllint disable rule:line-length
ファイル全体でrule:<抑止したいルール>
に記載したルールを抑止します
※disable-line
を利用すると特定行の抑止も可能
抑止後
$ yamllint misc.yaml
Process finished with exit code 0
参考
以下を参照しました