Description
Describe the feature as you'd like to see it
Currently the only time the 'black' and 'isort' flows are used to tidy code to be committed is if its done manually by the dev prior to the commit bein done.
Linting via flake8 also has to be done manually but is included in the github checks when the branch is pushed
If these manual tasks (like make format) are not done it can leads to things like (but not limited to):
- unused imports left in
- unused variables left in
- long strings ie imports or chained expressions which can be hard to read/parse
- imports not grouped or sorted
What do we currently have to do now?
A better alternative is to use the pre-commit
package whic can run all these tools over the staged code and inplement tidying and cleanup via black
and isort
Additionally flake8
will lint your code and notify of issues which must be addressed before the commit is accepted
The interrogate
package is also useful when combined with pre-commit
as is forces cpmmenting of classes amd methods to be done.
We use pre-commit
on all our projects and find it to be an easy way to integrate tools to keep our code clean and readable and organised.
Additional context
@josephmancuso Im happy to put a PR together which basic setup for pre-commit
with the black, isort and flake8` modules
- Is this a breaking change?
No