openwisp / openwisp/openwisp-docs
[developer] Add and explain pre-commit-hook
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 59
- Forks
- 73
- Avg merge
- 1h 1m
- Merged PRs (30d)
- 1
Description
In the past we had runflake8, runisort scripts all over the repos.
Now we don't have any script but I realize we may need to reintroduce a script for each repo because the flags passed to openwisp-qa-checks are slightly different for each repo.
This way we can have a run-qa-checks script for each repo and we can create pre-commit-hooks that run the script before each commit.
We can put the hook in each repo automatically as well as suggested here: https://stackoverflow.com/questions/3462955/putting-git-hooks-into-repository
The hook could be saved in openwisp-utils. Python packages could install it automatically in the setup.py script, eg:
- if the current directory is a git repository and if
pip install -e .is being called from within the project itself (eg: check the setup.py script and look for something unique in it) - then copy the pre-commit-hook from openwisp-utils and install it / symlink it, whatever
For non python packages we can do something similar as all the repos should have some kind of build/install script/procedure (if they don't have one, we must add one).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed setup.py installation path and inspect the pre-commit-hook location in openwisp-utils, along with the repo-specific run-qa-checks scripts described in the issue. Trace how Python and non-Python repositories currently install or build, then verify that the hook can be installed and invokes the appropriate checks for each repository.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100