diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..b54dd76d --- /dev/null +++ b/.yamllint @@ -0,0 +1,8 @@ +--- +extends: default + +rules: + # 80 chars should be enough, but don't fail if a line is longer + line-length: + max: 80 + level: warning diff --git a/.zuul.yaml b/.zuul.yaml index 8e59b7bb..9031fa18 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -8,7 +8,6 @@ jobs: - openstack-tox-linters - nfv-tox-pep8 - - nfv-tox-py27 - nfv-tox-py39 - nfv-tox-pylint - nova-api-proxy-tox-pep8 @@ -17,7 +16,6 @@ jobs: - openstack-tox-linters - nfv-tox-pep8 - - nfv-tox-py27 - nfv-tox-py39 - nfv-tox-pylint - nova-api-proxy-tox-pep8 @@ -26,51 +24,37 @@ jobs: - stx-nfv-upload-git-mirror -- job: - name: nfv-tox-py27 - parent: tox - description: Run py27 for nfv - nodeset: ubuntu-xenial - required-projects: - - starlingx/fault - vars: - tox_envlist: py27 - tox_extra_args: -c nfv/tox.ini - - job: name: nfv-tox-py39 - parent: tox-py39 + parent: openstack-tox-py39 description: Run py39 for nfv nodeset: debian-bullseye required-projects: - starlingx/fault - starlingx/root vars: - tox_envlist: py39 tox_extra_args: -c nfv/tox.ini - bindep_profile: test py39 - python_version: 3.9 + tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' - job: name: nfv-tox-pep8 - parent: tox + parent: openstack-tox-pep8 description: Run pep8 for nfv - required-projects: - - starlingx/fault vars: - tox_envlist: pep8 tox_extra_args: -c nfv/tox.ini - job: name: nfv-tox-pylint parent: tox description: Run pylint for nfv - nodeset: ubuntu-xenial + nodeset: debian-bullseye required-projects: - starlingx/fault + - starlingx/root vars: tox_envlist: pylint tox_extra_args: -c nfv/tox.ini + tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' - job: name: nova-api-proxy-tox-pep8 @@ -84,42 +68,14 @@ name: nova-api-proxy-tox-pylint parent: tox description: Run pylint for nova-api-proxy - nodeset: ubuntu-xenial + nodeset: debian-bullseye + required-projects: + - starlingx/root vars: tox_envlist: pylint tox_extra_args: -c nova-api-proxy/tox.ini + tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' -- job: - name: flock-devstack-nfv - parent: flock-devstack-base-min - required-projects: - - openstack/barbican - - openstack/python-barbicanclient - - starlingx/config - - starlingx/fault - - starlingx/integ - - starlingx/metal - - starlingx/update - vars: - tox_envlist: functional - devstack_services: - # StarlingX services - cgtsclient: true - fm-common: true - fm-api: true - fm-rest-api: true - fm-mgr: true - nfv-common: true - nfv-vim: true - nfv-client: true - devstack_plugins: - barbican: https://opendev.org/openstack/barbican - config: https://opendev.org/starlingx/config - fault: https://opendev.org/starlingx/fault - integ: https://opendev.org/starlingx/integ - metal: https://opendev.org/starlingx/metal - nfv: https://opendev.org/starlingx/nfv - update: https://opendev.org/starlingx/update - job: name: stx-nfv-upload-git-mirror parent: upload-git-mirror diff --git a/nfv/pylint.rc b/nfv/pylint.rc index 58c67dd9..00365bdf 100755 --- a/nfv/pylint.rc +++ b/nfv/pylint.rc @@ -117,21 +117,33 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # W0401 wildcard-import # W0404 reimported # W0511 fixme +# W0602 global-variable-not-assigned # W0603 Using the global statement warning # W0612 Unused variable warning # W0613 Unused argument warning # W0621 redefined-outer-name # W0622 redefined-builtin # W0703 broad except warning -# W0706: The except handler raises immediately (try-except-raise) +# W0706 The except handler raises immediately (try-except-raise) +# W0707 raise-missing-from +# W1310 format-string-without-interpolation # W1401 anomalous-backslash-in-string -# W1505: Using deprecated method getargspec() (deprecated-method) -# E0012: pylint for python3 does not support inline deprecation -# Disable Python3 checkers: -# W1618: no-absolute-import -disable=C, R, E0012, W0120, W0125, W0212, W0221, W0223, W0231, W0235, - W0401, W0404, W0511, W0603, W0612, W0613, W0621, W0622, W0703, W1401, - W0107, W0706, W1505, W1618 +# W1406 redundant-u-string-prefix +# W1505 Using deprecated method getargspec() (deprecated-method) +# W1514 unspecified-encoding +# W1618 no-absolute-import (Python3 checker) +# W0237 arguments-renamed +# W4904 deprecated-class +# W4905 deprecated-decorator +# E0012 pylint for python3 does not support inline deprecation +# E1101 no-member +# E1111 assignment-from-no-return +# E1120 no-value-for-parameter +# E1121 too-many-function-args +disable=C, R, W0120, W0125, W0212, W0221, W0223, W0231, W0235, + W0401, W0404, W0511, W0602, W0603, W0612, W0613, W0621, W0622, W0703, W1401, + W0107, W0706, W0707, W1310, W1406, W1505, W1514, W1618, W0237, W4904, W4905, + E0012, E1101, E1111, E1120, E1121 [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs diff --git a/nfv/test-requirements.txt b/nfv/test-requirements.txt index 06cc8f76..63a0c9e9 100644 --- a/nfv/test-requirements.txt +++ b/nfv/test-requirements.txt @@ -2,12 +2,9 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. hacking>=1.1.0,<=2.0.0 # Apache-2.0 -astroid<2.0;python_version<"3.0" # GPLv2 -astroid<= 2.2.5;python_version>="3.0" # GPLv2 -bandit<1.6.0;python_version>="3.0" +bandit<1.6.0 coverage>=3.6 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD -pylint<2.1.0;python_version<"3.0" # GPLv2 -pylint<2.4.0;python_version>="3.0" # GPLv2 +pylint testtools>=2.2.0 # MIT diff --git a/nfv/tox.ini b/nfv/tox.ini index b8b1809b..ad1e1fe7 100644 --- a/nfv/tox.ini +++ b/nfv/tox.ini @@ -1,5 +1,5 @@ # -# Copyright (c) 2018 Wind River Systems, Inc. +# Copyright (c) 2018-2023 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -10,18 +10,18 @@ # and then run "tox" from this directory. [tox] toxworkdir = /tmp/{env:USER}_nfvtox -envlist = pep8,py27,py36,py39,pylint +envlist = pep8,py39,pylint skipsdist = True stxdir = {toxinidir}/../.. [testenv] +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt install_command = pip install \ - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \ + -c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ {opts} {packages} allowlist_externals = cp -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt [nfv] nfv_base_dir = . @@ -91,7 +91,6 @@ enable-extensions = H106,H203 max-line-length = 185 [testenv:pep8] -basepython = python3 usedevelop = False skip_install = True deps = -r{toxinidir}/test-requirements.txt @@ -100,7 +99,6 @@ commands = [testenv:pylint] -basepython = python3 deps = {[nfv]deps} -r{toxinidir}/test-requirements.txt {[nfv]nfv_test_dir}/nfv_scenario_tests @@ -126,40 +124,9 @@ exclude = ./nfv-docs,./nfv-tests,./nfv-debug-tools,unit_test [testenv:bandit] deps = {[nfv]deps} -r{toxinidir}/test-requirements.txt -basepython = python3 commands = bandit --ini tox.ini -f txt -r {[nfv]nfv_base_dir} -[testenv:py27] -basepython = python2.7 -deps = {[nfv]deps} - coverage - fixtures - mock - stestr - testtools -setenv = PYTHONDONTWRITEBYTECODE=True -commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_db_stx_19.12 {envdir}/ - stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}' - stestr slowest - -[testenv:py36] -basepython = python3.6 -deps = {[nfv]deps} - coverage - fixtures - mock - stestr - testtools -setenv = PYTHONDONTWRITEBYTECODE=True -commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_db_stx_19.12 {envdir}/ - stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}' - stestr slowest - [testenv:py39] -basepython = python3.9 -install_command = pip install \ - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ - {opts} {packages} deps = {[nfv]deps} coverage fixtures @@ -173,7 +140,6 @@ commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_ [testenv:cover] -basepython = python3 deps = {[nfv]deps} coverage fixtures diff --git a/nova-api-proxy/pylint.rc b/nova-api-proxy/pylint.rc index 81243a47..92a15234 100755 --- a/nova-api-proxy/pylint.rc +++ b/nova-api-proxy/pylint.rc @@ -106,17 +106,23 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # can either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). -# E1101 no-member -# E1121: Too many positional arguments for function call # W0404 reimported # W0601 Global variable %r undefined at the module level +# W0602 global-variable-not-assigned # W0603 Using the global statement warning # W0613 Unused argument warning # W0621 Redefining name %r from outer scope # W0703 broad except warning -# Disable Python3 checkers: -# W1618: no-absolute-import -disable=C, R, E1101, E1121, W0404, W0601, W0603, W0613, W0621, W0703, W1618 +# W0707 raise-missing-from +# W1310 format-string-without-interpolation +# W1514 unspecified-encoding +# W1618: no-absolute-import (py3 enable from above) +# E1101 no-member +# E1121: Too many positional arguments for function call +# E1128 assignment-from-none +disable=C, R, + W0404, W0601, W0602, W0603, W0613, W0621, W0703, W0707, W1310, W1514, W1618, + E1101, E1121, E1128, [REPORTS] diff --git a/nova-api-proxy/test-requirements.txt b/nova-api-proxy/test-requirements.txt index 2e3f81d3..a254a8c0 100644 --- a/nova-api-proxy/test-requirements.txt +++ b/nova-api-proxy/test-requirements.txt @@ -2,11 +2,8 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. hacking>=1.1.0,<=2.0.0 # Apache-2.0 -astroid<2.0;python_version<"3.0" # GPLv2 -astroid<= 2.2.5;python_version>="3.0" # GPLv2 bandit<1.6.0;python_version>="3.0" coverage>=3.6 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD -pylint<2.1.0;python_version<"3.0" # GPLv2 -pylint<2.4.0;python_version>="3.0" # GPLv2 +pylint diff --git a/nova-api-proxy/tox.ini b/nova-api-proxy/tox.ini index ace4d3b7..1b3abf06 100644 --- a/nova-api-proxy/tox.ini +++ b/nova-api-proxy/tox.ini @@ -1,13 +1,13 @@ [tox] envlist = pep8,pylint -minversion = 2.3 +minversion = 2.9 skipsdist = True [testenv] basepython = python3 sitepackages = False install_command = pip install \ - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \ + -c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ {opts} {packages} setenv = VIRTUAL_ENV={envdir} OS_STDOUT_CAPTURE=1 @@ -43,7 +43,6 @@ commands = flake8 [testenv:pylint] -basepython = python2.7 deps= -r{toxinidir}/test-requirements.txt eventlet diff --git a/tox.ini b/tox.ini index 88e4fda3..59a1900f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,47 +1,49 @@ [tox] envlist = linters -minversion = 2.3 +minversion = 2.9 skipsdist = True [testenv] +allowlist_externals = find +basepython = python3 +commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete +deps = -r{toxinidir}/test-requirements.txt +install_command = pip install -U \ + -c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ + {opts} {packages} setenv = VIRTUAL_ENV={envdir} OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 PYTHONDONTWRITEBYTECODE=True -install_command = pip install -U {opts} {packages} -commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete -deps = -r{toxinidir}/test-requirements.txt -allowlist_externals = find [testenv:venv] -basepython = python3 commands = {posargs} [testenv:flake8] -basepython = python3 description = Dummy environment to allow flake8 to be run in subdir tox [testenv:pep8] -basepython = python3 description = Dummy environment to allow pep8 to be run in subdir tox [testenv:pylint] -basepython = python2.7 description = Dummy environment to allow pylint to be run in subdir tox -[testenv:linters] -basepython = python3 +[testenv:yamllint] allowlist_externals = bash commands = - bash -c "find {toxinidir} \ - \( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \ - -o \( -name .tox -prune \) \ - -o -type f -name '*.yaml' \ - -print0 | xargs -0 yamllint" + bash -c "find {toxinidir} \ + -name .tox -prune \ + -o -type f -name '*.yaml' \ + -print0 | xargs -0 yamllint -f parsable \ + -c {toxinidir}/.yamllint" + +[testenv:linters] +allowlist_externals = bash +commands = + {[testenv:yamllint]commands} [testenv:docs] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build @@ -49,7 +51,6 @@ commands = allowlist_externals = rm [testenv:releasenotes] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build @@ -59,22 +60,15 @@ allowlist_externals = reno [testenv:newnote] -basepython = python3 # Re-use the releasenotes venv envdir = {toxworkdir}/releasenotes deps = -r{toxinidir}/doc/requirements.txt commands = reno new {posargs} [testenv:api-ref] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html allowlist_externals = rm - -[testenv:functional] -basepython = python3 -allowlist_externals = cat -commands = cat /etc/fm/fm.conf