Skip to content

Commit

Permalink
Permit to raise useless suppression
Browse files Browse the repository at this point in the history
Closes #373
  • Loading branch information
Pierre-Sassoulas committed Aug 27, 2021
1 parent 4fee312 commit 6523fd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion prospector/tools/pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def _prospector_configure(self, prospector_config, linter):
linter.disable("locally-disabled") # notification about disabling a message
linter.enable("file-ignored") # notification about disabling an entire file
linter.enable("suppressed-message") # notification about a message being suppressed
linter.disable("useless-suppression") # notification about message suppressed which was not raised
linter.disable("deprecated-pragma") # notification about use of deprecated 'pragma' option

# disable the 'mixed indentation' warning, since it actually will only
Expand Down
8 changes: 4 additions & 4 deletions tests/tools/pylint/test_pylint_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ def test_wont_throw_false_positive_relative_beyond_top_level(self):
messages = pylint_tool.run(found_files)
self.assertListEqual(messages, [])

def test_wont_throw_useless_suppression(self):
def test_will_throw_useless_suppression(self):
with patch("os.getcwd", return_value=os.path.realpath("tests/tools/pylint/testpath/")):
pylint_tool, config = _get_pylint_tool_and_prospector_config(argv_patch=["", "-t", "pylint"])
root = os.path.join(os.path.dirname(__file__), "testpath", "test_useless_suppression.py")
found_files = find_python([], [root], explicit_file_mode=True)
pylint_tool.configure(config, found_files)
messages = pylint_tool.run(found_files)
for message in messages:
if message.code == "useless-suppression":
self.fail("useless-suppression was thrown")
assert any(
m.code == "useless-suppression" for m in messages
), "There should be at least one useless suppression"

def test_use_pylint_default_path_finder(self):
workdir = os.path.realpath("tests/tools/pylint/testpath/absolute-import/")
Expand Down

0 comments on commit 6523fd8

Please sign in to comment.