From 3dd307110700e3398e1567e6453ee290e8a0ff30 Mon Sep 17 00:00:00 2001 From: Peter Razumovsky Date: Fri, 9 Dec 2016 15:00:46 +0400 Subject: [PATCH] Add linter and bashate tox checks For correct job succeed need to add tox checkers. Change-Id: I725079819fc00c12da62389142a2b627e8352761 --- tools/yamllint.sh | 5 +++++ tools/yamllint.yaml | 21 +++++++++++++++++++++ tox.ini | 17 +++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100755 tools/yamllint.sh create mode 100644 tools/yamllint.yaml create mode 100644 tox.ini 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 new file mode 100644 index 0000000..9584e6f --- /dev/null +++ b/tox.ini @@ -0,0 +1,17 @@ +[tox] +minversion = 1.6 +envlist = linters,bashate +skipsdist = True + +[testenv:venv] +commands = {posargs} + +[testenv:linters] +deps = yamllint +commands = + {toxinidir}/tools/yamllint.sh + +[testenv:bashate] +deps = bashate>=0.2 +whitelist_externals = bash +commands = bash -c "find {toxinidir} -type f -name '*.sh' -not -path '*/.tox/*' -print0 | xargs -0 bashate -v" \ No newline at end of file