mirror of https://github.com/zulip/zulip.git
ruff: Enable naming errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
924d530292
commit
1b016bef73
|
@ -106,6 +106,7 @@ select = [
|
||||||
"E", # style errors
|
"E", # style errors
|
||||||
"F", # flakes
|
"F", # flakes
|
||||||
"M", # meta
|
"M", # meta
|
||||||
|
"N", # naming
|
||||||
"U", # upgrade
|
"U", # upgrade
|
||||||
"W", # style warnings
|
"W", # style warnings
|
||||||
]
|
]
|
||||||
|
@ -120,6 +121,9 @@ ignore = [
|
||||||
"E402", # Module level import not at top of file
|
"E402", # Module level import not at top of file
|
||||||
"E501", # Line too long
|
"E501", # Line too long
|
||||||
"E731", # Do not assign a lambda expression, use a def
|
"E731", # Do not assign a lambda expression, use a def
|
||||||
|
"N802", # Function name should be lowercase
|
||||||
|
"N806", # Variable in function should be lowercase
|
||||||
|
"N818", # Exception name should be named with an Error suffix
|
||||||
]
|
]
|
||||||
line-length = 100
|
line-length = 100
|
||||||
target-version = "py38"
|
target-version = "py38"
|
||||||
|
|
|
@ -140,7 +140,7 @@ class UploadSerializeMixin(SerializeMixin):
|
||||||
|
|
||||||
class ZulipTestCase(TestCase):
|
class ZulipTestCase(TestCase):
|
||||||
# Ensure that the test system just shows us diffs
|
# Ensure that the test system just shows us diffs
|
||||||
maxDiff: Optional[int] = None
|
maxDiff: Optional[int] = None # noqa: N815
|
||||||
|
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|
|
@ -73,13 +73,13 @@ class MockLDAP(fakeldap.MockLDAP):
|
||||||
class LDAPError(ldap.LDAPError):
|
class LDAPError(ldap.LDAPError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class INVALID_CREDENTIALS(ldap.INVALID_CREDENTIALS):
|
class INVALID_CREDENTIALS(ldap.INVALID_CREDENTIALS): # noqa: N801
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class NO_SUCH_OBJECT(ldap.NO_SUCH_OBJECT):
|
class NO_SUCH_OBJECT(ldap.NO_SUCH_OBJECT): # noqa: N801
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class ALREADY_EXISTS(ldap.ALREADY_EXISTS):
|
class ALREADY_EXISTS(ldap.ALREADY_EXISTS): # noqa: N801
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -792,11 +792,11 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
|
||||||
# `realm` instead of `self` here to make sure the parameters of the cache key
|
# `realm` instead of `self` here to make sure the parameters of the cache key
|
||||||
# function matches the original method.
|
# function matches the original method.
|
||||||
@cache_with_key(get_realm_emoji_cache_key, timeout=3600 * 24 * 7)
|
@cache_with_key(get_realm_emoji_cache_key, timeout=3600 * 24 * 7)
|
||||||
def get_emoji(realm) -> Dict[str, EmojiInfo]:
|
def get_emoji(realm) -> Dict[str, EmojiInfo]: # noqa: N805
|
||||||
return get_realm_emoji_uncached(realm)
|
return get_realm_emoji_uncached(realm)
|
||||||
|
|
||||||
@cache_with_key(get_active_realm_emoji_cache_key, timeout=3600 * 24 * 7)
|
@cache_with_key(get_active_realm_emoji_cache_key, timeout=3600 * 24 * 7)
|
||||||
def get_active_emoji(realm) -> Dict[str, EmojiInfo]:
|
def get_active_emoji(realm) -> Dict[str, EmojiInfo]: # noqa: N805
|
||||||
return get_active_realm_emoji_uncached(realm)
|
return get_active_realm_emoji_uncached(realm)
|
||||||
|
|
||||||
def get_admin_users_and_bots(
|
def get_admin_users_and_bots(
|
||||||
|
@ -897,7 +897,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
|
||||||
# `realm` instead of `self` here to make sure the parameters of the cache key
|
# `realm` instead of `self` here to make sure the parameters of the cache key
|
||||||
# function matches the original method.
|
# function matches the original method.
|
||||||
@cache_with_key(get_realm_used_upload_space_cache_key, timeout=3600 * 24 * 7)
|
@cache_with_key(get_realm_used_upload_space_cache_key, timeout=3600 * 24 * 7)
|
||||||
def currently_used_upload_space_bytes(realm) -> int:
|
def currently_used_upload_space_bytes(realm) -> int: # noqa: N805
|
||||||
used_space = Attachment.objects.filter(realm=realm).aggregate(Sum("size"))["size__sum"]
|
used_space = Attachment.objects.filter(realm=realm).aggregate(Sum("size"))["size__sum"]
|
||||||
if used_space is None:
|
if used_space is None:
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue