From 343261e82e62bd2f16d5ac713b1a6f33a8d4f0f2 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 14 Feb 2020 06:34:29 +0100 Subject: [PATCH 01/12] Use flake8 to find syntax errors and undefined names These tests find the problems described in #1441 and #1442 --- jenkins-x-lint.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index 6c74f5509c..4c34afe55b 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -22,4 +22,13 @@ pipelineConfig: - setup_linter - run_linter_check command: make + - name: pip-install-flake8 + command: python3 + args: + - -m pip install flake8 + - name: python-lint-with-flake8 + command: flake8 + args: + - . --count --select=E9,F63,F7,F82 --show-source --statistics + From ae00123c24e4627139e5064c50741f407ba148b0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 17 Feb 2020 11:56:29 +0100 Subject: [PATCH 02/12] requirements-dev.txt: Add black and flake8 --- python/requirements-dev.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/requirements-dev.txt b/python/requirements-dev.txt index 0bce69c15b..3c547dd916 100644 --- a/python/requirements-dev.txt +++ b/python/requirements-dev.txt @@ -1,9 +1,11 @@ -r requirements.txt +black==19.10b0 +flake8==3.7.9 mypy<0.762 Pillow==7.0.0 -tox<4.0.0 pytest==5.3.1 pytest-cov==2.8.1 +tox<4.0.0 # 2nd lvl dep on cov required to avoid sqllite dep coverage==4.5.4 From a9fb8fde9338bdaeb217d357b86bb57d5e8c8d10 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 17 Feb 2020 12:02:12 +0100 Subject: [PATCH 03/12] setup.cfg: Create a flake8 section --- python/setup.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/setup.cfg b/python/setup.cfg index 4e54aab354..8bdbdf80b6 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -1,6 +1,12 @@ [aliases] test=pytest +[flake8] +count = True +select = E9,F63,F7,F82 +show-source = True +statistics = True + [tox:tox] envlist = py From bf15d99002c9e4b01281ba92934447401bf2431c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 17 Feb 2020 12:04:55 +0100 Subject: [PATCH 04/12] Update jenkins-x-lint.yml --- jenkins-x-lint.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index 4c34afe55b..ebdf69606c 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -22,13 +22,5 @@ pipelineConfig: - setup_linter - run_linter_check command: make - - name: pip-install-flake8 - command: python3 - args: - - -m pip install flake8 - name: python-lint-with-flake8 command: flake8 - args: - - . --count --select=E9,F63,F7,F82 --show-source --statistics - - From b9e48c5752cbd565912fe183ab1dc19b24638587 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 17 Feb 2020 13:28:18 +0100 Subject: [PATCH 05/12] pip install -r python/requirements-dev.txt --- jenkins-x-lint.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index ebdf69606c..133c6bda9f 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -14,12 +14,15 @@ pipelineConfig: sh: "./add-pr-build-comment" - name: lint-checks parallel: + - name: pip-install- + command: python3 + args: + - -m pip install -r python/requirements-dev.txt - name: python-lint-task steps: - name: python-lint args: - -C python - - setup_linter - run_linter_check command: make - name: python-lint-with-flake8 From fc070065d55d11f12502b0b8daad5bf7466c136e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 17 Feb 2020 14:35:18 +0100 Subject: [PATCH 06/12] parallel <--> steps --- jenkins-x-lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index 133c6bda9f..f94d4efea8 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -13,13 +13,13 @@ pipelineConfig: dir: ci sh: "./add-pr-build-comment" - name: lint-checks - parallel: + steps: - name: pip-install- command: python3 args: - -m pip install -r python/requirements-dev.txt - name: python-lint-task - steps: + parallel: - name: python-lint args: - -C python From fc993cad1dd5720f6a37739a3d3e2cc0f1b36afb Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 17 Feb 2020 14:50:16 +0000 Subject: [PATCH 07/12] Fix JX syntax --- jenkins-x-lint.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index f94d4efea8..2e9698350f 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -13,11 +13,11 @@ pipelineConfig: dir: ci sh: "./add-pr-build-comment" - name: lint-checks - steps: - - name: pip-install- - command: python3 - args: - - -m pip install -r python/requirements-dev.txt + stages: + - name: pip-install + command: python3 + args: + - -m pip install -r python/requirements-dev.txt - name: python-lint-task parallel: - name: python-lint From 47a4b2a3a8747035b8e9fd720125e88ffdc59574 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 17 Feb 2020 14:53:06 +0000 Subject: [PATCH 08/12] Flatten steps --- jenkins-x-lint.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index 2e9698350f..7c8fb5daf1 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -13,17 +13,15 @@ pipelineConfig: dir: ci sh: "./add-pr-build-comment" - name: lint-checks - stages: + steps: - name: pip-install command: python3 args: - -m pip install -r python/requirements-dev.txt - - name: python-lint-task - parallel: - - name: python-lint - args: - - -C python - - run_linter_check - command: make - - name: python-lint-with-flake8 - command: flake8 + - name: python-black + command: make + args: + - -C python + - run_linter_check + - name: python-lint + command: flake8 From b85e8ac333f0640077bafe91916f87f8404e4564 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 17 Feb 2020 14:59:19 +0000 Subject: [PATCH 09/12] Use python-builder base image --- jenkins-x-lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index 7c8fb5daf1..3e2bf4761c 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -13,6 +13,8 @@ pipelineConfig: dir: ci sh: "./add-pr-build-comment" - name: lint-checks + agent: + image: seldonio/python-builder:0.2 steps: - name: pip-install command: python3 From 85f235baddcef5a18536679101610b22a47d3c54 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 17 Feb 2020 15:14:28 +0000 Subject: [PATCH 10/12] Run everything as part of the same step --- jenkins-x-lint.yml | 17 ++++++----------- python/Makefile | 1 + 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index 3e2bf4761c..dc6b3e6b5f 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -13,17 +13,12 @@ pipelineConfig: dir: ci sh: "./add-pr-build-comment" - name: lint-checks - agent: - image: seldonio/python-builder:0.2 - steps: - - name: pip-install - command: python3 - args: - - -m pip install -r python/requirements-dev.txt - - name: python-black - command: make + parallel: + - name: lint-python + agent: + image: seldonio/python-builder:0.2 + command: make args: - -C python + - install_dev - run_linter_check - - name: python-lint - command: flake8 diff --git a/python/Makefile b/python/Makefile index 807994dc37..42ad69038b 100644 --- a/python/Makefile +++ b/python/Makefile @@ -104,6 +104,7 @@ run_linter_check: black \ --check ./ ../testing \ --exclude "(testing/scripts/proto|seldon_core/proto/|.eggs|.tox)" + flake8 .PHONY: clean clean: From e301ee85c73420a187db65bbca88fe16a86f0f74 Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 17 Feb 2020 15:16:40 +0000 Subject: [PATCH 11/12] Add intermediate steps --- jenkins-x-lint.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index dc6b3e6b5f..0b62365343 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -17,8 +17,10 @@ pipelineConfig: - name: lint-python agent: image: seldonio/python-builder:0.2 - command: make - args: - - -C python - - install_dev - - run_linter_check + steps: + - name: lint-python + command: make + args: + - -C python + - install_dev + - run_linter_check From b9c1a69a30077038ca79abc7e4e542110f73ed5b Mon Sep 17 00:00:00 2001 From: Adrian Gonzalez-Martin Date: Mon, 17 Feb 2020 15:17:24 +0000 Subject: [PATCH 12/12] Remove extra space --- jenkins-x-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins-x-lint.yml b/jenkins-x-lint.yml index 0b62365343..61583c3cca 100644 --- a/jenkins-x-lint.yml +++ b/jenkins-x-lint.yml @@ -19,7 +19,7 @@ pipelineConfig: image: seldonio/python-builder:0.2 steps: - name: lint-python - command: make + command: make args: - -C python - install_dev