Skip to content

Typo in top level pylintrc and possible bug in missing-docstring or useless-suppression #5040

Closed
@scop

Description

@scop

Bug description

The top level pylintrc for pylint itself has a typo:

@@ -54 +54 @@ enable=
-    useless-supression,
+    useless-suppression,

Fixing that typo causes a test suite failure, because of one new useless-suppression message:

 ______________ TestRunTC.test_json_report_does_not_escape_quotes _______________

self = <test_self.TestRunTC object at 0x7f13cd73b5f8>

    def test_json_report_does_not_escape_quotes(self) -> None:
        out = StringIO()
        module = join(HERE, "regrtest_data", "unused_variable.py")
        self._runtest([module], code=4, reporter=JSONReporter(out))
        output = json.loads(out.getvalue())
        assert isinstance(output, list)
>       assert len(output) == 1
E       assert 2 == 1
E        +  where 2 = len([{'column': 4, 'line': 4, 'message': "Unused variable 'variable'", 'message-id': 'W0612', ...}, {'column': 0, 'line': 1, 'message': "Useless suppression of 'missing-class-docstring'", 'message-id': 'I0021', ...}])

I'm reporting this here instead of filing a PR, in part because I think it's faster for someone who knows the preferred way to deal with this to just fix it instead of going back and forth with a PR..

But more importantly, the useless suppression message seems to indicate a pylint bug or at least behavior which is weird to me:

./tests/regrtest_data/unused_variable.py doesn't even contain a suppression for missing-class-docstring which is said to be useless. It just has one for missing-docstring. I wondered if this could be if the latter was a superset of the former or something, but then again even then the suppression would not seem useless because there just isn't a class docstring in the said file at all, so the warning about the suppression would seem spot on.

TODO

  • Fix the typo and enable useless suppression
  • Handle the "false positive" / working as intended for useless suppression of missing docstring

Pylint version

Current git main

Metadata

Metadata

Labels

Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeMaintenanceDiscussion or action around maintaining pylint or the dev workflowMinor 💅Polishing pylint is always nice

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions