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

Commit

Permalink
CI: Use common linting workflow
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
David Robertson committed Apr 11, 2022
1 parent 961ee75 commit 8ec22b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 43 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@ jobs:
- run: scripts-dev/config-lint.sh

lint:
runs-on: ubuntu-latest
strategy:
matrix:
toxenv:
- "check_codestyle"
- "check_isort"
- "mypy"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install tox
- run: tox -e ${{ matrix.toxenv }}
# This does a vanilla `poetry install` - no extras. I'm slightly anxious
# that we might skip some typechecks on code that uses extras. However,
# I think the right way to fix this is to mark any extras needed for
# typechecking as development dependencies. To detect this, we ought to
# turn up mypy's strictness: disallow unknown imports and be accept fewer
# uses of `Any`.
uses: "matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@v1"

lint-crlf:
runs-on: ubuntu-latest
Expand Down
31 changes: 1 addition & 30 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37, py38, py39, py310, check_codestyle, check_isort
envlist = py37, py38, py39, py310

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

# directories/files we run the linters on.
# TODO: this is now out of date; we will remove as part of poetry migration.
lint_targets =
setup.py
synapse
tests
# annoyingly, black doesn't find these so we have to list them
scripts-dev
stubs
contrib
synmark
.ci
docker

# default settings for all tox environments
[testenv]
deps =
Expand Down Expand Up @@ -138,18 +124,3 @@ setenv =
commands =
python -m synmark {posargs:}

[testenv:check_codestyle]
extras = lint
commands =
python -m black --check --diff {[base]lint_targets}
flake8 {[base]lint_targets} {env:PEP8SUFFIX:}

[testenv:check_isort]
extras = lint
commands = isort -c --df {[base]lint_targets}

[testenv:mypy]
deps =
{[base]deps}
extras = all,mypy
commands = mypy

0 comments on commit 8ec22b4

Please sign in to comment.