Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmeijboom/pre-commit
Pre-commit
https://github.com/dmeijboom/pre-commit
git go lint pre-commit test
Last synced: 21 days ago
JSON representation
Pre-commit
- Host: GitHub
- URL: https://github.com/dmeijboom/pre-commit
- Owner: dmeijboom
- Created: 2021-06-29T19:33:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-10T20:23:29.000Z (over 2 years ago)
- Last Synced: 2025-01-03T01:14:18.590Z (23 days ago)
- Topics: git, go, lint, pre-commit, test
- Language: Rust
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
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` |