Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1694 lint errors #1695

Merged
merged 7 commits into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude = .venv/,.tox/,dist/,build/,doc/,.eggs/,molecule/provisioner/ansible/plugins/libraries/goss.py
format = pylint
ignore = E741,W503
ignore = E741,W503,W504
2 changes: 2 additions & 0 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flake8>=3.6.0,<4
yamllint>=1.11.1,<2
3 changes: 1 addition & 2 deletions molecule/command/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ class Matrix(base.Base):
@click.option('--scenario-name', '-s', help='Name of the scenario to target.')
# NOTE(retr0h): Cannot introspect base.Base for `click.Choice`, since
# subclasses have not all loaded at this point.
@click.argument(
'subcommand', nargs=1, type=click.UNPROCESSED)
@click.argument('subcommand', nargs=1, type=click.UNPROCESSED)
def matrix(ctx, scenario_name, subcommand): # pragma: no cover
"""
List matrix of steps used to test instances.
Expand Down
4 changes: 2 additions & 2 deletions molecule/dependency/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Shell(base.Base):
``Shell`` is an alternate dependency manager. It is intended to run a
command in situations where `Ansible Galaxy`_ and `Gilt`_ don't suffice.

The ``command`` to execute is required, and is relative to Molecule's project
directory when referencing a script not in $PATH.
The ``command`` to execute is required, and is relative to Molecule's
project directory when referencing a script not in $PATH.

.. note::

Expand Down
4 changes: 2 additions & 2 deletions molecule/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Interpolator(object):
If a literal dollar sign is needed in a configuration, use a double dollar
sign (`$$`).

Molecule will substitute special ``MOLECULE_`` environment variables defined
in `molecule.yml`.
Molecule will substitute special ``MOLECULE_`` environment variables
defined in `molecule.yml`.

.. important::

Expand Down
4 changes: 2 additions & 2 deletions molecule/provisioner/ansible_playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def __init__(self, playbook, config, out=LOG.out, err=LOG.error):

def bake(self):
"""
Bake an ``ansible-playbook`` command so it's ready to execute and returns
None.
Bake an ``ansible-playbook`` command so it's ready to execute and
returns None.

:return: None
"""
Expand Down
5 changes: 3 additions & 2 deletions molecule/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ def print_environment_vars(env):

combined_env = ansible_env.copy()
combined_env.update(molecule_env)
print_debug('SHELL REPLAY', " ".join(
["{}={}".format(k, v) for (k, v) in sorted(combined_env.items())]))
print_debug(
'SHELL REPLAY', " ".join(
["{}={}".format(k, v) for (k, v) in sorted(combined_env.items())]))
print()


Expand Down
4 changes: 2 additions & 2 deletions molecule/verifier/goss.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class Goss(base.Base):
and execute Goss using a community written Goss Ansible module bundled with
Molecule.

Additional options can be passed to ``goss validate`` by modifying the verify
playbook.
Additional options can be passed to ``goss validate`` by modifying the
verify playbook.

.. code-block:: yaml

Expand Down
3 changes: 2 additions & 1 deletion molecule/verifier/testinfra.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class Testinfra(base.Base):
.. note::

Molecule will remove any options matching '^[v]+$', and pass ``-vvv``
to the underlying ``py.test`` command when executing ``molecule --debug``.
to the underlying ``py.test`` command when executing
``molecule --debug``.

.. code-block:: yaml

Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-r lint-requirements.txt
ansible-lint>=4.0.1,<5
anyconfig==0.9.7
cerberus==1.2
click==6.7
click-completion==0.3.1
colorama==0.3.9
cookiecutter==1.6.0
flake8==3.5.0
idna<2.8 # because indirect dependency "requests" conflict with it now
python-gilt==1.2.1
Jinja2==2.10
Expand All @@ -18,4 +18,3 @@ six==1.11.0
tabulate==0.8.2
testinfra==1.16.0
tree-format==0.1.2
yamllint==1.11.1
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ pytest-xdist==1.26.0
shade==1.22.2
twine
wheel==0.30.0
yapf==0.21.0
yapf>=0.25.0,<2
themr0c marked this conversation as resolved.
Show resolved Hide resolved
https://github.com/AndreLouisCaron/tox-tags/archive/master.zip#egg=tox-tags
6 changes: 3 additions & 3 deletions test/functional/docker/test_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ def test_host_group_vars(scenario_to_test, with_scenario, scenario_name):
out = pytest.helpers.run_command(cmd, log=False)
out = util.strip_ansi_escape(out.stdout.decode('utf-8'))

assert re.search('\[all\].*?ok: \[instance\]', out, re.DOTALL)
assert re.search('\[example\].*?ok: \[instance\]', out, re.DOTALL)
assert re.search('\[example_1\].*?ok: \[instance\]', out, re.DOTALL)
assert re.search(r'\[all\].*?ok: \[instance\]', out, re.DOTALL)
assert re.search(r'\[example\].*?ok: \[instance\]', out, re.DOTALL)
assert re.search(r'\[example_1\].*?ok: \[instance\]', out, re.DOTALL)


@skip_unsupported_matrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def test_cpus(host):


def test_memory(host):
total_memory = host.ansible("setup")['ansible_facts'][
'ansible_memtotal_mb']
total_memory = host.ansible(
"setup")['ansible_facts']['ansible_memtotal_mb']

assert (1024 / 2) <= int(total_memory) <= 1024

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def test_cpus(host):


def test_memory(host):
total_memory = host.ansible("setup")['ansible_facts'][
'ansible_memtotal_mb']
total_memory = host.ansible(
"setup")['ansible_facts']['ansible_memtotal_mb']

assert (1024 + 1024 / 2) <= int(total_memory) <= 2048

Expand Down
37 changes: 22 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
minversion = 3.7.0
envlist =
lint
py{27,36,37}-ansible{24,25,26,27}-{functional,unit}
py{27,36,37}-lint
format-check
doc
skipdist = True
Expand Down Expand Up @@ -34,14 +34,33 @@ commands =
lint: flake8
lint: yamllint -s test/ molecule/

[testenv:lint]
deps =
-rlint-requirements.txt
extras = []
skip_install = true
tags =
lint
usedevelop = false

[testenv:format]
commands =
yapf -i -r molecule/ test/

deps = yapf>=0.25.0,<2
extras =
skip_install = true
tags =
format
usedevelop = false
[testenv:format-check]
commands =
yapf -d -r molecule/ test/

deps = {[testenv:format]deps}
extras = {[testenv:format]extras}
skip_install = true
tags =
format
usedevelop = false
[testenv:doc]
passenv = *
commands =
Expand Down Expand Up @@ -101,18 +120,6 @@ tags =
tags =
unit

[testenv:py27-lint]
tags =
unit

[testenv:py36-lint]
tags =
unit

[testenv:py37-lint]
tags =
unit

[testenv:py27-ansible24-functional]
tags =
functional
Expand Down