From d7051e8c5528114072cf1a7c997de2c83e706296 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Mon, 9 Sep 2019 13:43:49 -0500 Subject: [PATCH] Adding zuul jobs for new repo This job adds a single linters tox target. The linters target is an aggregation of linters for this repo including: - flake8 - bashate Other linters such as yamllint can be added to this repo by later commits. Certain bashate and flake8 codes are suppressed. They can be enabled by later commits. This commit also adds basic contributing and hacking docs. Change-Id: I3d12e16b09d94a5eb1f6ea5e7e77f78bc082af84 Story: 2006166 Task: 36536 Signed-off-by: Al Bailey --- .gitignore | 1 + .zuul.yaml | 8 +++++ CONTRIBUTING.rst | 16 +++++++++ HACKING.rst | 17 ++++++++++ requirements.txt | 1 + test-requirements.txt | 3 ++ tox.ini | 76 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 122 insertions(+) create mode 100644 .gitignore create mode 100644 .zuul.yaml create mode 100644 CONTRIBUTING.rst create mode 100644 HACKING.rst create mode 100644 requirements.txt create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..172bf578 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.tox diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 00000000..7ccbd0a6 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,8 @@ +--- +- project: + check: + jobs: + - openstack-tox-linters + gate: + jobs: + - openstack-tox-linters diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..f2f8e6d9 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,16 @@ +If you would like to contribute to the development of OpenStack, +you must follow the steps in this page: + + https://docs.openstack.org/infra/manual/developers.html + +Once those steps have been completed, changes to OpenStack +should be submitted for review via the Gerrit tool, following +the workflow documented at: + + https://docs.openstack.org/infra/manual/developers.html#development-workflow + +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed in Launchpad: + + https://bugs.launchpad.net/starlingx diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 00000000..facc7a4c --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,17 @@ +StarlingX Utilities Style Commandments +====================================== + +- Step 1: Read the OpenStack style commandments + https://docs.openstack.org/hacking/latest/ +- Step 2: Read on + +Utilities Specific Commandments +------------------------------- + +None so far + +Running tests +------------- +The approach to running tests is to simply run the command ``tox``. This will +create virtual environments, populate them with dependencies and run all of +the tests that OpenStack CI systems run. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..c01ade29 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +# Nothing diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..8ae3e22f --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +# hacking pulls in flake8 +hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +bashate >= 0.2 diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..164fe1ed --- /dev/null +++ b/tox.ini @@ -0,0 +1,76 @@ +[tox] +envlist = linters +minversion = 2.3 +skipsdist = True +sitepackages=False + +[testenv] +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 + OS_DEBUG=1 + OS_LOG_CAPTURE=1 +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +whitelist_externals = + bash + +[testenv:bashate] +# Treat all E* codes as Errors rather than warnings using: -e 'E*' +# The following codes are being suppressed: +# E006 line too long +# E010 The "do" should be on same line as for +# E041 Arithmetic expansion using $[ is deprecated for $(( +# E042 local declaration hides errors +# E043 Arithmetic compound has inconsistent return semantics +# E044 Use [[ for non-POSIX comparisions +commands = + bash -c "find {toxinidir} \ + -not \( -type d -name .?\* -prune \) \ + -type f \ + -not -name \*~ \ + -not -name \*.md \ + -name \*.sh \ + -print0 | xargs -n 1 -0 bashate -v \ + -i E006,E010,E041,E042,E043,E044 \ + -e 'E*'" + +[flake8] +# Note: hacking pulls in flake8 2.5.5 which can not parse an ignore list spanning multiple lines +# F errors are high priority to fix. W are warnings. E series are pep8, H series are hacking +# F401 'FOO' imported but unused +# F841 local variable 'FOO' is assigned to but never used +# W291 trailing whitespace +# W391 blank line at end of file +# E128 continuation line under-indented for visual indent +# E221 multiple spaces before operator +# E226 missing whitespace around arithmetic operator +# E227 missing whitespace around bitwise or shift operator +# E241 multiple spaces after ',' +# E265 block comment should start with '# ' +# E302 expected 2 blank lines, found 1 +# E501 line too long +# E502 the backslash is redundant between brackets +# E702 multiple statements on one line (semicolon) +# H101 is TODO +# H104 File contains nothing but comments +# H201 no 'except:' at least use 'except Exception:' +# H238 old style class declaration, use new style (inherit from `object`) +# H306 imports not in alphabetical order (sys, re) +# H401 docstring should not start with a space +# H405 multi line docstring summary not separated with an empty line +ignore = F401,F841,W291,W391,E128,E221,E226,E227,E241,E265,E302,E501,E502,E702,H101,H104,H201,H238,H306,H401,H405 +# max-line-length is not referenced if E501 is suppressed +max-line-length=80 + +[testenv:flake8] +commands = + flake8 + +[testenv:linters] +commands = + {[testenv:bashate]commands} + {[testenv:flake8]commands}