ruff icon indicating copy to clipboard operation
ruff copied to clipboard

D101 does not consider __all__

Open onerandomusername opened this issue 1 year ago • 1 comments

A class without a _ preceeding its name is not public unless included in __all__ when __all__ is defined.

For example, the following file should not raise a D101.

__all__ = ()


class Hello:
    ...

onerandomusername avatar Dec 02 '22 05:12 onerandomusername

Cool, this makes sense.

charliermarsh avatar Dec 02 '22 05:12 charliermarsh

"Publicity" is the case for all in the D1xx group, not just D101. If there is an __all__ in the module, only the items listed as part of it should receive these checks. See here for details.

henryborchers avatar May 04 '23 14:05 henryborchers

I'm working on this, but it requires some refactoring, since we can no longer track visibility as we iterate over the AST (since we might visit nodes before we see __all__).

charliermarsh avatar May 05 '23 03:05 charliermarsh

@charliermarsh BTW, I heard you on Talk Python. We need more people like you.

henryborchers avatar May 08 '23 14:05 henryborchers