-
Notifications
You must be signed in to change notification settings - Fork 1
/
core.check.jsonlint.mk
45 lines (37 loc) · 1.49 KB
/
core.check.jsonlint.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Adds a 'check-jsonlint' internal target to run 'jsonlint'
# over SF_JSONLINT_FILES (defaults to all committed and staged *.json files).
# The 'check-jsonlint' target is automatically added to the 'check' target via SF_CHECK_TARGETS.
#
# The jsonlint executable is lazy-found inside node_modules/.bin and $PATH.
# The arguments to the jsonlint executable can be changed via JSONLINT_ARGS.
#
# For convenience, specific files can be ignored
# via grep arguments given to SF_JSONLINT_FILES_IGNORE:
# SF_JSONLINT_FILES_IGNORE += \
# -e "^path/to/dir/" \
# -e "^path/to/file$" \
#
# NOTE transcrypted files are automatically ignored.
#
# ------------------------------------------------------------------------------
SF_IS_TRANSCRYPTED ?= false
JSONLINT = $(SUPPORT_FIRECLOUD_DIR)/bin/jsonlint
JSONLINT_ARGS += \
SF_JSONLINT_FILES_IGNORE += \
-e "^$$" \
$(SF_VENDOR_FILES_IGNORE) \
SF_JSONLINT_FILES += $(shell $(GIT_LS) . | \
$(GREP) -e "\\.json$$" | \
$(GREP) -Fvxf <($(SF_IS_TRANSCRYPTED) || [[ ! -x $(GIT_ROOT)/transcrypt ]] || $(GIT_ROOT)/transcrypt -l) | \
$(GREP) -Fvxf <($(GIT) config --file .gitmodules --get-regexp path | $(CUT) -d' ' -f2 || true) | \
$(GREP) -v $(SF_JSONLINT_FILES_IGNORE) | \
$(SED) "s/^/'/g" | \
$(SED) "s/$$/'/g")
SF_CHECK_TARGETS += \
check-jsonlint \
# ------------------------------------------------------------------------------
.PHONY: check-jsonlint
check-jsonlint:
[[ "$(words $(SF_JSONLINT_FILES))" = "0" ]] || { \
$(JSONLINT) $(JSONLINT_ARGS) $(SF_JSONLINT_FILES); \
}