Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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` |