Skip to content

Commit 0b7cdb8

Browse files
committed
chore: add pint
1 parent 766beaf commit 0b7cdb8

File tree

5 files changed

+436
-399
lines changed

5 files changed

+436
-399
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
run: make --always-make vale && git diff --exit-code
2525
- name: Jsonnet linter
2626
run: make --always-make jsonnet-lint
27+
- name: YAML linter (Pint)
28+
run: make --always-make pint-lint
2729
- name: Unit tests
2830
run: make --always-make test
2931

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ MD_FILES = $(shell find . \( -type d -name '.vale' -o -type d -name 'vendor' \)
1010
MARKDOWNFMT_BIN=$(BIN_DIR)/markdownfmt
1111
VALE_BIN=$(BIN_DIR)/vale
1212
PROMTOOL_BIN=$(BIN_DIR)/promtool
13-
TOOLING=$(JB_BIN) $(JSONNETLINT_BIN) $(JSONNET_BIN) $(JSONNETFMT_BIN) $(PROMTOOL_BIN) $(GRAFANA_DASHBOARD_LINTER_BIN) $(MARKDOWNFMT_BIN) $(VALE_BIN)
13+
PINT_BIN=$(BIN_DIR)/pint
14+
TOOLING=$(JB_BIN) $(JSONNETLINT_BIN) $(JSONNET_BIN) $(JSONNETFMT_BIN) $(PROMTOOL_BIN) $(GRAFANA_DASHBOARD_LINTER_BIN) $(MARKDOWNFMT_BIN) $(VALE_BIN) $(PINT_BIN)
1415
JSONNETFMT_ARGS=-n 2 --max-blank-lines 2 --string-style s --comment-style s
1516
SRC_DIR ?=dashboards
1617
OUT_DIR ?=dashboards_out
@@ -44,7 +45,7 @@ $(OUT_DIR): $(JSONNET_BIN) $(JSONNET_VENDOR) mixin.libsonnet lib/dashboards.json
4445
@$(JSONNET_BIN) -J vendor -m $(OUT_DIR) lib/dashboards.jsonnet
4546

4647
.PHONY: lint
47-
lint: jsonnet-lint alerts-lint dashboards-lint vale
48+
lint: jsonnet-lint alerts-lint dashboards-lint vale pint-lint
4849

4950
.PHONY: jsonnet-lint
5051
jsonnet-lint: $(JSONNETLINT_BIN) $(JSONNET_VENDOR)
@@ -71,6 +72,15 @@ vale: $(VALE_BIN)
7172
@$(VALE_BIN) sync && \
7273
$(VALE_BIN) $(MD_FILES)
7374

75+
.PHONY: pint-lint
76+
pint-lint: generate $(PINT_BIN)
77+
@# Pint will not exit with a non-zero status code if there are linting issues.
78+
@output=$$($(PINT_BIN) -n -o -l WARN lint prometheus_alerts.yaml prometheus_rules.yaml 2>&1); \
79+
if [ -n "$$output" ]; then \
80+
echo "\n$$output"; \
81+
exit 1; \
82+
fi
83+
7484
.PHONY: clean
7585
clean:
7686
# Remove all files and directories ignored by git.

0 commit comments

Comments
 (0)