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

Commit ad6da64

Browse files
author
David Robertson
committed
Stop maintaining a list of lint targets
instead, configure the tools to find sensible targets. Pulled out from #12337; part (but not all) of e53e99e. Related: #12107.
1 parent 95a038c commit ad6da64

File tree

4 files changed

+9
-31
lines changed

4 files changed

+9
-31
lines changed

docs/code_style.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pip install -e ".[lint,mypy]"
2424
functionality) with:
2525

2626
```sh
27-
black . --exclude="\.tox|build|env"
27+
black .
2828
```
2929

3030
- **flake8**
@@ -35,7 +35,7 @@ pip install -e ".[lint,mypy]"
3535
Check all application and test code with:
3636

3737
```sh
38-
flake8 synapse tests
38+
flake8 .
3939
```
4040

4141
- **isort**
@@ -46,11 +46,9 @@ pip install -e ".[lint,mypy]"
4646
Auto-fix imports with:
4747

4848
```sh
49-
isort -rc synapse tests
49+
isort .
5050
```
5151

52-
`-rc` means to recursively search the given directories.
53-
5452
It's worth noting that modern IDEs and text editors can run these tools
5553
automatically on save. It may be worth looking into whether this
5654
functionality is supported in your editor for a more convenient

pyproject.toml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,9 @@
3636

3737
[tool.black]
3838
target-version = ['py37', 'py38', 'py39', 'py310']
39-
exclude = '''
40-
41-
(
42-
/(
43-
\.eggs # exclude a few common directories in the
44-
| \.git # root of the project
45-
| \.tox
46-
| \.venv
47-
| \.env
48-
| env
49-
| _build
50-
| _trial_temp.*
51-
| build
52-
| dist
53-
| debian
54-
)/
55-
)
56-
'''
39+
# black ignores everything in .gitignore by default, see
40+
# https://black.readthedocs.io/en/stable/usage_and_configuration/file_collection_and_discovery.html#gitignore
41+
# Use `extend-exclude` if you want to exclude something in addition to this.
5742

5843
[tool.isort]
5944
line_length = 88
@@ -65,6 +50,7 @@ known_twisted = ["twisted", "OpenSSL"]
6550
multi_line_output = 3
6651
include_trailing_comma = true
6752
combine_as_imports = true
53+
skip_gitignore = true
6854

6955
[tool.poetry]
7056
name = "matrix-synapse"

scripts-dev/lint.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,7 @@ else
8080
# then lint everything!
8181
if [[ -z ${files+x} ]]; then
8282
# Lint all source code files and directories
83-
# Note: this list aims to mirror the one in tox.ini
84-
files=(
85-
"synapse" "docker" "tests"
86-
# annoyingly, black doesn't find these so we have to list them
87-
"scripts-dev"
88-
"contrib" "setup.py" "synmark" "stubs" ".ci"
89-
)
83+
files=( "." )
9084
fi
9185
fi
9286

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ deps =
3333
pip>=10
3434

3535
# directories/files we run the linters on.
36-
# if you update this list, make sure to do the same in scripts-dev/lint.sh
36+
# TODO: this is now out of date; we will remove as part of poetry migration.
3737
lint_targets =
3838
setup.py
3939
synapse

0 commit comments

Comments
 (0)