Re-enable some linting (#14821)

* Re-enable some linting

* Newsfile

* Remove comment
pull/14826/head
Erik Johnston 2023-01-12 10:52:07 +00:00 committed by GitHub
parent dd9e71dc7f
commit b50c008453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 21 deletions

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

@ -0,0 +1 @@
Re-enable some linting that was disabled when we switched to ruff.

View File

@ -48,11 +48,6 @@ line-length = 88
# E731: do not assign a lambda expression, use a def # E731: do not assign a lambda expression, use a def
# E501: Line too long (black enforces this for us) # E501: Line too long (black enforces this for us)
# #
# See https://github.com/charliermarsh/ruff/#pyflakes
# F401: unused import
# F811: Redefinition of unused
# F821: Undefined name
#
# flake8-bugbear compatible checks. Its error codes are described at # flake8-bugbear compatible checks. Its error codes are described at
# https://github.com/charliermarsh/ruff/#flake8-bugbear # https://github.com/charliermarsh/ruff/#flake8-bugbear
# B019: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks # B019: Use of functools.lru_cache or functools.cache on methods can lead to memory leaks
@ -64,9 +59,6 @@ ignore = [
"B024", "B024",
"E501", "E501",
"E731", "E731",
"F401",
"F811",
"F821",
] ]
select = [ select = [
# pycodestyle checks. # pycodestyle checks.

View File

@ -7,7 +7,6 @@ from __future__ import annotations
from typing import ( from typing import (
Any, Any,
Callable, Callable,
Generic,
Iterable, Iterable,
Iterator, Iterator,
List, List,

View File

@ -5,10 +5,8 @@
from __future__ import annotations from __future__ import annotations
from typing import ( from typing import (
AbstractSet,
Any, Any,
Callable, Callable,
Generic,
Hashable, Hashable,
Iterable, Iterable,
Iterator, Iterator,

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from typing import Any, Collection, Dict, Mapping, Optional, Sequence, Set, Tuple, Union from typing import Any, Collection, Dict, Mapping, Optional, Sequence, Tuple, Union
from synapse.types import JsonDict from synapse.types import JsonDict

View File

@ -1,5 +1,3 @@
from __future__ import annotations
import argparse import argparse
from typing import ( from typing import (
Any, Any,
@ -20,7 +18,7 @@ from typing import (
import jinja2 import jinja2
from synapse.config import ( from synapse.config import ( # noqa: F401
account_validity, account_validity,
api, api,
appservice, appservice,
@ -169,7 +167,7 @@ class RootConfig:
self, section_name: Literal["caches"] self, section_name: Literal["caches"]
) -> cache.CacheConfig: ... ) -> cache.CacheConfig: ...
@overload @overload
def reload_config_section(self, section_name: str) -> Config: ... def reload_config_section(self, section_name: str) -> "Config": ...
class Config: class Config:
root: RootConfig root: RootConfig
@ -202,9 +200,9 @@ def find_config_files(search_paths: List[str]) -> List[str]: ...
class ShardedWorkerHandlingConfig: class ShardedWorkerHandlingConfig:
instances: List[str] instances: List[str]
def __init__(self, instances: List[str]) -> None: ... def __init__(self, instances: List[str]) -> None: ...
def should_handle(self, instance_name: str, key: str) -> bool: ... def should_handle(self, instance_name: str, key: str) -> bool: ... # noqa: F811
class RoutableShardedWorkerHandlingConfig(ShardedWorkerHandlingConfig): class RoutableShardedWorkerHandlingConfig(ShardedWorkerHandlingConfig):
def get_instance(self, key: str) -> str: ... def get_instance(self, key: str) -> str: ... # noqa: F811
def read_file(file_path: Any, config_path: Iterable[str]) -> str: ... def read_file(file_path: Any, config_path: Iterable[str]) -> str: ...

View File

@ -154,7 +154,7 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
# Create a user to receive notifications and send receipts. # Create a user to receive notifications and send receipts.
user_id, token, _, other_token, room_id = self._create_users_and_room() user_id, token, _, other_token, room_id = self._create_users_and_room()
last_event_id: str last_event_id = ""
def _assert_counts(notif_count: int, highlight_count: int) -> None: def _assert_counts(notif_count: int, highlight_count: int) -> None:
counts = self.get_success( counts = self.get_success(
@ -289,7 +289,7 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
user_id, token, _, other_token, room_id = self._create_users_and_room() user_id, token, _, other_token, room_id = self._create_users_and_room()
thread_id: str thread_id: str
last_event_id: str last_event_id = ""
def _assert_counts( def _assert_counts(
notif_count: int, notif_count: int,
@ -471,7 +471,7 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
user_id, token, _, other_token, room_id = self._create_users_and_room() user_id, token, _, other_token, room_id = self._create_users_and_room()
thread_id: str thread_id: str
last_event_id: str last_event_id = ""
def _assert_counts( def _assert_counts(
notif_count: int, notif_count: int,