Please take a look at the following guides on writing code:
- PEP 8 Style Guide for Python
- Clone and navigate to the repository
cd ~/GitHub/issaloo
git clone git@github.com:issaloo/standard-code-quality-workflow.git
cd standard-code-quality-workflow- Install pdm globally
pip install pdm- Install general & development packages with pdm
pdm install --devℹ️ This will install packages pre-commit, commitizen, and gitlint
(Optional) Install only the general packages
pdm install- Activate the virtual environment
eval $(pdm venv activate)ℹ️ Virtual environment will use the same python version as the system
(Optional) Deactivate the virtual environment
deactivate-
Automate scripts (i.e., linting and autoformatting)
pre-commit install
-
Enforce template at commit with pre-commit
gitlint install-hook
-
Check if
commitizenis working- 🔎 Try using commitizen in command line
- Add files to staging
- Run commitizen
Or, if possible
git cz c
cz c
- ✅ You should get structured commits
- 🔎 Try using commitizen in command line
-
Check if
gitlintis working- 🔎 Try writing a bad commit
- Add files to staging
- Write a bad commit (e.g.,
git commit -m 'WIP: baD commit')
- ✅ You should get a question on whether to continue the commit.
- 🔎 Try writing a bad commit
-
Check if
pre-commitis working- 🔎
- Add files to staging, where at least one python file is not formatted well
- Run commitizen
Or, if possible
git cz c
cz c
- ✅ You should get automatic fixes to poorly formatted python files with some errors
ℹ️ Ctrl+C to exit commit template
- 🔎