-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pre-commit hooks to the repo #212
Conversation
… description comment
Checks git commit messages with gitlint
README.md
Outdated
## Install pre-commit hooks | ||
|
||
In your SIMPA root directory run `pre-commit install` to set up the pre-commit hooks defined in `.pre-commit-config.yaml`. This will generate pre-commit hooks in `.git/hooks/` and run them for every commit. To run them manually before you commit, call `pre-commit run --all-files`. | ||
|
||
<details> | ||
<summary>Further information on pre-commit hooks</summary> | ||
|
||
### git config user email address checking | ||
The `git-config-email-check` hook is by default commented out in `pre-commit-config.yaml`. If you want to get a warning when you are not using a specified git config user email address domain, then you might want to comment this hook in. Then you would have to place a file according to the given path, e.g. at `.git/hooks/check-email.sh` with the following content: | ||
|
||
```shell | ||
#!/bin/bash | ||
PWD=`pwd` | ||
EMAIL=$(git config user.email) | ||
if [[ $EMAIL == *"@yourdomain.com"* ]]; then | ||
echo "[INFO] Verified email: $EMAIL" | ||
else | ||
echo "[ERROR] Invalid email: $EMAIL => Please configure the company email and retry." | ||
echo "Steps:" | ||
echo " cd $PWD" | ||
echo ' git config user.email "<user>@yourdomain.com"' | ||
echo "" | ||
exit 1; | ||
fi; | ||
``` | ||
|
||
Change the domain in lines 4 and 10 according to your specific domain (e.g. corporate email domain) or even whole email address. | ||
</details> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add this in the CONTRIBUTING.md file instead of the README.md
VERSION
Outdated
0.8.11 No newline at end of file | ||
0.8.12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this file anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good, great work, thank you! :) @TomTomRixRix
This PR installs the pre-commit hooks mentioned in
.pre-commit-config.yaml
. It also adds new GitHub Actions.🔶 pre-commit hooks
pyproject.toml
under[tool.autopep8]
license_header.txt
into python files if there was none.gitlint
file.git
folder. This hook is commented out by default but can be activated with instructions given in theREADME
GitHub Actions
🚀 Misc:
Note that some commits were only done to check that the hooks work properly. so squash merging this PR might make sense.
Partly addresses issue #165 and solves #193
Steps to be done before merging:
To be tested during review:
pyproject.toml