Some out-of-the-box hooks for pre-commit, and a github action to easily run all kind of hooks from github CI.
Add this to your .pre-commit-config.yaml
- repo: https://github.com/Kpler/kp-pre-commit-hooks.git
rev: v0.0.7 # Use the ref you want to point at
hooks:
- id: check-branch-linearity
- id: check-branch-name
- id: no-ephemeral-links
exclude: '\.md$'
Simply check that your branch doesn't not contain any merge compare to a target branch, main
by default.
It's a pre-push hook and will always run
To configure the target branch:
hooks:
- id: check-branch-linearity
args: [targetbranch]
Check that branch name is less than 70 characters It's a pre-push hook and will always run
Time is fleeting, we change services. Consequently to keep the code futureproof we don't want links to ephemeral thrid party stuff (slack, clubhouse, atlassian)
Generate the Open API spec from a Fast API. If it has changed, write the new one and fails. If not, succeeds.
Check that the Kafka schemas present in the schemas/
folder are consistent with the code.
This hook currently only supports the scala
language for now and relies on the presence of the sbt generateKafkaSchemas
command to re-generate and compare the schemas.
The implementation of the generateKafkaSchemas
is up to each project, but you can find an example of implementation in the template-kafka-stream-msk
project with the corresponding sbt command defined in the build.sbt
file
Add these lines in your .pre-commit-config.yaml
file to enable this pre-commit hook:
repos:
# [...]
- repo: https://github.com/Kpler/kp-pre-commit-hooks.git
rev: v0.22.0
hooks:
# [...]
- id: kafka-check-schemas
Hooks can be tried locally using try-repo
For example if I want to try check-branch-linearity
from another repo
I can do:
pre-commit try-repo path_to_this_repo/kp-pre-commit-hooks/ check-branch-linearity --hook-stage push --verbose