tonybaloney / perflint

Python Linter for performance anti patterns
MIT License
659 stars 10 forks source link

`__all__` is erroneously flagged with W8301 #35

Closed cesarcoatl closed 8 months ago

cesarcoatl commented 2 years ago

Describe the bug

When pylinting my code perflint erroneously flags __all__ with W8301.

To reproduce

perflint.py

"""perflint test module."""

__all__ = ["dummy"]

def dummy() -> None:
    """Dummy docstring."""
    raise NotImplementedError

Run pylint:

$ pylint --load-plugin=perflint perflint.py
************* Module perflint
perflint.py:3:10: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)

------------------------------------------------------------------
Your code has been rated at 6.67/10 (previous run: 3.33/10, +3.33)

Expected behavior

__all__ should not be flagged.

While __all__ [...] must be a sequence of strings, and a tuple is a sequence, the standard is to declare __all__ as list[str].