1616# - mega-linter-runner
1717#
1818# ------------------------------------------
19-
20-
21-
2219# .PHONY: ensures target used rather than matching file name
2320# https://makefiletutorial.com/#phony
2421.PHONY : all lint deps dist pre-commit-check repl test clean
2522
26-
2723# ------- Makefile Variables --------- #
28-
2924# run help if no target specified
3025.DEFAULT_GOAL := help
3126
3227# Column the target description is printed from
3328HELP-DESCRIPTION-SPACING := 24
3429
30+ MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --release beta --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
31+
3532# Makefile file and directory name wildcard
3633# EDN-FILES := $(wildcard *.edn)
37-
3834# ------------------------------------ #
3935
40-
4136# ------- Help ----------------------- #
42-
4337# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
4438
4539help : # # Describe available tasks in Makefile
4640 @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
4741 sort | \
4842 awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
49-
5043# ------------------------------------ #
5144
52-
5345# ------- Clojure Development -------- #
54-
5546repl : # # Run Clojure REPL with rich terminal UI (Rebel Readline)
5647 $(info --------- Run Rebel REPL ---------)
5748 clojure -M:test/env:repl/reloaded
@@ -60,27 +51,21 @@ outdated: ## Check deps.edn & GitHub actions for new versions
6051 $(info --------- Search for outdated libraries ---------)
6152 clojure -T:search/outdated > outdated-$(date +"%y-%m-%d-%T" ) .org
6253
63-
6454# deps: deps.edn ## Prepare dependencies for test and dist targets
6555# $(info --------- Download test and service libraries ---------)
6656# clojure -P -X:build
6757
68-
6958# dist: deps build-uberjar ## Build and package Clojure service
7059# $(info --------- Build and Package Clojure service ---------)
7160
72-
7361# Remove files and directories after build tasks
7462# `-` before the command ignores any errors returned
7563clean : # # Clean build temporary files
7664 $(info --------- Clean Clojure classpath cache ---------)
7765 - rm -rf ./.cpcache
78-
7966# ------------------------------------ #
8067
81-
8268# ------- Testing -------------------- #
83-
8469# test-config: ## Print Kaocha test runner configuration
8570# $(info --------- Runner Configuration ---------)
8671# clojure -M:test/env:test/run --print-config
@@ -93,7 +78,6 @@ clean: ## Clean build temporary files
9378# $(info --------- Runner for unit tests ---------)
9479# clojure -X:test/env:test/run
9580
96-
9781# test-all: ## Run all unit tests regardless of failing tests
9882# $(info --------- Runner for all unit tests ---------)
9983# clojure -X:test/env:test/run :fail-fast? false
@@ -105,10 +89,8 @@ clean: ## Clean build temporary files
10589# test-watch-all: ## Run all tests when changes saved, regardless of failing tests
10690# $(info --------- Watcher for unit tests ---------)
10791# clojure -X:test/env:test/run :fail-fast? false :watch? true
108-
10992# ------------------------------------ #
11093
111-
11294# -------- Build tasks --------------- #
11395# build-config: ## Pretty print build configuration
11496# $(info --------- View current build config ---------)
@@ -125,45 +107,33 @@ clean: ## Clean build temporary files
125107# build-clean: ## Clean build assets or given directory
126108# $(info --------- Clean Build ---------)
127109# clojure -T:build clean
128-
129110# ------------------------------------ #
130111
131112# ------- Code Quality --------------- #
132-
133113pre-commit-check : format-check lint test # # Run format, lint and test targets
134114
135-
136115format-check : # # Run cljstyle to check the formatting of Clojure code
137116 $(info --------- cljstyle Runner ---------)
138117 cljstyle check
139118
140-
141119format-fix : # # Run cljstyle and fix the formatting of Clojure code
142120 $(info --------- cljstyle Runner ---------)
143121 cljstyle fix
144122
145123lint : # # Run MegaLinter with custom configuration (node.js required)
146124 $(info --------- MegaLinter Runner ---------)
147- npx mega-linter-runner --flavor java --release v7 --env " 'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
148-
149- lint-full : # # Run MegaLinter full image with custom configuration (node.js required)
150- $(info --------- MegaLinter Runner ---------)
151- npx mega-linter-runner --release v7 --env " 'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
125+ $(MEGALINTER_RUNNER )
152126
153- lint-beta : # # Run MegaLinter beta release with custom configuration (node.js required)
127+ lint-fix : # # Run MegaLinter with custom configuration (node.js required)
154128 $(info --------- MegaLinter Runner ---------)
155- npx mega-linter-runner --flavor java --release beta --env " 'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
156-
129+ $(MEGALINTER_RUNNER ) --fix
157130
158131lint-clean : # # Clean MegaLinter report information
159132 $(info --------- MegaLinter Clean Reports ---------)
160133 - rm -rf ./megalinter-reports
161-
162134# ------------------------------------ #
163135
164-
165136# ------- Docker Containers ---------- #
166-
167137# docker-build: ## Build Clojure Service with docker compose
168138# $(info --------- Docker Compose Build ---------)
169139# docker compose up --build
@@ -176,33 +146,26 @@ lint-clean: ## Clean MegaLinter report information
176146# $(info --------- Docker Compose Down ---------)
177147# docker-compose down
178148
179-
180149# swagger-editor: ## Start Swagger Editor in Docker
181150# $(info --------- Run Swagger Editor at locahost:8282 ---------)
182151# docker compose -f swagger-editor.yml up -d swagger-editor
183152
184153# swagger-editor-down: ## Stop Swagger Editor in Docker
185154# $(info --------- Run Swagger Editor at locahost:8282 ---------)
186155# docker compose -f swagger-editor.yml down
187-
188156# ------------------------------------ #
189157
190-
191158# ------ Continuous Integration ------ #
192-
193159# .DELETE_ON_ERROR: halts if command returns non-zero exit status
194160# https://makefiletutorial.com/#delete_on_error
195161
196-
197162# TODO: focus runner on ^:integration` tests
198163# test-ci: deps ## Test runner for integration tests
199164# $(info --------- Runner for integration tests ---------)
200165# clojure -P -X:test/env:test/run
201166
202-
203167# Run tests, build & package the Clojure code and clean up afterward
204168# `make all` used in Docker builder stage
205169# .DELETE_ON_ERROR:
206170# all: test-ci dist clean ## Call test-ci dist and clean targets, used for CI
207-
208171# ------------------------------------ #
0 commit comments