Update ruff config (#221)

This commit is contained in:
Adrian 2024-02-02 17:56:39 +01:00 committed by GitHub
parent 05ba82ba75
commit eab87e6401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 13 deletions

View File

@ -1,10 +1,11 @@
target-version = 'py39'
line-length = 120
extend-exclude = ['docs', 'htmlcov', '*.egg-info']
[lint]
preview = true
dummy-variable-rgx = '^(_{2,}|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$' # a single `_` is already used for i18n
extend-exclude = ['.*/', 'docs', 'htmlcov', '*.egg-info']
select = [
'E', # pycodestyle
'F', # pyflakes
@ -46,6 +47,7 @@ ignore = [
'N818', # not all our exceptions are errors
'RUF012', # ultra-noisy and dicts in classvars are very common
'RUF015', # not always more readable, and we don't do it for huge lists
'RUF022', # autofix messes up out formatting instead of just sorting
'D205', # too many docstrings which have no summary line
'D301', # https://github.com/astral-sh/ruff/issues/8696
'D1', # we have way too many missing docstrings :(
@ -55,10 +57,14 @@ ignore = [
'S113', # enforcing timeouts would likely require config in some places - maybe later
'S311', # false positives, it does not care about the context
'S324', # all our md5/sha1 usages are for non-security purposes
'S404', # useless, triggers on *all* subprocess imports
'S403', # there's already a warning on using pickle, no need to have one for the import
'S405', # we don't use lxml in unsafe ways
'S410', # we don't use lxml in unsafe ways
'S603', # useless, triggers on *all* subprocess calls: https://github.com/astral-sh/ruff/issues/4045
'S607', # we trust the PATH to be sane
'B011', # we don't run python with `-O` (also see S101)
'B904', # very similar to TRY200 ("possibly useful but too noisy")
'B904', # possibly useful but too noisy
'COM812', # trailing commas on multiline lists are nice, but we have 2.5k violations
'PIE807', # `lambda: []` is much clearer for `load_default` in schemas
'PT004', # pretty weird + not a pytest convention: https://github.com/astral-sh/ruff/issues/8796
@ -73,6 +79,7 @@ ignore = [
'SIM114', # sometimes separate ifs are more readable (especially if they just return a bool)
'SIM117', # nested context managers may be more readable
'PLC0415', # local imports are there for a reason
'PLC2701', # some private imports are needed
'PLR09', # too-many-<whatever> is just noisy
'PLR0913', # very noisy
'PLR2004', # extremely noisy and generally annoying
@ -85,7 +92,6 @@ ignore = [
'PLW2901', # noisy and reassigning to the loop var is usually intentional
'TRY002', # super noisy, and those exceptions are pretty exceptional anyway
'TRY003', # super noisy and also useless w/ werkzeugs http exceptions
'TRY200', # possibly useful but too noisy (also see B904)
'TRY300', # kind of strange in many cases
'TRY301', # sometimes doing that is actually useful
'TRY400', # not all exceptions need exception logging
@ -110,23 +116,23 @@ extend-safe-fixes = [
[format]
quote-style = 'single'
[flake8-builtins]
[lint.flake8-builtins]
builtins-ignorelist = ['id', 'format', 'input', 'type', 'credits']
[flake8-pytest-style]
[lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
parametrize-names-type = 'tuple'
parametrize-values-type = 'tuple'
parametrize-values-row-type = 'tuple'
[flake8-quotes]
[lint.flake8-quotes]
inline-quotes = 'single'
multiline-quotes = 'single'
docstring-quotes = 'double'
avoid-escape = true
[pep8-naming]
[lint.pep8-naming]
ignore-names = [
'_process_GET',
'_process_POST',
@ -142,13 +148,17 @@ classmethod-decorators = [
'comparator',
]
[pydocstyle]
[lint.pydocstyle]
convention = 'pep257'
[pylint]
allow-dunder-method-names = ['__table_args__', '__tablename__', '__clause_element__']
[lint.pylint]
allow-dunder-method-names = [
'__table_args__',
'__tablename__',
'__clause_element__',
]
[per-file-ignores]
[lint.per-file-ignores]
# allow stuff that's useful in tests
'*/*_test.py' = ['E221', 'E241', 'E272', 'N802', 'S105', 'S106', 'PLC1901']
# allow long lines in migrations (only do that for raw SQL please)

View File

@ -47,7 +47,7 @@ class UserLookupMode(RichStrEnum):
@property
def title(self):
return RichStrEnum.title.__get__(self, type(self))
return RichStrEnum.title.__get__(self, type(self)) # noqa: PLC2801
all_emails = 'all_emails'
email_domains = 'email_domains'