From 0495331c345d700da4e20b29a739c32534ab0ff7 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Thu, 19 Oct 2017 11:46:18 +0200 Subject: [PATCH 1/7] Add linters to Travis: Python --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3bfcb3708..147b491ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,11 +14,17 @@ before_install: - pip install pip --upgrade - pip install git+https://github.com/timothyb89/dbuild.git - pip install google-cloud-storage + - pip install flake8 flake8-blind-except flake8-builtins flake8-pep3101 flake8-coding + - pip install pylint - docker --version - docker-compose --version jobs: include: + - stage: linting-flake8 + script: flake8 + - stage: linting-pylint + script: pylint - stage: metrics-pipeline script: python ci.py metrics - stage: logs-pipeline From 4ff8daf9e234f6f78525a859f75ed6e50e908606 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Mon, 30 Oct 2017 13:18:32 +0100 Subject: [PATCH 2/7] Add setup.cfg to configure linters --- .travis.yml | 2 +- setup.cfg | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 setup.cfg diff --git a/.travis.yml b/.travis.yml index 770c3b22a..c57d20b2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ jobs: - stage: linting-flake8 script: flake8 - stage: linting-pylint - script: pylint + script: pylint --rcfile=setup.cfg * - stage: lint-shellcheck script: bash -c 'shopt -s globstar; shellcheck **/*.sh' - stage: metrics-pipeline diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..e3f3c3367 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,20 @@ +[flake8] +# D203 1 blank line required before class docstring +# H201 no 'except:' at least use 'except Exception:' +# H302 import only modules +# H405 multi line docstring summary not separated with an empty line +ignore = D203,H201,H302,H405 +# H106: Don’t put vim configuration in source files +# H203: Use assertIs(Not)None to check for None +enable-extensions = H106,H203 +max-complexity = 50 +max-line-length = 120 +exclude =.env,.git,doc,*lib/python*,build,dist,*.egg +show-source = True +builtins = _ + +[pylint] +disable = C0103,C0111,F0010 +ignore = .env,.git,doc,*lib/python*,build,dist,*.egg +ignore-docstrings = yes +output-format = parseable From 10c960dbc7701a32bbbed96508c0ba2b4a66a9c0 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Tue, 31 Oct 2017 11:17:21 +0100 Subject: [PATCH 3/7] Add setup.cfg to configure linters --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index e3f3c3367..c2fe2f712 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,3 +18,4 @@ disable = C0103,C0111,F0010 ignore = .env,.git,doc,*lib/python*,build,dist,*.egg ignore-docstrings = yes output-format = parseable +max-line-length = 120 From 37bf898360c916d2469fe4013fb47163052052b9 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Fri, 3 Nov 2017 13:32:33 +0100 Subject: [PATCH 4/7] cleanup.py --- .travis.yml | 4 +--- setup.cfg | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c57d20b2d..309b73e9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_install: - pip install pip --upgrade - pip install git+https://github.com/timothyb89/dbuild.git - pip install google-cloud-storage - - pip install flake8 flake8-blind-except flake8-builtins flake8-pep3101 flake8-coding + - pip install flake8 flake8-blind-except flake8-builtins flake8-pep3101 flake8-coding hacking - pip install pylint - docker --version - docker-compose --version @@ -34,8 +34,6 @@ jobs: script: flake8 - stage: linting-pylint script: pylint --rcfile=setup.cfg * - - stage: lint-shellcheck - script: bash -c 'shopt -s globstar; shellcheck **/*.sh' - stage: metrics-pipeline script: python ci.py metrics - stage: logs-pipeline diff --git a/setup.cfg b/setup.cfg index c2fe2f712..910089737 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,6 +14,9 @@ show-source = True builtins = _ [pylint] +# C0103 Invalid %s name "%s" +# C0111 Missing %s docstring +# F0010 error while code parsing: %s disable = C0103,C0111,F0010 ignore = .env,.git,doc,*lib/python*,build,dist,*.egg ignore-docstrings = yes From 92e08d1d6130853361c0d3e9d13c1902b293c318 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Mon, 20 Nov 2017 15:23:43 +0100 Subject: [PATCH 5/7] Updated to get flake8 from pip3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 309b73e9e..6cf0f1fe1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_install: - pip install pip --upgrade - pip install git+https://github.com/timothyb89/dbuild.git - pip install google-cloud-storage - - pip install flake8 flake8-blind-except flake8-builtins flake8-pep3101 flake8-coding hacking + - pip3 install flake8 flake8-blind-except flake8-builtins flake8-pep3101 flake8-coding hacking - pip install pylint - docker --version - docker-compose --version From a9af36923957f9e102a2336330005ab886fd2c31 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Tue, 21 Nov 2017 09:32:40 +0100 Subject: [PATCH 6/7] reverted to pip for flake8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6cf0f1fe1..309b73e9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_install: - pip install pip --upgrade - pip install git+https://github.com/timothyb89/dbuild.git - pip install google-cloud-storage - - pip3 install flake8 flake8-blind-except flake8-builtins flake8-pep3101 flake8-coding hacking + - pip install flake8 flake8-blind-except flake8-builtins flake8-pep3101 flake8-coding hacking - pip install pylint - docker --version - docker-compose --version From 799a242138b9ccaea17289adc76186463a618600 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Tue, 21 Nov 2017 10:27:30 +0100 Subject: [PATCH 7/7] ignore python 3 syntax unrecognised for python 2 --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 910089737..a468110f6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,8 @@ # H201 no 'except:' at least use 'except Exception:' # H302 import only modules # H405 multi line docstring summary not separated with an empty line -ignore = D203,H201,H302,H405 +# E999 Invalid syntax (reported for python 3 syntax unrecognised in Python 2) +ignore = D203,H201,H302,H405,E999 # H106: Don’t put vim configuration in source files # H203: Use assertIs(Not)None to check for None enable-extensions = H106,H203