mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
qa: Enforce JSON standard for GCT configs (#1526)
* qa: Enforce JSON lint for GCT configs * Makefile/GHA: Make output more verbose on success, clean duplicate PHONY and rid excess newlines * Makefile: Use printf for OS cross-compatibility output
This commit is contained in:
17
Makefile
17
Makefile
@@ -61,3 +61,20 @@ endif
|
||||
target/sqlboiler.json:
|
||||
mkdir -p $(@D)
|
||||
go run ./cmd/gen_sqlboiler_config/main.go $(CONFIG_FLAG) -outdir $(@D)
|
||||
|
||||
.PHONY: lint_configs
|
||||
lint_configs: check-jq
|
||||
@$(call sort-json,config_example.json)
|
||||
@$(call sort-json,testdata/configtest.json)
|
||||
|
||||
define sort-json
|
||||
@printf "Processing $(1)... "
|
||||
@jq '.exchanges |= sort_by(.name)' --indent 1 $(1) > $(1).temp && \
|
||||
(mv $(1).temp $(1) && printf "OK\n") || \
|
||||
(rm $(1).temp; printf "FAILED\n"; exit 1)
|
||||
endef
|
||||
|
||||
.PHONY: check-jq
|
||||
check-jq:
|
||||
@printf "Checking if jq is installed... "
|
||||
@command -v jq >/dev/null 2>&1 && { printf "OK\n"; } || { printf "FAILED. Please install jq to proceed.\n"; exit 1; }
|
||||
|
||||
Reference in New Issue
Block a user