From b7b06980b03a774f6d1cb68d3baaec8abea3bb8c Mon Sep 17 00:00:00 2001 From: Sergey Lukjanov Date: Fri, 16 Sep 2016 19:47:21 -0700 Subject: [PATCH] Yaml linter execution and config improved Change-Id: Ib74d2bdcf4cd46414c3f28e75dd07e0c14a625d6 --- service/mariadb.yaml | 16 ++++++++-------- tools/run-check-yaml-syntax.sh | 7 ------- tools/yamllint.sh | 5 +++++ tools/yamllint.yaml | 21 +++++++++++++++++++++ tox.ini | 2 +- 5 files changed, 35 insertions(+), 16 deletions(-) delete mode 100755 tools/run-check-yaml-syntax.sh create mode 100755 tools/yamllint.sh create mode 100644 tools/yamllint.yaml diff --git a/service/mariadb.yaml b/service/mariadb.yaml index 4ba7724..3b48ddc 100644 --- a/service/mariadb.yaml +++ b/service/mariadb.yaml @@ -9,10 +9,10 @@ service: readiness: /opt/ccp/bin/mariadb-readiness.sh liveness: "true" volumes: - - name: mysql-logs - path: "/var/log/ccp/mysql" - type: host - readOnly: False + - name: mysql-logs + path: "/var/log/ccp/mysql" + type: host + readOnly: False pre: - name: chown-logs-dir command: "sudo /bin/chown mysql:mysql /var/log/ccp/mysql" @@ -21,10 +21,10 @@ service: daemon: command: mysqld files: - - mariadb-my-cnf - - mariadb-readiness - - mariadb-bootstrap - - mariadb-security-reset.expect + - mariadb-my-cnf + - mariadb-readiness + - mariadb-bootstrap + - mariadb-security-reset.expect files: mariadb-my-cnf: path: /etc/mysql/my.cnf diff --git a/tools/run-check-yaml-syntax.sh b/tools/run-check-yaml-syntax.sh deleted file mode 100755 index e393c54..0000000 --- a/tools/run-check-yaml-syntax.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -### Temp yaml syntax checker script. -set -e -for file in $(find . -name '*.yaml'); do - yamllint -d relaxed $file -done diff --git a/tools/yamllint.sh b/tools/yamllint.sh new file mode 100755 index 0000000..6e84445 --- /dev/null +++ b/tools/yamllint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -ex + +workdir=$(dirname $0) +yamllint -c $workdir/yamllint.yaml $(find . -not -path '*/\.*' -type f -name '*.yaml') diff --git a/tools/yamllint.yaml b/tools/yamllint.yaml new file mode 100644 index 0000000..6c2e4a7 --- /dev/null +++ b/tools/yamllint.yaml @@ -0,0 +1,21 @@ +extends: default + +rules: + braces: + max-spaces-inside: 1 + comments: + level: error + comments-indentation: + level: warning + document-end: + present: no + document-start: + level: error + present: no + empty-lines: + max: 1 + max-start: 0 + max-end: 0 + line-length: + level: warning + max: 120 diff --git a/tox.ini b/tox.ini index d6f485a..3f79ce2 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,4 @@ skipsdist = True [testenv:linters] deps = yamllint commands = - {toxinidir}/tools/run-check-yaml-syntax.sh + {toxinidir}/tools/yamllint.sh