LoginSignup
0
0

More than 5 years have passed since last update.

yamllint で特定のルールを抑止する方法

Last updated at Posted at 2018-09-21

状況

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

参考

以下を参照しました

0
0
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
0
0