Skip to content

Commit

Permalink
Enforce jsonnet formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Dec 21, 2022
1 parent 5de33ab commit 1703eb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ gen-golden: ensure-prometheus docker-compose-down ping-postgres ## Update golden
@$(COMPOSE_CMD) $(compose_args) down

.PHONY: fmt
fmt: ## Run 'go fmt' against code
fmt: ## Run 'go fmt' and `jsonnetfmt` against code
go fmt ./...
find . \( -name '*.jsonnet' -o -name '*.libsonnet' \) -exec jsonnetfmt -i -- {} \;

.PHONY: vet
vet: ## Run 'go vet' against code
Expand Down
8 changes: 4 additions & 4 deletions pkg/db/seeds/promtest/common.libsonnet
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local formatLabels = function(labels)
local lf = std.join(', ', std.map(function(l) '%s="%s"' % [ l, labels[l] ], std.objectFields(labels)));
"{%s}" % [ lf ];
local lf = std.join(', ', std.map(function(l) '%s="%s"' % [l, labels[l]], std.objectFields(labels)));
'{%s}' % [lf];

local series = function(name, labels, values) {
series: name+formatLabels(labels),
series: name + formatLabels(labels),
values: values,
};

Expand All @@ -17,7 +17,7 @@ local test = function(name, series, query, samples) {
{
expr: query,
eval_time: '1h',
exp_samples: if std.isArray(samples) then samples else [ samples ],
exp_samples: if std.isArray(samples) then samples else [samples],
},
],
};
Expand Down

0 comments on commit 1703eb4

Please sign in to comment.