updated pre-commit config and readme

This commit is contained in:
Paul Fischer 2021-02-15 18:24:30 +01:00 committed by Stanisław Barzowski
parent 1b7cbff4cd
commit ece9c5dc94
2 changed files with 22 additions and 5 deletions

View File

@ -1,7 +1,15 @@
# How to use pre-commit hook: https://pre-commit.com
- id: jsonnet-format
name: Format fix for jsonnet/libsonnet files
entry: jsonnetfmt -i
name: jsonnetfmt
description: Automatically format jsonnet files.
entry: jsonnetfmt
args: [-i]
language: golang
files: '\.(jsonnet|libsonnet)$'
additional_dependencies: [ "github.com/google/go-jsonnet/cmd/jsonnetfmt" ]
files: \.(jsonnet|libsonnet)$
minimum_pre_commit_version: 2.10.1
- id: jsonnet-lint
name: jsonnet-lint
description: Lint jsonnet files.
entry: jsonnet-lint
language: golang
files: \.(jsonnet|libsonnet)$
minimum_pre_commit_version: 2.10.1

View File

@ -25,6 +25,15 @@ It's also available on Homebrew:
brew install go-jsonnet
```
`jsonnetfmt` and `jsonnet-lint` are also available as [pre-commit](https://github.com/pre-commit/pre-commit) hooks. Example `.pre-commit-config.yaml`:
```yaml
- repo: https://github.com/google/go-jsonnet
rev: # ref you want to point at, e.g. v0.17.0
hooks:
- id: jsonnet-format
- id: jsonnet-lint
```
## Build instructions (go 1.11+)
```bash