70 lines
1.7 KiB
Markdown
70 lines
1.7 KiB
Markdown
# Frog Collective's commit hooks
|
|
|
|
## Use these hooks
|
|
|
|
### Configure pre-commit
|
|
|
|
Add this repository to your .pre-commit-config.yaml file :
|
|
|
|
```yaml
|
|
repos:
|
|
- repo: https://git.frog-collective.com/frog-collective/commit-hooks.git
|
|
rev: 0.1
|
|
hooks:
|
|
- id: fc-path-convention
|
|
```
|
|
|
|
### Available Hooks
|
|
|
|
* fc-path-convention : Adri je te laisse mettre ici ce qu'il faut
|
|
|
|
## Test hooks
|
|
|
|
### Test the hooks command
|
|
|
|
You can install the hook command and test it without calling pre-commit by
|
|
installing a virtualenv, and thise package in it :
|
|
|
|
```
|
|
$ virtualenv .venv
|
|
$ source .venv/bin/activate
|
|
$ pip install -e .
|
|
```
|
|
|
|
Then you can test the hooks by running the 'fc-hooks' command :
|
|
|
|
```
|
|
$ fc-hooks TestBadFileName.py
|
|
TestBadFileName.py doesn't follow the naming convention
|
|
```
|
|
|
|
### Test hooks inside a repository
|
|
|
|
You can test the hooks in any repository, by using the pre-commit's 'try-repo'
|
|
command.
|
|
|
|
First, clone this repository :
|
|
|
|
``` $ git git@git.frog-collective.com:frog-collective/commit-hooks.git ```
|
|
|
|
Go to your repository, and try the hooks :
|
|
|
|
```
|
|
$ cd my-repo
|
|
$ pre-commit try-repo ../commit-hooks
|
|
|
|
===============================================================================
|
|
Using config:
|
|
===============================================================================
|
|
repos:
|
|
- repo: ../commit-hooks
|
|
rev: 5ca01ce3117dfc15baa68e31cf580601a3f12c9b
|
|
hooks:
|
|
- id: fc-path-convention
|
|
===============================================================================
|
|
[INFO] Installing environment for ../commit-hooks.
|
|
[INFO] Once installed this environment will be reused.
|
|
[INFO] This may take a few minutes...
|
|
Frog Collective path convention..........................................Passed
|
|
```
|