Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8ec22b4

Browse files
author
David Robertson
committed
CI: Use common linting workflow
- We don't recommend tox in `code_style.md` - After #12107 it's much easier for black, isort and flake8 to find the scripts we want them to lint; we don't need to maintain `lint_targets` in the tox config. See also #12420.
1 parent 961ee75 commit 8ec22b4

File tree

2 files changed

+8
-43
lines changed

2 files changed

+8
-43
lines changed

.github/workflows/tests.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,13 @@ jobs:
2020
- run: scripts-dev/config-lint.sh
2121

2222
lint:
23-
runs-on: ubuntu-latest
24-
strategy:
25-
matrix:
26-
toxenv:
27-
- "check_codestyle"
28-
- "check_isort"
29-
- "mypy"
30-
31-
steps:
32-
- uses: actions/checkout@v2
33-
- uses: actions/setup-python@v2
34-
- run: pip install tox
35-
- run: tox -e ${{ matrix.toxenv }}
23+
# This does a vanilla `poetry install` - no extras. I'm slightly anxious
24+
# that we might skip some typechecks on code that uses extras. However,
25+
# I think the right way to fix this is to mark any extras needed for
26+
# typechecking as development dependencies. To detect this, we ought to
27+
# turn up mypy's strictness: disallow unknown imports and be accept fewer
28+
# uses of `Any`.
29+
uses: "matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@v1"
3630

3731
lint-crlf:
3832
runs-on: ubuntu-latest

tox.ini

+1-30
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py37, py38, py39, py310, check_codestyle, check_isort
2+
envlist = py37, py38, py39, py310
33

44
# we require tox>=2.3.2 for the fix to https://github.com/tox-dev/tox/issues/208
55
minversion = 2.3.2
@@ -32,20 +32,6 @@ deps =
3232
# install the "enum34" dependency of cryptography.
3333
pip>=10
3434

35-
# directories/files we run the linters on.
36-
# TODO: this is now out of date; we will remove as part of poetry migration.
37-
lint_targets =
38-
setup.py
39-
synapse
40-
tests
41-
# annoyingly, black doesn't find these so we have to list them
42-
scripts-dev
43-
stubs
44-
contrib
45-
synmark
46-
.ci
47-
docker
48-
4935
# default settings for all tox environments
5036
[testenv]
5137
deps =
@@ -138,18 +124,3 @@ setenv =
138124
commands =
139125
python -m synmark {posargs:}
140126

141-
[testenv:check_codestyle]
142-
extras = lint
143-
commands =
144-
python -m black --check --diff {[base]lint_targets}
145-
flake8 {[base]lint_targets} {env:PEP8SUFFIX:}
146-
147-
[testenv:check_isort]
148-
extras = lint
149-
commands = isort -c --df {[base]lint_targets}
150-
151-
[testenv:mypy]
152-
deps =
153-
{[base]deps}
154-
extras = all,mypy
155-
commands = mypy

0 commit comments

Comments
 (0)