Skip to content

Commit 7b82315

Browse files
committed
chore: improve dev linter
Signed-off-by: Emilien Escalle <[email protected]>
1 parent 1e35297 commit 7b82315

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,29 @@ help: ## Display help
44
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
55

66
lint: ## Execute linting
7+
$(call run_linter,)
8+
9+
lint-fix: ## Execute linting and fix
10+
$(call run_linter, \
11+
-e FIX_YAML_PRETTIER=true \
12+
-e FIX_MARKDOWN=true \
13+
-e FIX_MARKDOWN_PRETTIER=true \
14+
-e FIX_NATURAL_LANGUAGE=true)
15+
16+
define run_linter
717
DEFAULT_WORKSPACE="$(CURDIR)"; \
818
LINTER_IMAGE="linter:latest"; \
919
VOLUME="$$DEFAULT_WORKSPACE:$$DEFAULT_WORKSPACE"; \
10-
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --tag $$LINTER_IMAGE .; \
20+
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --tag $$LINTER_IMAGE .; \
1121
docker run \
1222
-e DEFAULT_WORKSPACE="$$DEFAULT_WORKSPACE" \
1323
-e FILTER_REGEX_INCLUDE="$(filter-out $@,$(MAKECMDGOALS))" \
24+
$(1) \
1425
-v $$VOLUME \
1526
--rm \
1627
$$LINTER_IMAGE
28+
endef
29+
1730

1831
#############################
1932
# Argument fix workaround

0 commit comments

Comments
 (0)