appsembler / xblock-grade-fetcher

Grade Fetcher XBlock
MIT License
2 stars 1 forks source link

chore: adding pre-commit to run flake8 before pushing to remote #19

Closed amirtds closed 2 years ago

amirtds commented 2 years ago

I created this PR to run flake8 before we commit changes in the repo. It frequently happened to me that I made changes in the repo and pushed to the remote, and it doesn't pass our CI pipeline and I have to spend some time to fix the issues and commit again. To make this work we need to run pip install pre-commit and every time someone commits something flake8 run and checks the files. I think we can include isort and bandit too

thraxil commented 2 years ago

Why not just run tox? That will run flake8, unit tests, bandit, or anything else we enable.

amirtds commented 2 years ago

I tried to find a way to run tox on pre-commit but I couldn't find anything useful. I added bandit, black and Isort. If there is no way to add tox to pre-commit let's merge this.

thraxil commented 2 years ago

I tried to find a way to run tox on pre-commit but I couldn't find anything useful. I added bandit, black and Isort. If there is no way to add tox to pre-commit let's merge this.

I just put:

#!/bin/sh
tox .

into .git/hooks/pre-commit and that's always worked for me. I'm not really sure what the point is of the fancy pre-commit tool.