Skip to content

Commit ab0064c

Browse files
committed
Move lint and fix targets to bottom of file
This way we can keep the {{ if .$file }} under one block instead of sprawled all over the place. I needed to add the _lint target so we continue to have `lint` be the default target, this is unfortunate but I think worth it. Signed-off-by: Manuel Mendez <[email protected]>
1 parent cc3b58a commit ab0064c

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

Makefile

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# BEGIN: lint-install .
33
# http://github.com/tinkerbell/lint-install
44

5+
.PHONY: lint
6+
lint: _lint
7+
58
GOLINT_VERSION ?= v1.42.1
69
HADOLINT_VERSION ?= v2.7.0
710
SHELLCHECK_VERSION ?= v0.7.2
@@ -21,18 +24,6 @@ endif
2124
GOLINT_CONFIG = $(LINT_ROOT)/.golangci.yml
2225
YAMLLINT_ROOT = out/linters/yamllint-$(YAMLLINT_VERSION)
2326

24-
.PHONY: lint
25-
lint: out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH) out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) $(YAMLLINT_ROOT)/dist/bin/yamllint
26-
out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) run
27-
out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH) $(shell find . -name "*Dockerfile")
28-
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck $(shell find . -name "*.sh")
29-
PYTHONPATH=$(YAMLLINT_ROOT)/dist $(YAMLLINT_ROOT)/dist/bin/yamllint .
30-
31-
.PHONY: fix
32-
fix: out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH)
33-
out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) run --fix
34-
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck $(shell find . -name "*.sh") -f diff | { read -t 1 line || exit 0; { echo "$$line" && cat; } | git apply -p2; }
35-
3627
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck:
3728
mkdir -p out/linters
3829
rm -rf out/linters/shellcheck-*
@@ -56,4 +47,16 @@ $(YAMLLINT_ROOT)/dist/bin/yamllint:
5647
rm -rf out/linters/yamllint-*
5748
curl -sSfL https://github.com/adrienverge/yamllint/archive/refs/tags/v$(YAMLLINT_VERSION).tar.gz | tar -C out/linters -zxf -
5849
cd $(YAMLLINT_ROOT) && pip3 install . -t dist
50+
.PHONY: _lint
51+
_lint: out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH) out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) $(YAMLLINT_ROOT)/dist/bin/yamllint
52+
out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) run
53+
out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH) $(shell find . -name "*Dockerfile")
54+
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck $(shell find . -name "*.sh")
55+
PYTHONPATH=$(YAMLLINT_ROOT)/dist $(YAMLLINT_ROOT)/dist/bin/yamllint .
56+
57+
.PHONY: fix
58+
fix: out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH)
59+
out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) run --fix
60+
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck $(shell find . -name "*.sh") -f diff | { read -t 1 line || exit 0; { echo "$$line" && cat; } | git apply -p2; }
61+
5962
# END: lint-install .

Makefile.tmpl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# BEGIN: lint-install {{.Args}}
33
# http://github.com/tinkerbell/lint-install
44

5+
.PHONY: lint
6+
lint: _lint
7+
58
{{ if .Go }}GOLINT_VERSION ?= v1.42.1{{ end }}
69
{{ if .Dockerfile}}HADOLINT_VERSION ?= v2.7.0{{ end }}
710
{{ if .Shell}}SHELLCHECK_VERSION ?= v0.7.2{{ end }}
@@ -21,16 +24,6 @@ endif
2124
{{ if .Go }}GOLINT_CONFIG = $(LINT_ROOT)/.golangci.yml{{ end }}
2225
{{ if .YAML }}YAMLLINT_ROOT = out/linters/yamllint-$(YAMLLINT_VERSION){{ end }}
2326

24-
.PHONY: lint
25-
lint: {{ if .Shell }}out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck {{ end }}{{ if .Dockerfile }}out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH) {{ end }}{{ if .Go}}out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) {{ end }}{{ if .YAML}}$(YAMLLINT_ROOT)/dist/bin/yamllint{{ end }}
26-
{{- range .LintCommands }}
27-
{{ .}}{{ end}}
28-
29-
.PHONY: fix
30-
fix: {{ if .Shell }}out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck {{ end }}{{ if .Go}}out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH){{ end }}
31-
{{- range .FixCommands }}
32-
{{ .}}{{ end}}
33-
3427
{{ if .Shell -}}
3528
out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck:
3629
mkdir -p out/linters
@@ -64,4 +57,14 @@ $(YAMLLINT_ROOT)/dist/bin/yamllint:
6457
cd $(YAMLLINT_ROOT) && pip3 install . -t dist
6558
{{ end -}}
6659

60+
.PHONY: _lint
61+
_lint: {{ if .Shell }}out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck {{ end }}{{ if .Dockerfile }}out/linters/hadolint-$(HADOLINT_VERSION)-$(LINT_ARCH) {{ end }}{{ if .Go}}out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH) {{ end }}{{ if .YAML}}$(YAMLLINT_ROOT)/dist/bin/yamllint{{ end }}
62+
{{- range .LintCommands }}
63+
{{ .}}{{ end}}
64+
65+
.PHONY: fix
66+
fix: {{ if .Shell }}out/linters/shellcheck-$(SHELLCHECK_VERSION)-$(LINT_ARCH)/shellcheck {{ end }}{{ if .Go}}out/linters/golangci-lint-$(GOLINT_VERSION)-$(LINT_ARCH){{ end }}
67+
{{- range .FixCommands }}
68+
{{ .}}{{ end}}
69+
6770
# END: lint-install {{.Args}}

0 commit comments

Comments
 (0)