Skip to content

Commit

Permalink
fix from review.
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-bagerard committed May 21, 2021
1 parent 6893743 commit 40cd990
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions flake8_eradicate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

import ast
import tokenize
from typing import Iterable, Tuple
from typing import Iterable, Tuple, Type

import pkg_resources
from eradicate import Eradicator
Expand All @@ -25,7 +25,15 @@ class Checker(object):

options = None

def __init__(self, tree, filename: str): # noqa: D107
def __init__(self, tree: ast.AST, filename: str):
"""
``flake8`` plugin constructor.
Arguments:
tree: the file abstract syntax tree.
filename: the name of the file to process
"""
self.filename = filename

self._options = {
Expand Down Expand Up @@ -98,7 +106,7 @@ def parse_options(cls, options) -> None:
"""Parses registered options for providing them to each visitor."""
cls.options = options

def run(self) -> Iterable[Tuple[int, str]]:
def run(self) -> Tuple[int, int, str, Type["Checker"]]:
"""Runs on each step of flake8."""
for line_no in self._lines_with_commented_out_code():
yield line_no, 0, self._error_template, type(self)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ def test_lines_with_commented_out_code_incorrect_fixture_output(absolute_path):

OptionsStub = namedtuple(
'Options',
'eradicate_aggressive eradicate_whitelist eradicate_whitelist_extend'
'eradicate_aggressive eradicate_whitelist eradicate_whitelist_extend',
)
Checker.options = OptionsStub(
eradicate_aggressive=True,
eradicate_whitelist=False,
eradicate_whitelist_extend=False
eradicate_whitelist_extend=False,
)

checker = Checker(tree=None, filename=filename)
Expand Down

0 comments on commit 40cd990

Please sign in to comment.