From 78de6199cef83073421f4d3d59daf39b698c7dd2 Mon Sep 17 00:00:00 2001 From: nico Date: Fri, 26 Jun 2020 19:08:22 +0200 Subject: initial ci runner config * have mercy on my soul --- .gitlab-ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .gitlab-ci.yml (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3c9fb21 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,16 @@ +image: "python:3.7" + +# setup environemnt +before_script: + - python --version + - pip install -r requirements.txt + - pip install flake8 + +stages: + - Static Analysis + +flake8: + stage: Static Analysis + script: + - flake8 --count --select=E9,F63,F7,F82 --show-source --statistics + - flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics -- cgit v1.2.3-54-g00ecf From 2f730bf186da8a52b0b13040bd83949ee1366cfe Mon Sep 17 00:00:00 2001 From: nico Date: Fri, 26 Jun 2020 23:05:21 +0200 Subject: flake8 gitlab ajustments * ajust ci config for gitlabs ci * reduced max line length to 120 It seems gitlab prefers it that way + add some comments --- .gitlab-ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c9fb21..63ed231 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,10 +7,12 @@ before_script: - pip install flake8 stages: - - Static Analysis + - check flake8: - stage: Static Analysis + stage: check script: - - flake8 --count --select=E9,F63,F7,F82 --show-source --statistics - - flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + # breaking errors and syntax errors + - flake8 --select=E9,F63,F7,F82 --show-source + # pep8 warnings + - flake8 --max-complexity=10 --max-line-length=120 --show-source -- cgit v1.2.3-54-g00ecf From e503508b5b1b14dd61a1426b798837f873ba772e Mon Sep 17 00:00:00 2001 From: nico Date: Fri, 26 Jun 2020 23:31:15 +0200 Subject: split up flake jobs * split flake8 jobs into two seperate jobs to better control the result + add allow_failure: true to the pep8 job to not discourage anybody from commiting code --- .gitlab-ci.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 63ed231..5189dd4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,12 +7,18 @@ before_script: - pip install flake8 stages: - - check + - syntax + - pep8 -flake8: - stage: check +syntax: + stage: syntax script: - # breaking errors and syntax errors + # breaking errors ie syntax errors - flake8 --select=E9,F63,F7,F82 --show-source - # pep8 warnings + +pep8: + stage: pep8 + script: + # pep8 warnings - flake8 --max-complexity=10 --max-line-length=120 --show-source + allow_failure: true -- cgit v1.2.3-54-g00ecf From 453d054ebbab62080c1483d6d160e251f4841155 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 27 Jun 2020 00:33:10 +0200 Subject: gitlab ci caching + add pip caching + add venv caching --- .gitlab-ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5189dd4..f99e762 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,23 @@ image: "python:3.7" +variables: + # force pip cache dir + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +cache: + paths: + # utilize pip caching + - .cache/pip + # cache the virtualenv to reduce load + - venv/ + # setup environemnt before_script: - python --version + - pip install virtualenv + - virtualenv venv + - source venv/bin/activate - pip install -r requirements.txt - - pip install flake8 stages: - syntax @@ -12,6 +25,8 @@ stages: syntax: stage: syntax + before_script: + - pip install flake8 script: # breaking errors ie syntax errors - flake8 --select=E9,F63,F7,F82 --show-source -- cgit v1.2.3-54-g00ecf From 565702d91f67b0b94c327574aa89564a40b95a37 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 27 Jun 2020 00:40:18 +0200 Subject: gitlab ci syntax * multiple before_script segments overwrite one another --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f99e762..87a0c5a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ cache: paths: # utilize pip caching - .cache/pip - # cache the virtualenv to reduce load + # cache the virtual environment - venv/ # setup environemnt @@ -18,6 +18,7 @@ before_script: - virtualenv venv - source venv/bin/activate - pip install -r requirements.txt + - pip install flake8 stages: - syntax @@ -25,8 +26,6 @@ stages: syntax: stage: syntax - before_script: - - pip install flake8 script: # breaking errors ie syntax errors - flake8 --select=E9,F63,F7,F82 --show-source -- cgit v1.2.3-54-g00ecf From fa87c166ed68fac05970ae60eda532d6ba5a851a Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 27 Jun 2020 00:56:38 +0200 Subject: finalizing the ci pipelines - revert 565702d9 as it did not behave like it should have + add black pipeline for code consistency --- .gitlab-ci.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 87a0c5a..c39fb0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,22 +6,17 @@ variables: cache: paths: - # utilize pip caching - - .cache/pip - # cache the virtual environment - - venv/ + - .cache/pip # pip caching directory # setup environemnt before_script: - python --version - - pip install virtualenv - - virtualenv venv - - source venv/bin/activate - pip install -r requirements.txt - - pip install flake8 + - pip install flake8 black stages: - syntax + - black - pep8 syntax: @@ -30,9 +25,15 @@ syntax: # breaking errors ie syntax errors - flake8 --select=E9,F63,F7,F82 --show-source +black: + stage: black + script: + # code consistency + - black . --check --line-length 120 + pep8: stage: pep8 script: - # pep8 warnings + # pep8 warnings and other non breaking warnings - flake8 --max-complexity=10 --max-line-length=120 --show-source allow_failure: true -- cgit v1.2.3-54-g00ecf From 8b26b1eb8e5cd8d69e600a4c4eec9bea28ef8059 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 27 Jun 2020 12:07:09 +0200 Subject: tool configuration * seperate tool config and tool call * rename black stage to code consistency for a greater readability - remove allow_failure from the third stage I did decide to remove the allowed failure tag to encourage a higher code quality. --- .gitlab-ci.yml | 17 ++++++++--------- pyproject.toml | 20 ++++++++++++++++++++ setup.cfg | 5 +++++ 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c39fb0b..5f1e754 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,24 +16,23 @@ before_script: stages: - syntax - - black - - pep8 + - code consistency + - flake8 syntax: stage: syntax script: - # breaking errors ie syntax errors + # flake8 check only breaking errors ie syntax errors - flake8 --select=E9,F63,F7,F82 --show-source black: - stage: black + stage: code consistency script: # code consistency - - black . --check --line-length 120 + - black . --check pep8: - stage: pep8 + stage: flake8 script: - # pep8 warnings and other non breaking warnings - - flake8 --max-complexity=10 --max-line-length=120 --show-source - allow_failure: true + # full flake8 test + - flake8 --show-source diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e834e5c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[tool.black] +line-length = 120 +target-version = ['py37', 'py38'] +include = '\.pyi?$' +exclude = ''' +( + /( + \.eggs # exclude a few common directories in the + | \.git # root of the project + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + )/ # the root of the project +) +''' diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..6e6bed8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[flake8] +ignore = E501 +exclude = .git,__pycache__,.gitlab +max-complexity = 15 +max-line-length = 120 -- cgit v1.2.3-54-g00ecf