diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..1ef5d8c39 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +--- +repos: + - repo: https://gitlab.com/pycqa/flake8.git + rev: 3.8.4 + hooks: + - id: flake8 + language_version: python3 + args: ['--config=setup.cfg'] + pass_filenames: false diff --git a/setup.cfg b/setup.cfg index be30186aa..d3e13a310 100644 --- a/setup.cfg +++ b/setup.cfg @@ -116,3 +116,16 @@ oslo.config.opts = undercloud_config = tripleoclient.config.undercloud:list_opts standalone_config = tripleoclient.config.standalone:list_opts minion_config = tripleoclient.config.minion:list_opts + +[flake8] +show-source = True +builtins = _ +exclude = + .venv, + .git, + .tox, + dist, + doc/source/conf.py, + releasenotes + +#.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,releasenotes diff --git a/test-requirements.txt b/test-requirements.txt index 74bc779b7..0506d3427 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,6 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking>=3.0.1,<3.1.0 # Apache-2.0 - coverage!=4.4,>=4.0 # Apache-2.0 docutils>=0.11 # OSI-Approved Open Source, Public Domain fixtures>=3.0.0 # Apache-2.0/BSD diff --git a/tox.ini b/tox.ini index 1365f65b1..f17ca3ef4 100644 --- a/tox.ini +++ b/tox.ini @@ -35,7 +35,8 @@ deps = bindep commands = bindep test [testenv:pep8] -commands = flake8 +deps = pre-commit +commands = pre-commit run -a [testenv:venv] commands = {posargs} @@ -66,11 +67,6 @@ deps = commands = sphinx-build -b html doc/source doc/build/html -[flake8] -show-source = True -builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,releasenotes - [testenv:pdf-docs] whitelist_externals = make description = diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py index fec51a30a..7f6d1b265 100644 --- a/tripleoclient/utils.py +++ b/tripleoclient/utils.py @@ -762,8 +762,8 @@ def is_loopback(host): Return False if not. """ loopbacks = ['127', '::1'] - for l in loopbacks: - if host.startswith(l): + for item in loopbacks: + if host.startswith(item): return True return False diff --git a/tripleoclient/v2/tripleo_container_image.py b/tripleoclient/v2/tripleo_container_image.py index 32b685de9..68e23583b 100644 --- a/tripleoclient/v2/tripleo_container_image.py +++ b/tripleoclient/v2/tripleo_container_image.py @@ -375,7 +375,7 @@ class Build(command.Command): os.path.abspath(parsed_args.config_path)) for image in expected_images: if (image != config_path_base and image not in image_configs): - self.log.debug("processing image configs".format(image)) + self.log.debug("processing image config %s", image) image_config = self.find_image( image, self.tcib_config_path,