Skip to content

Commit

Permalink
fix: show_error_codes deprecated
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Nov 14, 2023
1 parent 4a85cbe commit 2f147a5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
3 changes: 0 additions & 3 deletions docs/pages/guides/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ this:
files = "src"
python_version = "3.8"
strict = true
show_error_codes = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
Expand Down Expand Up @@ -580,8 +579,6 @@ and `ignore-without-code` {% rr MY104 %}, `redundant-expr` {% rr MY105 %}, and
checks) and have to be ignored occasionally, but can find some signifiant logic
errors in your typing.

{% rr MY102 %} You should enable `show_error_codes`.

[mypy page]: {% link pages/guides/mypy.md %}

## Setuptools specific checks
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ files = ["src", "tests"]
python_version = "3.10"
warn_unused_configs = true
strict = true
show_error_codes = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
disallow_untyped_defs = false
Expand Down
17 changes: 5 additions & 12 deletions src/sp_repo_review/checks/mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,21 @@ def check(pyproject: dict[str, Any]) -> bool:


class MY102(MyPy):
"MyPy show error codes"
"MyPy show_error_codes deprecated"

requires = {"MY100"}
url = mk_url("style")

@staticmethod
def check(pyproject: dict[str, Any]) -> bool:
"""
Must have `show_error_codes = true`. This will print helpful error codes
for users that clarify why something fails if you need to skip it.
```toml
[tool.mypy]
show_error_codes = true
```
Must not have `show_error_codes`. Use `hide_error_codes` instead (since MyPy v0.990).
"""

match pyproject:
case {"tool": {"mypy": {"show_error_codes": True}}}:
return True
case _:
case {"tool": {"mypy": {"show_error_codes": object()}}}:
return False
case _:
return True


class MY103(MyPy):
Expand Down
1 change: 0 additions & 1 deletion {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ files = ["src", "tests"]
python_version = "3.8"
warn_unused_configs = true
strict = true
show_error_codes = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
disallow_untyped_defs = false
Expand Down

0 comments on commit 2f147a5

Please sign in to comment.