diff --git a/build_tools/travis/flake8_diff.sh b/build_tools/travis/flake8_diff.sh index 84495b339a922..9781f7e6a5cc0 100755 --- a/build_tools/travis/flake8_diff.sh +++ b/build_tools/travis/flake8_diff.sh @@ -137,12 +137,9 @@ check_files() { if [[ "$MODIFIED_FILES" == "no_match" ]]; then echo "No file outside sklearn/externals and doc/sphinxext/sphinx_gallery has been modified" else - # Default ignore PEP8 violations are from flake8 3.3.0 - DEFAULT_IGNORED_PEP8=E121,E123,E126,E226,E24,E704,W503,W504 - check_files "$(echo "$MODIFIED_FILES" | grep -v ^examples)" \ - --ignore $DEFAULT_IGNORED_PEP8 - # Examples are allowed to not have imports at top of file + + check_files "$(echo "$MODIFIED_FILES" | grep -v ^examples)" check_files "$(echo "$MODIFIED_FILES" | grep ^examples)" \ - --ignore $DEFAULT_IGNORED_PEP8 --ignore E402 + --config ./examples/.flake8 fi echo -e "No problem detected by flake8\n" diff --git a/examples/.flake8 b/examples/.flake8 new file mode 100644 index 0000000000000..703bf15e79bff --- /dev/null +++ b/examples/.flake8 @@ -0,0 +1,5 @@ +# Examples specific flake8 configuration + +[flake8] +# Same ignore as project-wide plus E402 (imports not at top of file) +ignore=E121,E123,E126,E24,E226,E704,W503,W504,E402 diff --git a/setup.cfg b/setup.cfg index 378905311e17e..02b3015e87f2e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,6 +38,10 @@ artifact_indexes= # https://ci.appveyor.com/project/sklearn-ci/scikit-learn/ http://windows-wheels.scikit-learn.org/ +[flake8] +# Default flake8 3.5 ignored flags +ignore=E121,E123,E126,E226,E24,E704,W503,W504 + # Uncomment the following under windows to build using: # http://sourceforge.net/projects/mingw/