Run the linters on a consistent list of files (#9038)

We were running some linters on some files and some on others. Extract a common
setting and use it everywhere.
This commit is contained in:
Richard van der Hoff 2021-01-08 14:08:44 +00:00 committed by GitHub
parent b530eaa262
commit 23a59d24ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 17 deletions

View File

@ -15,6 +15,7 @@
# limitations under the License.
import logging
from synapse.storage.engines import create_engine
logger = logging.getLogger("create_postgres_db")

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

@ -0,0 +1 @@
Configure the linters to run on a consistent set of files.

View File

@ -15,16 +15,7 @@
# Stub for frozendict.
from typing import (
Any,
Hashable,
Iterable,
Iterator,
Mapping,
overload,
Tuple,
TypeVar,
)
from typing import Any, Hashable, Iterable, Iterator, Mapping, Tuple, TypeVar, overload
_KT = TypeVar("_KT", bound=Hashable) # Key type.
_VT = TypeVar("_VT") # Value type.

View File

@ -7,17 +7,17 @@ from typing import (
Callable,
Dict,
Hashable,
Iterator,
Iterable,
ItemsView,
Iterable,
Iterator,
KeysView,
List,
Mapping,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Tuple,
Union,
ValuesView,
overload,

View File

@ -16,7 +16,7 @@
"""Contains *incomplete* type hints for txredisapi.
"""
from typing import List, Optional, Union, Type
from typing import List, Optional, Type, Union
class RedisProtocol:
def publish(self, channel: str, message: bytes): ...

20
tox.ini
View File

@ -24,6 +24,20 @@ deps =
# install the "enum34" dependency of cryptography.
pip>=10
# directories/files we run the linters on
lint_targets =
setup.py
synapse
tests
scripts
scripts-dev
stubs
contrib
synctl
synmark
.buildkite
docker
# default settings for all tox environments
[testenv]
deps =
@ -130,13 +144,13 @@ commands =
[testenv:check_codestyle]
extras = lint
commands =
python -m black --check --diff .
/bin/sh -c "flake8 synapse tests scripts scripts-dev contrib synctl {env:PEP8SUFFIX:}"
python -m black --check --diff {[base]lint_targets}
flake8 {[base]lint_targets} {env:PEP8SUFFIX:}
{toxinidir}/scripts-dev/config-lint.sh
[testenv:check_isort]
extras = lint
commands = /bin/sh -c "isort -c --df --sp setup.cfg synapse tests scripts-dev scripts"
commands = isort -c --df --sp setup.cfg {[base]lint_targets}
[testenv:check-newsfragment]
skip_install = True