Skip to content

Commit

Permalink
Improve MyPy configuration
Browse files Browse the repository at this point in the history
Some improvments flagged by Repo-Review: https://learn.scientific-python.org/development/guides/repo-review/

1. Remove now-default show_error_codes.
2. Enable some optional error codes with extra checks.
  • Loading branch information
adamchainz committed Jun 19, 2024
1 parent 644105c commit 18aeff4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ source = [
show_missing = true

[tool.mypy]
enable_error_code = [
"ignore-without-code",
"redundant-expr",
"truthy-bool",
]
mypy_path = "src/"
namespace_packages = false
show_error_codes = true
strict = true
warn_unreachable = true

Expand Down
2 changes: 1 addition & 1 deletion src/corsheaders/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def check_settings(**kwargs: Any) -> list[CheckMessage]:
)

if (
not isinstance(conf.CORS_PREFLIGHT_MAX_AGE, int)
not isinstance(conf.CORS_PREFLIGHT_MAX_AGE, int) # type: ignore [redundant-expr]
or conf.CORS_PREFLIGHT_MAX_AGE < 0
):
errors.append(
Expand Down

0 comments on commit 18aeff4

Please sign in to comment.