opendatateam / udata

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

Lint and format code in CI and pre-commit #3085

Closed bolinocroustibat closed 1 month ago

bolinocroustibat commented 1 month ago

Remark 1: Since this PR is heavy, I suggest checking the changes/diff before the commit 6d1b9aa ("style: lint and format code and sort imports"), this commit being the one dedicated to lint and format the code and making the whole PR barely readable :)

Remark 2: I noticed the team might prefer single quotes (') over double quotes ("). Ruff/Flake8 default rule is to use double quotes, but we can configure a special rule for to use single quotes if the team prefers. In that case, we can either use a ruff.toml to specify this special formatting rule:

[format]
quote-style = "single"

...or a pyproject.toml config file if we want to use a general Python package config file (so the config file can be used for many other config, and/or for Python packaging):

[tool.ruff.format]
quote-style = "single"

Let me know if you want to add those special styles and/or any other, I can modify the code format accordingly in this same PR.