diff options
-rw-r--r-- | .style.yapf | 3 | ||||
-rw-r--r-- | .travis.yml | 24 | ||||
-rw-r--r-- | flake8-framework.ini | 3 | ||||
-rw-r--r-- | flake8-packages.ini | 3 | ||||
-rw-r--r-- | share/spack/qa/flake8-framework | 10 | ||||
-rw-r--r-- | share/spack/qa/flake8-packages | 11 |
6 files changed, 39 insertions, 15 deletions
diff --git a/.style.yapf b/.style.yapf deleted file mode 100644 index a4b3f65252..0000000000 --- a/.style.yapf +++ /dev/null @@ -1,3 +0,0 @@ -[style] -based_on_style = pep8 -column_limit = 79 diff --git a/.travis.yml b/.travis.yml index c41692c08e..9acba991c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,23 +15,35 @@ before_install: # Need this for the git tests to succeed. - git config --global user.email "spack@example.com" - git config --global user.name "Test User" + # Need this to be able to compute the list of changed files - git fetch origin develop:develop script: + # Regular spack setup and tests - . share/spack/setup-env.sh - spack compilers - spack config get compilers - spack install -v libdwarf + # Run unit tests with code coverage - coverage run bin/spack test - # Checks if the file that have been changed are flake8 conformant [framework] - - CHANGED_PYTHON_FILES=`git diff develop... --name-only | perl -ne 'print if /\.py$/' | perl -ne 'print if not /var/' ` - - if [[ ${CHANGED_PYTHON_FILES} ]] ; then flake8 --format pylint --config flake8-framework.ini ${CHANGED_PYTHON_FILES} ; fi - # Checks if the file that have been changed are flake8 conformant [packages] - - CHANGED_PACKAGES=`git diff develop... --name-only | perl -ne 'print if /\.py$/' | perl -ne 'print if /var/' ` - - if [[ ${CHANGED_PACKAGES} ]] ; then flake8 --format pylint --config flake8-packages.ini ${CHANGED_PACKAGES} ; fi + # Check if changed files are flake8 conformant [framework] + - changed=$(git diff --name-only develop... | grep '.py$' | grep -v ^var/) + - [[ $changed ]] && \ + flake8 --format pylint --config share/spack/qa/flake8-framework $changed + + # Check if changed files are flake8 conformant [packages] + - changed=$(git diff --name-only develop... | grep '.py$' | grep ^var/) + + # Exempt url lines in changed packages from overlong errors. + - for file in $changed; do \ + [[ file = *package.py ]] && \ + perl -i~ -pe 's/^(\s*url\s*=.*)$/\1 # NOQA/' $file; \ + done + - [[ $changed ]] && \ + flake8 --format pylint --config share/spack/qa/flake8-packages $changed after_success: - coveralls diff --git a/flake8-framework.ini b/flake8-framework.ini deleted file mode 100644 index f8bff04355..0000000000 --- a/flake8-framework.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -ignore = W391,F403,E221 -max-line-length = 79 diff --git a/flake8-packages.ini b/flake8-packages.ini deleted file mode 100644 index 32ced73dd7..0000000000 --- a/flake8-packages.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -ignore = W391,F403,E221,F821 -max-line-length = 79 diff --git a/share/spack/qa/flake8-framework b/share/spack/qa/flake8-framework new file mode 100644 index 0000000000..b1ad00b80f --- /dev/null +++ b/share/spack/qa/flake8-framework @@ -0,0 +1,10 @@ +# -*- conf -*- +[flake8] +# Descriptions of ignored checks: +# +# E221: multiple spaces before operator +# E241: multiple spaces after ‘,’ +# F403: disable wildcard import +# +ignore = E221,E241,F403 +max-line-length = 79 diff --git a/share/spack/qa/flake8-packages b/share/spack/qa/flake8-packages new file mode 100644 index 0000000000..0e5be249fb --- /dev/null +++ b/share/spack/qa/flake8-packages @@ -0,0 +1,11 @@ +# -*- conf -*- +[flake8] +# Descriptions of ignored checks: +# +# E221: multiple spaces before operator +# E241: multiple spaces after ‘,’ +# F403: disable wildcard import +# F821: undefined name (needed for build commands) +# +ignore = E221,E241,F403,F821 +max-line-length = 79 |