Stop maintaining a list of lint targets in lint.sh (#12420)

This commit is contained in:
David Robertson 2022-04-08 14:36:09 +01:00 committed by GitHub
parent 95a038c106
commit dd5cc37aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 31 deletions

1
changelog.d/12420.misc Normal file
View File

@ -0,0 +1 @@
Stop maintaining a list of lint targets.

View File

@ -24,7 +24,7 @@ pip install -e ".[lint,mypy]"
functionality) with: functionality) with:
```sh ```sh
black . --exclude="\.tox|build|env" black .
``` ```
- **flake8** - **flake8**
@ -35,7 +35,7 @@ pip install -e ".[lint,mypy]"
Check all application and test code with: Check all application and test code with:
```sh ```sh
flake8 synapse tests flake8 .
``` ```
- **isort** - **isort**
@ -46,11 +46,9 @@ pip install -e ".[lint,mypy]"
Auto-fix imports with: Auto-fix imports with:
```sh ```sh
isort -rc synapse tests isort .
``` ```
`-rc` means to recursively search the given directories.
It's worth noting that modern IDEs and text editors can run these tools It's worth noting that modern IDEs and text editors can run these tools
automatically on save. It may be worth looking into whether this automatically on save. It may be worth looking into whether this
functionality is supported in your editor for a more convenient functionality is supported in your editor for a more convenient

View File

@ -36,24 +36,9 @@
[tool.black] [tool.black]
target-version = ['py37', 'py38', 'py39', 'py310'] target-version = ['py37', 'py38', 'py39', 'py310']
exclude = ''' # black ignores everything in .gitignore by default, see
# https://black.readthedocs.io/en/stable/usage_and_configuration/file_collection_and_discovery.html#gitignore
( # Use `extend-exclude` if you want to exclude something in addition to this.
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.tox
| \.venv
| \.env
| env
| _build
| _trial_temp.*
| build
| dist
| debian
)/
)
'''
[tool.isort] [tool.isort]
line_length = 88 line_length = 88
@ -65,6 +50,7 @@ known_twisted = ["twisted", "OpenSSL"]
multi_line_output = 3 multi_line_output = 3
include_trailing_comma = true include_trailing_comma = true
combine_as_imports = true combine_as_imports = true
skip_gitignore = true
[tool.poetry] [tool.poetry]
name = "matrix-synapse" name = "matrix-synapse"

View File

@ -80,13 +80,7 @@ else
# then lint everything! # then lint everything!
if [[ -z ${files+x} ]]; then if [[ -z ${files+x} ]]; then
# Lint all source code files and directories # Lint all source code files and directories
# Note: this list aims to mirror the one in tox.ini files=( "." )
files=(
"synapse" "docker" "tests"
# annoyingly, black doesn't find these so we have to list them
"scripts-dev"
"contrib" "setup.py" "synmark" "stubs" ".ci"
)
fi fi
fi fi

View File

@ -33,7 +33,7 @@ deps =
pip>=10 pip>=10
# directories/files we run the linters on. # directories/files we run the linters on.
# if you update this list, make sure to do the same in scripts-dev/lint.sh # TODO: this is now out of date; we will remove as part of poetry migration.
lint_targets = lint_targets =
setup.py setup.py
synapse synapse