From ebfb2c6f72baf9d5bf589f6acb4a3f2e3a333404 Mon Sep 17 00:00:00 2001 From: Andrii Ostapenko Date: Sun, 17 May 2020 15:26:29 -0500 Subject: [PATCH] Add yamllint tox environment Adds yamllint tox environment with bootstrapping non-voting configuration. To work around a situation that some of overrides contain entries for replacement and are not actually valid yamls, all directories are copied to temporary directory, */values* files are modified to be readable by yamllint. Change-Id: I0084b243c1df1692178c59fb5b1b2fb7a4cbac44 --- tox.ini | 11 +++++++++++ yamllint.conf | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 yamllint.conf diff --git a/tox.ini b/tox.ini index 3493885747..0adc905016 100644 --- a/tox.ini +++ b/tox.ini @@ -20,3 +20,14 @@ commands = docstheme-build-translated.sh whitelist_externals = rm + +[testenv:lint] +deps = yamllint +commands = + bash -c "rm -rf {toxinidir}/.yamllint" + bash -c "mkdir -p {toxinidir}/.yamllint" + bash -c "cp -r $(ls {toxinidir}) {toxinidir}/.yamllint/" + bash -c "find {toxinidir}/.yamllint -type f -exec sed -i 's/%%%.*/XXX/g' \{\} +" + bash -c "yamllint -c {toxinidir}/yamllint.conf {toxinidir}/.yamllint/*/values*" +whitelist_externals = + bash diff --git a/yamllint.conf b/yamllint.conf new file mode 100644 index 0000000000..ea59c739a1 --- /dev/null +++ b/yamllint.conf @@ -0,0 +1,49 @@ +--- + +yaml-files: +- '*.yaml' +- '*.yml' +- '.yamllint' + +rules: + braces: + level: warning + brackets: + level: warning + colons: + level: warning + commas: + level: warning + comments: + level: warning + comments-indentation: + level: warning + document-end: + level: warning + document-start: + level: warning + empty-lines: + level: warning + empty-values: + level: warning + hyphens: + level: warning + indentation: + spaces: 2 + indent-sequences: whatever + level: warning + key-duplicates: + level: warning + key-ordering: disable + line-length: disable + new-line-at-end-of-file: + level: warning + new-lines: + level: warning + octal-values: + level: warning + quoted-strings: disable + trailing-spaces: enable + truthy: + level: warning +...