From ece9c5dc949f90c5f6f5f84e34a32234b4b91c5e Mon Sep 17 00:00:00 2001 From: Paul Fischer Date: Mon, 15 Feb 2021 18:24:30 +0100 Subject: [PATCH] updated pre-commit config and readme --- .pre-commit-hooks.yaml | 18 +++++++++++++----- README.md | 9 +++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 6f82139c..c9694c4e 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -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 diff --git a/README.md b/README.md index 8a5124c3..c1b25a2f 100644 --- a/README.md +++ b/README.md @@ -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