From df4eb69e6663f4459fd57104ca81288acddb0338 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Wed, 7 Sep 2016 14:57:20 +1000 Subject: [PATCH] Add a linters tox environment The linters tox environment will run yamllint and flake8. Also fix a few trivial issues so the new target passes Change-Id: Ifa1e9379f7d1d1996f2cfb84233bce8b502979bb --- events.yaml | 1 + test-requirements.txt | 2 ++ tools/new-election.py | 3 ++- tools/render-wiki-list.py | 2 +- tox.ini | 9 ++++++++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/events.yaml b/events.yaml index bf96bf30..5b9dbf96 100644 --- a/events.yaml +++ b/events.yaml @@ -1,3 +1,4 @@ +--- - {'date': '2016-09-12T00:00', 'name': 'PTL nomination starts'} - {'date': '2016-09-18T23:45', 'name': 'PTL nomination ends'} - {'date': '2016-09-19T00:00', 'name': 'PTL elections begins'} diff --git a/test-requirements.txt b/test-requirements.txt index cfa74412..def134b0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,3 +4,5 @@ # needed for doc build sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 +flake8>=2.5.4,<2.6.0 # MIT +yamllint diff --git a/tools/new-election.py b/tools/new-election.py index feb40bb0..49800743 100755 --- a/tools/new-election.py +++ b/tools/new-election.py @@ -40,4 +40,5 @@ for project in project_list + ["TC"]: open("%s/.placeholder" % dpath, "w").close() print "[+] Created %s" % dpath -print "Done. Now please manually update events.yaml and doc/source/index.rst substitutions" +print("Done. Now please manually update events.yaml and " + "doc/source/index.rst substitutions") diff --git a/tools/render-wiki-list.py b/tools/render-wiki-list.py index 040ebda8..3150f502 100755 --- a/tools/render-wiki-list.py +++ b/tools/render-wiki-list.py @@ -2,7 +2,7 @@ import sys sys.path.append("doc/source/_exts") -from candidates import build_candidates_list +from candidates import build_candidates_list # noqa: E402 GIT_BASE = 'http://git.openstack.org/cgit/openstack/election/plain/' diff --git a/tox.ini b/tox.ini index 3ddfdcf4..bda5da2c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = docs +envlist = docs,linters minversion = 1.6 skipsdist = True @@ -10,8 +10,15 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt +[testenv:linters] +commands = yamllint events.yaml + flake8 + [testenv:venv] commands = {posargs} [testenv:docs] commands = python setup.py build_sphinx + +[flake8] +exclude=.tox,doc/source/conf.py