diff --git a/mypy_drf_plugin/main.py b/mypy_drf_plugin/main.py index 8a8b0f0de..49987e53b 100644 --- a/mypy_drf_plugin/main.py +++ b/mypy_drf_plugin/main.py @@ -23,8 +23,7 @@ def _get_currently_defined_serializers(self) -> dict[str, int]: "serializer_bases", {fullnames.BASE_SERIALIZER_FULLNAME: 1} ) return serializer_bases - else: - return {} + return {} def get_base_class_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None: if fullname in self._get_currently_defined_serializers(): diff --git a/pyproject.toml b/pyproject.toml index cfe917bba..ce5bc2950 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,17 +88,30 @@ select = [ "B", # bugbear "E", # pycodestyle "F", # pyflakes + "FURB", # refurb "INP", # flake8-tidy-imports "W", # pycodestyle "I", # isort + "ISC001", # Implicitly concatenated string literals on one line + "ISC002", # Implicitly concatenated string literals over multiple lines "UP", # pyupgrade "TID251", # Disallowed imports (flake8-tidy-imports.banned-api) "PYI", # flake8-pyi "RUF100", # Equivalent to flake8-noqa NQA103 "PGH004", # Equivalent to flake8-noqa NQA104 "PGH003", # Disallowed blanket `type: ignore` annotations. + "RET504", # Unnecessary assignment to {name} before return statement + "RET505", # Unnecessary {branch} after return statement + "RET506", # Unnecessary {branch} after raise statement + "RET507", # Unnecessary {branch} after continue statement + "RET508", # Unnecessary {branch} after break statement + "RUF", # Ruff specific rules + "TC", # flake8-type-checking +] +ignore = [ + "PYI021", # We have a few meaningful docstrings for stubs only constructs/utilities. + "PYI041", # This might not be obvious that `float | int` is mostly equivalent to `float` typing wise | int | str ] -ignore = ["PYI021", "PYI024", "PYI041", "PYI043"] [tool.ruff.lint.per-file-ignores] "*.pyi" = [ diff --git a/rest_framework-stubs/compat.pyi b/rest_framework-stubs/compat.pyi index 1345f96a2..304320dae 100644 --- a/rest_framework-stubs/compat.pyi +++ b/rest_framework-stubs/compat.pyi @@ -60,24 +60,24 @@ LONG_SEPARATORS: tuple[str, str] INDENT_SEPARATORS: tuple[str, str] __all__ = [ + "INDENT_SEPARATORS", + "LONG_SEPARATORS", + "SHORT_SEPARATORS", + "CodeBlockPreprocessor", + "Preprocessor", + "QuerySet", + "apply_markdown", "coreapi", "coreschema", - "requests", - "postgres_fields", - "QuerySet", - "uritemplate", - "yaml", "inflection", - "pygments", "markdown", - "apply_markdown", - "Preprocessor", - "CodeBlockPreprocessor", + "md_filter_add_syntax_highlight", + "postgres_fields", + "pygments", "pygments_css", "pygments_highlight", - "md_filter_add_syntax_highlight", + "requests", "unicode_http_header", - "SHORT_SEPARATORS", - "LONG_SEPARATORS", - "INDENT_SEPARATORS", + "uritemplate", + "yaml", ]