Establish a coding standards baseline for our Python code base
Similarly to what we did for Ruby (#17646 (closed), not enforced at the moment) and shell (!190 (merged), enforced in GitLab CI), it would be good to establish a coding standards baseline for our Python code base (not necessarily perfect), that would be encoded in such a way that:
- Developers can use a common configuration in their IDE for static analysis tools, linters, and automatic code formatters. Right now, my IDE is very unhappy about most of our Python code, because it has expectations that differ from our current practices.
- GitLab CI can ensure we don't regress wrt. said baseline.
- It's clear where we intentionally diverge from the best practices and code style encoded in the default configuration of linters and static analysis tools, and where it's a mistake.
- We can propose & discuss changes to our coding standards.
We could start very humbly, with a configuration that disables enough checks to be happy with the vast majority of our current code base. And then we can iterate.
What we already have: a GitLab CI job that runs bandit
on our Python code.
For now I'm only creating this issue because this idea was only tracked on sysadmin#17740 (closed), which I want to close eventually. I expect we'll figure out early 2023 whether this makes it onto our roadmap.