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.pull/9058/head
parent
b530eaa262
commit
23a59d24ae
|
@ -15,6 +15,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
|
||||
from synapse.storage.engines import create_engine
|
||||
|
||||
logger = logging.getLogger("create_postgres_db")
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Configure the linters to run on a consistent set of files.
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
20
tox.ini
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue