Open Goldziher opened 3 weeks ago
3. Another rule would be to automatically order
__all__
This already exists as unsorted-dunder-all
in our ruff
category!
- Another rule would be to automatically order
__all__
This already exists as
unsorted-dunder-all
in ourruff
category!
oh I didn't notice. well that's nice.
- Another helpful rule is to detect declarations in all that are unused
This would require multifile analysis, which Ruff doesn't support today. Even then, the rule would be inherently unsafe for libraries where a symbol in __all__
might be imported by another application. But I do agree that knowing about "dead code" in general would be useful.
I would like to ask for a rule that requires an all list to be declared in each file where there are non-private members, and all the non-private members are listed in it.
Can you help me understand the motivation for explicitly requiring __all__
when all members are public? Or is __all__
only required if there's at least one private and one public member in the file?
Another rule might be to enforce private module members when no exported, or require they are in all if used outside
This also requires multifile analysis
Can you help me understand the motivation for explicitly requiring all when all members are public? Or is all only required if there's at least one private and one public member in the file?
Yes. It's a way to enforce modules with explicit public exports.
__all__
list to be declared in each file where there are non-private members, and all the non-private members are listed in it.__all__
that are unused3. Another rule would be to automatically order__all__
__all__
if used outside