summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2017-10-29 14:50:29 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2017-11-08 16:25:00 +0800
commiteebcb481c2d7476a111449ba55b7347e5a9883c2 (patch)
tree0f6a81edf5e4a4acef94c6c0ad1384d8047f709e /Makefile
parentda7b4a9d161d7b55b6c3b3adf56e32219e580412 (diff)
downloadandroid-node-v8-eebcb481c2d7476a111449ba55b7347e5a9883c2.tar.gz
android-node-v8-eebcb481c2d7476a111449ba55b7347e5a9883c2.tar.bz2
android-node-v8-eebcb481c2d7476a111449ba55b7347e5a9883c2.zip
tools: don't lint files that have not changed
PR-URL: https://github.com/nodejs/node/pull/16581 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 30 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index bc337ab96d..0611dd5188 100644
--- a/Makefile
+++ b/Makefile
@@ -974,6 +974,7 @@ bench-ci: bench
lint-md-clean:
$(RM) -r tools/remark-cli/node_modules
$(RM) -r tools/remark-preset-lint-node/node_modules
+ $(RM) tools/.*mdlintstamp
lint-md-build:
@if [ ! -d tools/remark-cli/node_modules ]; then \
@@ -983,10 +984,25 @@ lint-md-build:
echo "Markdown linter: installing remark-preset-lint-node into tools/"; \
cd tools/remark-preset-lint-node && ../../$(NODE) ../../$(NPM) install; fi
-lint-md: lint-md-build
- @echo "Running Markdown linter..."
- $(NODE) tools/remark-cli/cli.js -q -f \
- ./*.md doc src lib benchmark tools/doc/ tools/icu/
+LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu
+LINT_MD_ROOT_DOCS := $(wildcard *.md)
+LINT_MD_FILES := $(shell find $(LINT_MD_TARGETS) -type f \
+ -not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS)
+LINT_DOC_MD_FILES = $(shell ls doc/**/*.md)
+
+tools/.docmdlintstamp: $(LINT_DOC_MD_FILES)
+ @echo "Running Markdown linter on docs..."
+ @$(NODE) tools/remark-cli/cli.js -q -f $(LINT_DOC_MD_FILES)
+ @touch $@
+
+tools/.miscmdlintstamp: $(LINT_MD_FILES)
+ @echo "Running Markdown linter on misc docs..."
+ @$(NODE) tools/remark-cli/cli.js -q -f $(LINT_MD_FILES)
+ @touch $@
+
+tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
+
+lint-md: | lint-md-build tools/.mdlintstamp
LINT_JS_TARGETS = benchmark doc lib test tools
LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \
@@ -1048,10 +1064,13 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
# and the actual filename is generated so it won't match header guards
ADDON_DOC_LINT_FLAGS=-whitespace/ending_newline,-build/header_guard
-lint-cpp:
+lint-cpp: tools/.cpplintstamp
+
+tools/.cpplintstamp: $(LINT_CPP_FILES)
@echo "Running C++ linter..."
- @$(PYTHON) tools/cpplint.py $(LINT_CPP_FILES)
+ @$(PYTHON) tools/cpplint.py $?
@$(PYTHON) tools/check-imports.py
+ @touch $@
lint-addon-docs: test/addons/.docbuildstamp
@echo "Running C++ linter on addon docs..."
@@ -1087,6 +1106,10 @@ lint:
lint-ci: lint
endif
+lint-clean:
+ $(RM) tools/.*lintstamp
+ $(RM) .eslintcache
+
.PHONY: $(TARBALL)-headers \
all \
bench \
@@ -1127,6 +1150,7 @@ endif
install-bin \
install-includes \
lint \
+ lint-clean \
lint-ci \
lint-cpp \
lint-js \