https://github.com/dmeijboom/pre-commit
Pre-commit
https://github.com/dmeijboom/pre-commit
git go lint pre-commit test
Last synced: about 2 months ago
JSON representation
Pre-commit
- Host: GitHub
- URL: https://github.com/dmeijboom/pre-commit
- Owner: dmeijboom
- Created: 2021-06-29T19:33:25.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-26T20:27:06.000Z (over 1 year ago)
- Last Synced: 2025-02-15T08:13:26.340Z (over 1 year ago)
- Topics: git, go, lint, pre-commit, test
- Language: Rust
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pre-commit
### Introduction
Run checks before `git commit` so that your code doesn't suck. Note that the name `pre-commit` already exists, so I might
change the name of the project later on (any suggestions?).
### Goals
- Fast
- Customizable
- Easy to use
## Usage
Create a file in the root of the project called `pre-commit.json` and add some checks:
```json
{
"checks": [
{
"name": "Go Tests",
"cmd": "go test ./...",
"when": [
{
"glob": "*.go"
}
]
}
]
}
```
## Configuration
| Key | Type | Description |
|--------|-----------|---------------------------------------|
| checks | `[]Check` | A list of checks to run before commit |
### Type: `Check`
| Key | Type | Description | Example |
|------|----------|---------------------------|---------------|
| name | `string` | Display name of the check | Unittests |
| cmd | `string` | Command to run | go test ./... |
| when | `[]When` | Conditions to test | - |
### Type: `When`
Note that all conditions are validated against the changed files in the Git staging area.
| Key | Type | Description | Example |
|------|----------|--------------|---------|
| glob | `string` | Glob pattern | `*.go` |