diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2020-04-22 08:24:45 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2020-04-26 12:43:49 +0200 |
commit | 0f88ff259c2787f253e96049d81f41eefea0860e (patch) | |
tree | 6832b506c28a63dd6800603611b3724fea0332f8 | |
parent | 352cd4c91a7fe22526a91709e49fad3e9b14fe38 (diff) | |
download | pylint-git-0f88ff259c2787f253e96049d81f41eefea0860e.tar.gz |
Refactor - Move the content of lint.py in its own package
Also move unittest_lint in test/lint.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | pylint/checkers/format.py | 2 | ||||
-rw-r--r-- | pylint/checkers/misc.py | 2 | ||||
-rw-r--r-- | pylint/lint/__init__.py (renamed from pylint/lint.py) | 0 | ||||
-rw-r--r-- | tests/lint/__init__.py | 0 | ||||
-rw-r--r-- | tests/lint/unittest_lint.py (renamed from tests/unittest_lint.py) | 28 | ||||
-rw-r--r-- | tox.ini | 2 |
7 files changed, 18 insertions, 18 deletions
@@ -50,7 +50,7 @@ $(PKG_SDIST): lint: $(PIP) $(PIP) install . - $(PYVE)/bin/pylint lint.py || true # for now ignore errors + $(PYVE)/bin/pylint lint/__init__.py || true # for now ignore errors clean: rm -rf $(PYVE) diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py index 1f8528800..cde145afc 100644 --- a/pylint/checkers/format.py +++ b/pylint/checkers/format.py @@ -1291,7 +1291,7 @@ class FormatChecker(BaseTokenChecker): if pragma.action == "disable" and "line-too-long" in pragma.messages: return False except PragmaParserError: - # Printing usefull informations dealing with this error is done in lint.py + # Printing useful information dealing with this error is done in the lint package pass return True diff --git a/pylint/checkers/misc.py b/pylint/checkers/misc.py index cbd04ed55..512d03e65 100644 --- a/pylint/checkers/misc.py +++ b/pylint/checkers/misc.py @@ -162,7 +162,7 @@ class EncodingChecker(BaseChecker): ): values.extend(pragma_repr.messages) except PragmaParserError: - # Printing usefull informations dealing with this error is done in lint.py + # Printing useful information dealing with this error is done in the lint package pass values = [_val.upper() for _val in values] if set(values) & set(self.config.notes): diff --git a/pylint/lint.py b/pylint/lint/__init__.py index b86f2ffed..b86f2ffed 100644 --- a/pylint/lint.py +++ b/pylint/lint/__init__.py diff --git a/tests/lint/__init__.py b/tests/lint/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/lint/__init__.py diff --git a/tests/unittest_lint.py b/tests/lint/unittest_lint.py index 5c889ec7f..68ac7f7bd 100644 --- a/tests/unittest_lint.py +++ b/tests/lint/unittest_lint.py @@ -94,8 +94,9 @@ def remove(file): HERE = abspath(dirname(__file__)) -INPUTDIR = join(HERE, "input") -REGRTEST_DATA = join(HERE, "regrtest_data") +INPUT_DIR = join(HERE, "..", "input") +REGRTEST_DATA_DIR = join(HERE, "..", "regrtest_data") +DATA_DIR = join(HERE, "..", "data") @contextmanager @@ -318,7 +319,7 @@ def test_message_state_scope(init_linter): def test_enable_message_block(init_linter): linter = init_linter linter.open() - filepath = join(REGRTEST_DATA, "func_block_disable_msg.py") + filepath = join(REGRTEST_DATA_DIR, "func_block_disable_msg.py") linter.set_current_module("func_block_disable_msg") astroid = linter.get_ast(filepath, "func_block_disable_msg") linter.process_tokens(tokenize_module(astroid)) @@ -504,11 +505,11 @@ def test_addmessage_invalid(linter): def test_load_plugin_command_line(): - dummy_plugin_path = join(HERE, "regrtest_data", "dummy_plugin") + dummy_plugin_path = join(REGRTEST_DATA_DIR, "dummy_plugin") sys.path.append(dummy_plugin_path) run = Run( - ["--load-plugins", "dummy_plugin", join(HERE, "regrtest_data", "empty.py")], + ["--load-plugins", "dummy_plugin", join(REGRTEST_DATA_DIR, "empty.py")], do_exit=False, ) assert ( @@ -520,13 +521,12 @@ def test_load_plugin_command_line(): def test_load_plugin_config_file(): - dummy_plugin_path = join(HERE, "regrtest_data", "dummy_plugin") + dummy_plugin_path = join(REGRTEST_DATA_DIR, "dummy_plugin") sys.path.append(dummy_plugin_path) - config_path = join(HERE, "regrtest_data", "dummy_plugin.rc") + config_path = join(REGRTEST_DATA_DIR, "dummy_plugin.rc") run = Run( - ["--rcfile", config_path, join(HERE, "regrtest_data", "empty.py")], - do_exit=False, + ["--rcfile", config_path, join(REGRTEST_DATA_DIR, "empty.py")], do_exit=False, ) assert ( len([ch.name for ch in run.linter.get_checkers() if ch.name == "dummy_plugin"]) @@ -537,7 +537,7 @@ def test_load_plugin_config_file(): def test_load_plugin_configuration(): - dummy_plugin_path = join(HERE, "regrtest_data", "dummy_plugin") + dummy_plugin_path = join(REGRTEST_DATA_DIR, "dummy_plugin") sys.path.append(dummy_plugin_path) run = Run( @@ -546,7 +546,7 @@ def test_load_plugin_configuration(): "dummy_conf_plugin", "--ignore", "foo,bar", - join(HERE, "regrtest_data", "empty.py"), + join(REGRTEST_DATA_DIR, "empty.py"), ], do_exit=False, ) @@ -562,7 +562,7 @@ def test_init_hooks_called_before_load_plugins(): def test_analyze_explicit_script(linter): linter.set_reporter(testutils.TestReporter()) - linter.check(os.path.join(os.path.dirname(__file__), "data", "ascript")) + linter.check(os.path.join(DATA_DIR, "ascript")) assert ["C: 2: Line too long (175/100)"] == linter.reporter.messages @@ -755,7 +755,7 @@ def test_custom_should_analyze_file(): """Check that we can write custom should_analyze_file that work even for arguments. """ - package_dir = os.path.join(HERE, "regrtest_data", "bad_package") + package_dir = os.path.join(REGRTEST_DATA_DIR, "bad_package") wrong_file = os.path.join(package_dir, "wrong.py") for jobs in [1, 2]: @@ -785,7 +785,7 @@ def test_filename_with__init__(init_linter): linter = init_linter linter.open() linter.set_reporter(reporter) - filepath = join(INPUTDIR, "not__init__.py") + filepath = join(INPUT_DIR, "not__init__.py") linter.check([filepath]) messages = reporter.messages assert len(messages) == 0 @@ -22,7 +22,7 @@ commands = {toxinidir}/tests/unittest_checker_spelling.py {toxinidir}/tests/unittest_checker_stdlib.py \ {toxinidir}/tests/unittest_checker_strings.py {toxinidir}/tests/unittest_checkers_utils.py \ {toxinidir}/tests/unittest_checker_typecheck.py {toxinidir}/tests/unittest_checker_variables.py \ - {toxinidir}/tests/unittest_config.py {toxinidir}/tests/unittest_lint.py {toxinidir}/tests/unittest_pyreverse_diadefs.py \ + {toxinidir}/tests/unittest_config.py {toxinidir}/tests/lint/ {toxinidir}/tests/unittest_pyreverse_diadefs.py \ {toxinidir}/tests/unittest_pyreverse_inspector.py {toxinidir}/tests/unittest_pyreverse_writer.py \ {toxinidir}/tests/unittest_reporters_json.py {toxinidir}/tests/unittest_reporting.py |