From 950c4f19b75b1434e4d506c427db7b563453b9d7 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 18 Oct 2016 14:09:41 +1100 Subject: [PATCH] Reduce the scope of yamllints coverage Since I76bc62ef22d09e1b6c19ebcd9b12f6381e1fd2db the non-voting linters target has been failign as it was also checking yaml files in the virtualenvs created by tox [1]. This change modifies the way we invoke yamllint so that only files we actually care about are linted. We also configure yamllint to have a slight more generous line-length limit and to disable the 'truthy'[2] rule. [1] http://logs.openstack.org/10/382110/2/check/gate-governance-linters-ubuntu-xenial/6c8ae21/console.html#_2016-10-11_15_39_52_575891 [2] https://yamllint.readthedocs.io/en/latest/rules.html#module-yamllint.rules.truthy Change-Id: Ia0337aa49efb9ec832356eed374cc56bac1e75bc --- .yamllint | 8 ++++++++ tox.ini | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .yamllint diff --git a/.yamllint b/.yamllint new file mode 100644 index 000000000..a5e71f9d0 --- /dev/null +++ b/.yamllint @@ -0,0 +1,8 @@ +--- +rules: + line-length: + # Allow some of our longer URLs + max: 90 + allow-non-breakable-words: yes # Default + allow-non-breakable-inline-mappings: no # Default + truthy: disable diff --git a/tox.ini b/tox.ini index 16e1d5805..67081b3c5 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,11 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/test-requirements.txt [testenv:linters] -commands = yamllint . +whitelist_externals = bash +commands = bash -c "find {toxinidir} \ + \( -name .tox -prune \) \ + -o -type f -name '*.yaml' \ + -print0 | xargs -0 yamllint" {toxinidir}/tools/check_projects_yaml_alphabetized.sh [testenv:venv]