Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2021-09-05 15:59:24 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2021-09-07 16:54:10 +0300
commit2b131a50e0ec03e78b594ee7c157b7afbacb3be9 (patch)
treee38420d2d6ab636f9eea7de1313a0a77a3b301df /Makefile
parent77c81cbc4a43e6fea32c8ebb71c4c000fd86fba5 (diff)
build: add YAML linting
PR-URL: https://github.com/nodejs/node/pull/40007 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 22 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index cc0539d98e8..baae6a3b46b 100644
--- a/Makefile
+++ b/Makefile
@@ -1389,13 +1389,13 @@ cpplint: lint-cpp
.PHONY: lint-py-build
# python -m pip install flake8
-# Try with '--system' is to overcome systems that blindly set '--user'
+# Try with '--system' if it fails without; the system may have set '--user'
lint-py-build:
$(info Pip installing flake8 linter on $(shell $(PYTHON) --version)...)
$(PYTHON) -m pip install --upgrade -t tools/pip/site-packages flake8 || \
$(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages flake8
-ifneq ("","$(wildcard tools/pip/site-packages)")
+ifneq ("","$(wildcard tools/pip/site-packages/flake8)")
.PHONY: lint-py
# Lints the Python code with flake8.
# Flag the build if there are Python syntax errors or undefined names
@@ -1407,6 +1407,24 @@ lint-py:
$(warning Run 'make lint-py-build')
endif
+.PHONY: lint-yaml-build
+# python -m pip install yamllint
+# Try with '--system' if it fails without; the system may have set '--user'
+lint-yaml-build:
+ $(info Pip installing yamllint on $(shell $(PYTHON) --version)...)
+ $(PYTHON) -m pip install --upgrade -t tools/pip/site-packages yamllint || \
+ $(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages yamllint
+
+.PHONY: lint-yaml
+# Lints the YAML files with yamllint.
+lint-yaml:
+ @if [ -d "tools/pip/site-packages/yamllint" ]; then \
+ PYTHONPATH=tools/pip $(PYTHON) -m yamllint .; \
+ else \
+ echo 'YAML linting with yamllint is not available'; \
+ echo "Run 'make lint-yaml-build'"; \
+ fi
+
.PHONY: lint
.PHONY: lint-ci
ifneq ("","$(wildcard tools/node_modules/eslint/)")
@@ -1416,11 +1434,12 @@ lint: ## Run JS, C++, MD and doc linters.
$(MAKE) lint-cpp || EXIT_STATUS=$$? ; \
$(MAKE) lint-addon-docs || EXIT_STATUS=$$? ; \
$(MAKE) lint-md || EXIT_STATUS=$$? ; \
+ $(MAKE) lint-yaml || EXIT_STATUS=$$? ; \
exit $$EXIT_STATUS
CONFLICT_RE=^>>>>>>> [[:xdigit:]]+|^<<<<<<< [[:alpha:]]+
# Related CI job: node-test-linter
-lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs
+lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs lint-yaml-build lint-yaml
@if ! ( grep -IEqrs "$(CONFLICT_RE)" --exclude="error-message.js" benchmark deps doc lib src test tools ) \
&& ! ( $(FIND) . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \
exit 0 ; \