opendatateam / udata

Customizable and skinnable social platform dedicated to open data.
http://udata.readthedocs.org
GNU Affero General Public License v3.0
240 stars 88 forks source link

Introduce pylint or black in pre-commit hook combined with pyflake8? #2714

Open ThomasG77 opened 2 years ago

ThomasG77 commented 2 years ago

On contributing guide e.g https://github.com/opendatateam/udata/blob/master/CONTRIBUTING.md#python-style-guide, there is a mention about using Python style guide. When you follow the link, you find in the section of the Google Python style guide https://google.github.io/styleguide/pyguide.html#2-python-language-rules, there is a mention to Pylint

Run pylint over your code using this pylintrc.

When I run it e.g wget https://google.github.io/styleguide/pylintrc;pylint udata, I see there are numerous issues (24680)

Pylint could be combined with flake8

Alternative could be about using black + flake8 http://www.locallyoptimal.com/blog/2019/08/23/why-you-should-use-black-for-your-python-style-linting/

Reasoning borrowed from https://github.com/microsoft/presidio/issues/317 and http://www.locallyoptimal.com/blog/2019/08/23/why-you-should-use-black-for-your-python-style-linting/

I do not have a personal preference as long as a Python coding style can be enforced for consistency.

maudetes commented 2 years ago

Agreed with the need for better code consistency. @quaxsze, is there any history on using a pre-commit hook for linting?