Skip to content

Commit

Permalink
Refactor - Rename PylintASTWalker to ASTWalker
Browse files Browse the repository at this point in the history
For obvious reasons. See review here :
#2654 (comment)
  • Loading branch information
Pierre-Sassoulas authored and PCManticore committed Mar 9, 2019
1 parent b5faf22 commit b2a77e4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
10 changes: 2 additions & 8 deletions pylint/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,7 @@
from pylint import interfaces
from pylint import reporters
from pylint.message import MessagesStore, Message, MSG_TYPES, MessagesHandlerMixIn
from pylint.utils import (
FileState,
PyLintASTWalker,
ReportsHandlerMixIn,
OPTION_RGX,
utils,
)
from pylint.utils import FileState, ASTWalker, ReportsHandlerMixIn, OPTION_RGX, utils
from pylint import exceptions
from pylint import config
from pylint.__pkginfo__ import version
Expand Down Expand Up @@ -1072,7 +1066,7 @@ def _parallel_check(self, files_or_modules):
checker.stats = self.stats

def _do_check(self, files_or_modules):
walker = PyLintASTWalker(self)
walker = ASTWalker(self)
_checkers = self.prepare_checkers()
tokencheckers = [
c
Expand Down
8 changes: 4 additions & 4 deletions pylint/test/utils/unittest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

import astroid

from pylint.utils import utils, PyLintASTWalker
from pylint.utils import utils, ASTWalker
from pylint.checkers.utils import check_messages, get_node_last_lineno


class TestPyLintASTWalker(object):
class TestASTWalker(object):
class MockLinter(object):
def __init__(self, msgs):
self._msgs = msgs
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_check_messages(self):
linter = self.MockLinter(
{"first-message": True, "second-message": False, "third-message": True}
)
walker = PyLintASTWalker(linter)
walker = ASTWalker(linter)
checker = self.Checker()
walker.add_checker(checker)
walker.walk(astroid.parse("x = func()"))
Expand All @@ -74,7 +74,7 @@ def visit_assname(self, node):
self.called = True

linter = self.MockLinter({"first-message": True})
walker = PyLintASTWalker(linter)
walker = ASTWalker(linter)
checker = Checker()
walker.add_checker(checker)
with warnings.catch_warnings(record=True):
Expand Down
4 changes: 2 additions & 2 deletions pylint/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import astroid
from pylint import checkers
from pylint.utils import PyLintASTWalker
from pylint.utils import ASTWalker
from pylint.reporters import BaseReporter
from pylint.interfaces import IReporter
from pylint.lint import PyLinter
Expand Down Expand Up @@ -254,7 +254,7 @@ def assertAddsMessages(self, *messages):

def walk(self, node):
"""recursive walk on the given node"""
walker = PyLintASTWalker(linter)
walker = ASTWalker(linter)
walker.add_checker(self.checker)
walker.walk(node)

Expand Down
2 changes: 1 addition & 1 deletion pylint/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from pylint.utils.constants import OPTION_RGX, PY_EXTS
from pylint.utils.file_state import FileState
from pylint.utils.normalize_text import normalize_text
from pylint.utils.pylint_ast_walker import PyLintASTWalker
from pylint.utils.ast_walker import ASTWalker
from pylint.utils.reports_handler_mix_in import ReportsHandlerMixIn
from pylint.utils.utils import (
_basename_in_blacklist_re,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from astroid import nodes


class PyLintASTWalker:
class ASTWalker:
def __init__(self, linter):
# callbacks per node types
self.nbstatements = 0
Expand Down

0 comments on commit b2a77e4

Please sign in to comment.