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 e48496d commit f63db2f
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 @@ -68,9 +68,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/blacken_docs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def finish_fragment() -> None:
code += f"{PYCON_CONTINUATION_PREFIX}\n"
fragment = None

indentation = None
indentation: int | None = None
for line in match["code"].splitlines():
orig_line, line = line, line.lstrip()
if indentation is None and line:
Expand Down

0 comments on commit f63db2f

Please sign in to comment.