Skip to content

Commit

Permalink
Increase type hint coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Nov 1, 2022
1 parent 0940221 commit 17bfa0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions flake8_encodings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class Visitor(flake8_helper.Visitor):
The functionality for checking classes has moved to the :class:`~.ClassVisitor` subclass.
"""

def check_open_encoding(self, node: ast.Call):
def check_open_encoding(self, node: ast.Call) -> None:
"""
Check the call represented by the given AST node is using encodings correctly.
Expand Down Expand Up @@ -141,7 +141,7 @@ def check_open_encoding(self, node: ast.Call):

check_encoding = check_open_encoding # deprecated

def visit_Call(self, node: ast.Call): # noqa: D102
def visit_Call(self, node: ast.Call) -> None: # noqa: D102

if isinstance(node.func, ast.Name):

Expand Down Expand Up @@ -195,7 +195,7 @@ def __init__(self):
self.filename = PathPlus("<unknown>")
self.jedi_script = jedi.Script('')

def first_visit(self, node: ast.AST, filename: PathPlus):
def first_visit(self, node: ast.AST, filename: PathPlus) -> None:
"""
Like :meth:`ast.NodeVisitor.visit`, but configures type inference.
Expand All @@ -212,7 +212,7 @@ def first_visit(self, node: ast.AST, filename: PathPlus):
self.jedi_script = jedi.Script(self.filename.read_text(), path=self.filename)
self.visit(node)

def check_configparser_encoding(self, node: ast.Call):
def check_configparser_encoding(self, node: ast.Call) -> None:
"""
Check the call represented by the given AST node is using encodings correctly.
Expand All @@ -230,7 +230,7 @@ def check_configparser_encoding(self, node: ast.Call):
if kwargs["encoding"].value is None:
self.report_error(node, ENC012)

def check_pathlib_encoding(self, node: ast.Call, method_name: str):
def check_pathlib_encoding(self, node: ast.Call, method_name: str) -> None:
"""
Check the call represented by the given AST node is using encodings correctly.
Expand Down Expand Up @@ -279,7 +279,7 @@ def check_pathlib_encoding(self, node: ast.Call, method_name: str):
if kwargs["encoding"].value is None:
self.report_error(node, encoding_none)

def visit_Call(self, node: ast.Call): # noqa: D102
def visit_Call(self, node: ast.Call) -> None: # noqa: D102

if isinstance(node.func, ast.Name):

Expand Down
6 changes: 5 additions & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
pytest.param(False, id="no_jedi", marks=pytest.mark.skipif(has_jedi, reason=skip_reason)),
]
)
def test_plugin(tmp_pathplus: PathPlus, advanced_data_regression: AdvancedDataRegressionFixture, has_jedi):
def test_plugin(
tmp_pathplus: PathPlus,
advanced_data_regression: AdvancedDataRegressionFixture,
has_jedi: bool,
):
(tmp_pathplus / "code.py").write_text(example_source)

plugin = Plugin(ast.parse(example_source), filename=str(tmp_pathplus / "code.py"))
Expand Down

0 comments on commit 17bfa0f

Please sign in to comment.