From ecbaa85d817eafcb9f8ab46a8856fb1c0d024b03 Mon Sep 17 00:00:00 2001 From: paulfantom <pawel@krupa.net.pl> Date: Tue, 24 Nov 2020 13:22:59 +0100 Subject: [PATCH] *: add jsonnet-lint to tooling Signed-off-by: paulfantom <pawel@krupa.net.pl> --- Makefile | 8 +++++++- scripts/go.mod | 2 +- scripts/go.sum | 2 ++ scripts/tools.go | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 754ba59a..198e1788 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,9 @@ EMBEDMD_BIN=$(BIN_DIR)/embedmd JB_BIN=$(BIN_DIR)/jb GOJSONTOYAML_BIN=$(BIN_DIR)/gojsontoyaml JSONNET_BIN=$(BIN_DIR)/jsonnet +JSONNETLINT_BIN=$(BIN_DIR)/jsonnet-lint JSONNETFMT_BIN=$(BIN_DIR)/jsonnetfmt -TOOLING=$(EMBEDMD_BIN) $(JB_BIN) $(GOJSONTOYAML_BIN) $(JSONNET_BIN) $(JSONNETFMT_BIN) +TOOLING=$(EMBEDMD_BIN) $(JB_BIN) $(GOJSONTOYAML_BIN) $(JSONNET_BIN) $(JSONNETLINT_BIN) $(JSONNETFMT_BIN) JSONNETFMT_ARGS=-n 2 --max-blank-lines 2 --string-style s --comment-style s @@ -36,6 +37,11 @@ fmt: $(JSONNETFMT_BIN) find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \ xargs -n 1 -- $(JSONNETFMT_BIN) $(JSONNETFMT_ARGS) -i +.PHONY: lint +lint: $(JSONNETLINT_BIN) vendor + find jsonnet/ -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \ + xargs -n 1 -- $(JSONNETLINT_BIN) -J vendor + .PHONY: test test: $(JB_BIN) $(JB_BIN) install diff --git a/scripts/go.mod b/scripts/go.mod index 59363cba..9c6c10c8 100644 --- a/scripts/go.mod +++ b/scripts/go.mod @@ -5,6 +5,6 @@ go 1.15 require ( github.com/brancz/gojsontoyaml v0.0.0-20200602132005-3697ded27e8c github.com/campoy/embedmd v1.0.0 - github.com/google/go-jsonnet v0.17.0 + github.com/google/go-jsonnet v0.17.1-0.20210101181740-31d71aaccda6 // 7 commits after 0.17.0. Needed by jsonnet linter github.com/jsonnet-bundler/jsonnet-bundler v0.4.0 ) diff --git a/scripts/go.sum b/scripts/go.sum index 1e2cedbd..08d45587 100644 --- a/scripts/go.sum +++ b/scripts/go.sum @@ -16,6 +16,8 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/google/go-jsonnet v0.17.0 h1:/9NIEfhK1NQRKl3sP2536b2+x5HnZMdql7x3yK/l8JY= github.com/google/go-jsonnet v0.17.0/go.mod h1:sOcuej3UW1vpPTZOr8L7RQimqai1a57bt5j22LzGZCw= +github.com/google/go-jsonnet v0.17.1-0.20210101181740-31d71aaccda6 h1:91EupyycmO5ctzKuWEZ9nX0Cal1NveMiWcXxmRtLyLQ= +github.com/google/go-jsonnet v0.17.1-0.20210101181740-31d71aaccda6/go.mod h1:sOcuej3UW1vpPTZOr8L7RQimqai1a57bt5j22LzGZCw= github.com/jsonnet-bundler/jsonnet-bundler v0.4.0 h1:4BKZ6LDqPc2wJDmaKnmYD/vDjUptJtnUpai802MibFc= github.com/jsonnet-bundler/jsonnet-bundler v0.4.0/go.mod h1:/by7P/OoohkI3q4CgSFqcoFsVY+IaNbzOVDknEsKDeU= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= diff --git a/scripts/tools.go b/scripts/tools.go index b6cba4f2..d5b67e32 100644 --- a/scripts/tools.go +++ b/scripts/tools.go @@ -8,6 +8,7 @@ import ( _ "github.com/brancz/gojsontoyaml" _ "github.com/campoy/embedmd" _ "github.com/google/go-jsonnet/cmd/jsonnet" + _ "github.com/google/go-jsonnet/cmd/jsonnet-lint" _ "github.com/google/go-jsonnet/cmd/jsonnetfmt" _ "github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb" ) -- GitLab