mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
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:
parent
b530eaa262
commit
23a59d24ae
@ -15,6 +15,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from synapse.storage.engines import create_engine
|
from synapse.storage.engines import create_engine
|
||||||
|
|
||||||
logger = logging.getLogger("create_postgres_db")
|
logger = logging.getLogger("create_postgres_db")
|
||||||
|
1
changelog.d/9038.misc
Normal file
1
changelog.d/9038.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Configure the linters to run on a consistent set of files.
|
@ -15,16 +15,7 @@
|
|||||||
|
|
||||||
# Stub for frozendict.
|
# Stub for frozendict.
|
||||||
|
|
||||||
from typing import (
|
from typing import Any, Hashable, Iterable, Iterator, Mapping, Tuple, TypeVar, overload
|
||||||
Any,
|
|
||||||
Hashable,
|
|
||||||
Iterable,
|
|
||||||
Iterator,
|
|
||||||
Mapping,
|
|
||||||
overload,
|
|
||||||
Tuple,
|
|
||||||
TypeVar,
|
|
||||||
)
|
|
||||||
|
|
||||||
_KT = TypeVar("_KT", bound=Hashable) # Key type.
|
_KT = TypeVar("_KT", bound=Hashable) # Key type.
|
||||||
_VT = TypeVar("_VT") # Value type.
|
_VT = TypeVar("_VT") # Value type.
|
||||||
|
@ -7,17 +7,17 @@ from typing import (
|
|||||||
Callable,
|
Callable,
|
||||||
Dict,
|
Dict,
|
||||||
Hashable,
|
Hashable,
|
||||||
Iterator,
|
|
||||||
Iterable,
|
|
||||||
ItemsView,
|
ItemsView,
|
||||||
|
Iterable,
|
||||||
|
Iterator,
|
||||||
KeysView,
|
KeysView,
|
||||||
List,
|
List,
|
||||||
Mapping,
|
Mapping,
|
||||||
Optional,
|
Optional,
|
||||||
Sequence,
|
Sequence,
|
||||||
|
Tuple,
|
||||||
Type,
|
Type,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
Tuple,
|
|
||||||
Union,
|
Union,
|
||||||
ValuesView,
|
ValuesView,
|
||||||
overload,
|
overload,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"""Contains *incomplete* type hints for txredisapi.
|
"""Contains *incomplete* type hints for txredisapi.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import List, Optional, Union, Type
|
from typing import List, Optional, Type, Union
|
||||||
|
|
||||||
class RedisProtocol:
|
class RedisProtocol:
|
||||||
def publish(self, channel: str, message: bytes): ...
|
def publish(self, channel: str, message: bytes): ...
|
||||||
|
20
tox.ini
20
tox.ini
@ -24,6 +24,20 @@ deps =
|
|||||||
# install the "enum34" dependency of cryptography.
|
# install the "enum34" dependency of cryptography.
|
||||||
pip>=10
|
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
|
# default settings for all tox environments
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
@ -130,13 +144,13 @@ commands =
|
|||||||
[testenv:check_codestyle]
|
[testenv:check_codestyle]
|
||||||
extras = lint
|
extras = lint
|
||||||
commands =
|
commands =
|
||||||
python -m black --check --diff .
|
python -m black --check --diff {[base]lint_targets}
|
||||||
/bin/sh -c "flake8 synapse tests scripts scripts-dev contrib synctl {env:PEP8SUFFIX:}"
|
flake8 {[base]lint_targets} {env:PEP8SUFFIX:}
|
||||||
{toxinidir}/scripts-dev/config-lint.sh
|
{toxinidir}/scripts-dev/config-lint.sh
|
||||||
|
|
||||||
[testenv:check_isort]
|
[testenv:check_isort]
|
||||||
extras = lint
|
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]
|
[testenv:check-newsfragment]
|
||||||
skip_install = True
|
skip_install = True
|
||||||
|
Loading…
Reference in New Issue
Block a user