Cap bashate and fix linters tests

Bashate is pinned to ensure that for the rest of the cycle, and
once this becomes a stable branch, there are no code changes
needed for updates to the linting tool.

Also, the tox configuration is updated to ensure that it consumes
the dev-requirements file for all lint testing.

Finally, a H404 & H405 PEP8 violation is resolved in a python
script.

Change-Id: I78056d1d22228f073c44e9ee4e78534a4010effe
(cherry picked from commit 13bea32989)
This commit is contained in:
Jesse Pretorius 2016-03-07 17:36:30 +00:00
parent e9cb2a8276
commit e892ccfb87
3 changed files with 7 additions and 23 deletions

View File

@ -17,7 +17,8 @@ import yaml
def add_new_dict_data(original, new):
"""
"""Adds/appends new entries to existing dicts
Adds new key/value entries to existing dictionaries, and appends
new leaf values.
"""

View File

@ -1,10 +1,11 @@
ansible-lint>=2.0.3
ansible>1.9,<2.0
ansible-lint>=2.0.3,<=2.3.6
bashate==0.5.0 # Apache-2.0
flake8==2.2.4
hacking>=0.10.0,<0.11
mccabe==0.2.1 # capped for flake8
pep8==1.5.7
pyflakes==0.8.1
mccabe==0.2.1 # capped for flake8
bashate>=0.2 # Apache-2.0
# this is required for the docs build jobs
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2

20
tox.ini
View File

@ -8,6 +8,7 @@ usedevelop = True
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
whitelist_externals = bash
[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
@ -23,8 +24,6 @@ commands = {posargs}
# Run hacking/flake8 check for all python files
[testenv:pep8]
deps = flake8
whitelist_externals = bash
commands =
bash -c "grep -Irl \
-e '!/usr/bin/env python' \
@ -48,9 +47,6 @@ commands =
ignore=F403,H303
[testenv:bashate]
deps =
bashate
whitelist_externals = bash
commands =
# Run bashate check for all bash scripts
# Ignores the following rules:
@ -67,18 +63,11 @@ commands =
{toxinidir} | xargs bashate --error . --verbose --ignore=E003,E006,E040"
[testenv:ansible-lint]
deps =
ansible>1.9,<2.0
ansible-lint
whitelist_externals = bash
commands =
# Perform an Ansible lint check
bash -c "ansible-lint {toxinidir}/playbooks/*.yml"
[testenv:ansible-syntax]
deps =
ansible>1.9,<2.0
whitelist_externals = bash
commands =
# Perform an Ansible syntax check
bash -c "mkdir -p {envtmpdir}/ansible; \
@ -102,13 +91,6 @@ commands =
{toxinidir}/playbooks/*.yml"
[testenv:linters]
deps =
{[testenv:pep8]deps}
{[testenv:bashate]deps}
{[testenv:ansible-lint]deps}
# note that the ansible-syntax deps are omitted on purpose as the
# ansible-lint env contains duplicate items in its dep list
whitelist_externals = bash
commands =
{[testenv:pep8]commands}
{[testenv:bashate]commands}