Skip to content

Commit

Permalink
Add more mypy optional error codes (#3086)
Browse files Browse the repository at this point in the history
* Add more `mypy` optional error codes

* Update base.py
  • Loading branch information
sobolevn authored Nov 2, 2024
1 parent 1b55945 commit 30289bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ enable_error_code =
# ignore-without-code,
possibly-undefined,
redundant-self,
mutable-override,
unimported-reveal,

disable_error_code =
no-untyped-def,
Expand Down
8 changes: 4 additions & 4 deletions wemake_python_styleguide/violations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _location(self) -> Tuple[int, int]:
class _BaseASTViolation(BaseViolation):
"""Used as a based type for all ``ast`` violations."""

_node: Optional[ast.AST]
_node: Optional[ast.AST] # type: ignore[mutable-override]

@final
def _location(self) -> Tuple[int, int]:
Expand All @@ -210,7 +210,7 @@ def _location(self) -> Tuple[int, int]:
class ASTViolation(_BaseASTViolation):
"""Violation for ``ast`` based style visitors."""

_node: ast.AST
_node: ast.AST # type: ignore[mutable-override]


class MaybeASTViolation(_BaseASTViolation):
Expand All @@ -234,7 +234,7 @@ def __init__(
class TokenizeViolation(BaseViolation):
"""Violation for ``tokenize`` based visitors."""

_node: tokenize.TokenInfo
_node: tokenize.TokenInfo # type: ignore[mutable-override]

@final
def _location(self) -> Tuple[int, int]:
Expand All @@ -244,7 +244,7 @@ def _location(self) -> Tuple[int, int]:
class SimpleViolation(BaseViolation):
"""Violation for cases where there's no associated nodes."""

_node: None
_node: None # type: ignore[mutable-override]

def __init__(
self,
Expand Down

0 comments on commit 30289bc

Please sign in to comment.