wemake-services / wemake-python-styleguide

The strictest and most opinionated python linter ever!
https://wemake-python-styleguide.rtfd.io
MIT License
2.55k stars 378 forks source link

Disallowing `__all__` in WPS410 is not justified, nor is it customizable #3060

Open webknjaz opened 1 month ago

webknjaz commented 1 month ago

What's wrong

https://wemake-python-styleguide.rtfd.io/en/latest/pages/usage/violations/best_practices.html#wemake_python_styleguide.violations.best_practices.WrongModuleMetadataViolation says this rule is about packaging metadata, however MODULE_METADATA_VARIABLES_BLACKLIST includes __all__ which cannot be fixed by following the recommendation of sticking its value into pyproject.toml since its function is fundamentally different.

__all__ is used in runtime and for Sphinx API doc generation. It does not hold what can be referred to as “metadata”.

How it should be

If it's desired to disallow __all__ for some reason, that reason should be stated explicitly and be its own rule. If it's to be kept in the same rule, that rule's justification needs to be updated and the list of disallowed names made customizable through a flake8 setting.

It should be possible to use __all__ to declare what's “public API” of a module without having to stick noqa in every single place or disabling the rule entirely.

Flake8 version and plugins

N/A

pip information

N/A

OS information

N/A

sobolevn commented 1 month ago

It should respect --i-control-code 👍

webknjaz commented 1 month ago

How?