Update code style checking.
- Exempt overlong URL lines from checks. - Omit some of the more painful PEP items.
This commit is contained in:
parent
7d74e209f3
commit
2aa4387eba
6 changed files with 39 additions and 15 deletions
|
@ -1,3 +0,0 @@
|
||||||
[style]
|
|
||||||
based_on_style = pep8
|
|
||||||
column_limit = 79
|
|
24
.travis.yml
24
.travis.yml
|
@ -15,23 +15,35 @@ before_install:
|
||||||
# Need this for the git tests to succeed.
|
# Need this for the git tests to succeed.
|
||||||
- git config --global user.email "spack@example.com"
|
- git config --global user.email "spack@example.com"
|
||||||
- git config --global user.name "Test User"
|
- git config --global user.name "Test User"
|
||||||
|
|
||||||
# Need this to be able to compute the list of changed files
|
# Need this to be able to compute the list of changed files
|
||||||
- git fetch origin develop:develop
|
- git fetch origin develop:develop
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
# Regular spack setup and tests
|
||||||
- . share/spack/setup-env.sh
|
- . share/spack/setup-env.sh
|
||||||
- spack compilers
|
- spack compilers
|
||||||
- spack config get compilers
|
- spack config get compilers
|
||||||
- spack install -v libdwarf
|
- spack install -v libdwarf
|
||||||
|
|
||||||
# Run unit tests with code coverage
|
# Run unit tests with code coverage
|
||||||
- coverage run bin/spack test
|
- 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:
|
after_success:
|
||||||
- coveralls
|
- coveralls
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[flake8]
|
|
||||||
ignore = W391,F403,E221
|
|
||||||
max-line-length = 79
|
|
|
@ -1,3 +0,0 @@
|
||||||
[flake8]
|
|
||||||
ignore = W391,F403,E221,F821
|
|
||||||
max-line-length = 79
|
|
10
share/spack/qa/flake8-framework
Normal file
10
share/spack/qa/flake8-framework
Normal file
|
@ -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
|
11
share/spack/qa/flake8-packages
Normal file
11
share/spack/qa/flake8-packages
Normal file
|
@ -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
|
Loading…
Reference in a new issue