From 62b439bbf6b1565595771e784b9bda8ed597b066 Mon Sep 17 00:00:00 2001 From: Florian Strzelecki Date: Sat, 12 Aug 2023 14:53:30 +0200 Subject: [PATCH 1/2] ci, make: "lint" (flake8 & mypy) replace "quality" I know I did that, so I'm owning my mistake, and rename "make quality" by "make lint". A linter is something that checks your code for errors, and both flake8 and mypy are linters. There are now 2 new make commands: * make lint-style: perform any code style check (today: flake8 only), it could be used for a pylint check for example, or isort, or rst check, or anything that could help us with code style in the future * make lint-type: perform any type check (today: mypy only) The command `quality` is replaced by the command `lint`, which runs both `lint-style` and `lint-type`. Type check is now mandatory in CI, and the PR template has been updated accordingly. --- .github/pull_request_template.md | 4 +++- .github/workflows/ci.yml | 4 ++-- Makefile | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f654a52a0b..ea9ddd742f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,8 +1,10 @@ ### Description + What does this do? What problem does it solve? Does it resolve any GitHub issues? ### Checklist + - [ ] I have read [CONTRIBUTING.md](https://github.com/sopel-irc/sopel/blob/master/CONTRIBUTING.md) - [ ] I can and do license this contribution under the EFLv2 -- [ ] No issues are reported by `make qa` (runs `make quality` and `make test`) +- [ ] No issues are reported by `make qa` (runs `make lint` and `make test`) - [ ] I have tested the functionality of the things this change touches diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4add455028..b966060095 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,8 +36,8 @@ jobs: python -m pip install --upgrade wheel python -m pip install --upgrade -r dev-requirements.txt python -m pip install -e . - - name: Check code style - run: make quality + - name: Run linters (code style and type check) + run: make lint - name: Run pytest run: make test_norecord - name: Upload coverage data to coveralls.io diff --git a/Makefile b/Makefile index e1b739bdb0..a94641616c 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ .PHONY: qa -qa: quality test coverages +qa: lint test coverages -.PHONY: quality mypy -quality: +.PHONY: lint lint-style lint-type +lint: lint-style lint-type + +lint-style: flake8 -mypy: +lint-type: mypy --check-untyped-defs sopel .PHONY: test test_norecord test_novcr vcr_rerecord From 6fa76f3c83a412c8241fbc7a97ec3d4047df3057 Mon Sep 17 00:00:00 2001 From: James Gerity Date: Sat, 12 Aug 2023 15:27:00 -0400 Subject: [PATCH 2/2] contrib: update tox config to reflect `quality` action -> `lint` --- contrib/tox.ini | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/tox.ini b/contrib/tox.ini index 393de02798..391d8b1158 100644 --- a/contrib/tox.ini +++ b/contrib/tox.ini @@ -6,8 +6,7 @@ envlist = skip_missing_interpreters = true ignore_base_python_conflict = true labels = - mypy = py{37,38,39,310,311}-mypy - quality = py{37,38,39,310,311}-quality + lint = py{37,38,39,310,311}-lint test = py{37,38,39,310,311}-test @@ -39,8 +38,7 @@ setenv = commands = qa: make -C.. qa - mypy: make -C.. mypy - quality: make -C.. quality + lint: make -C.. lint test: make -C.. test # NOTE:there's currently no way to specify separate output directories for # the HTML coverage report, but the CLI report is probably fine anyway