@@ -1389,13 +1389,13 @@ cpplint: lint-cpp
1389
1389
1390
1390
.PHONY : lint-py-build
1391
1391
# python -m pip install flake8
1392
- # Try with '--system' is to overcome systems that blindly set '--user'
1392
+ # Try with '--system' if it fails without; the system may have set '--user'
1393
1393
lint-py-build :
1394
1394
$(info Pip installing flake8 linter on $(shell $(PYTHON ) --version) ...)
1395
1395
$(PYTHON ) -m pip install --upgrade -t tools/pip/site-packages flake8 || \
1396
1396
$(PYTHON ) -m pip install --upgrade --system -t tools/pip/site-packages flake8
1397
1397
1398
- ifneq ("","$(wildcard tools/pip/site-packages) ")
1398
+ ifneq ("","$(wildcard tools/pip/site-packages/flake8 ) ")
1399
1399
.PHONY : lint-py
1400
1400
# Lints the Python code with flake8.
1401
1401
# Flag the build if there are Python syntax errors or undefined names
@@ -1407,6 +1407,24 @@ lint-py:
1407
1407
$(warning Run 'make lint-py-build')
1408
1408
endif
1409
1409
1410
+ .PHONY : lint-yaml-build
1411
+ # python -m pip install yamllint
1412
+ # Try with '--system' if it fails without; the system may have set '--user'
1413
+ lint-yaml-build :
1414
+ $(info Pip installing yamllint on $(shell $(PYTHON ) --version) ...)
1415
+ $(PYTHON ) -m pip install --upgrade -t tools/pip/site-packages yamllint || \
1416
+ $(PYTHON ) -m pip install --upgrade --system -t tools/pip/site-packages yamllint
1417
+
1418
+ .PHONY : lint-yaml
1419
+ # Lints the YAML files with yamllint.
1420
+ lint-yaml :
1421
+ @if [ -d " tools/pip/site-packages/yamllint" ]; then \
1422
+ PYTHONPATH=tools/pip $(PYTHON ) -m yamllint . ; \
1423
+ else \
1424
+ echo ' YAML linting with yamllint is not available' ; \
1425
+ echo " Run 'make lint-yaml-build'" ; \
1426
+ fi
1427
+
1410
1428
.PHONY : lint
1411
1429
.PHONY : lint-ci
1412
1430
ifneq ("","$(wildcard tools/node_modules/eslint/) ")
@@ -1416,11 +1434,12 @@ lint: ## Run JS, C++, MD and doc linters.
1416
1434
$(MAKE ) lint-cpp || EXIT_STATUS=$$? ; \
1417
1435
$(MAKE ) lint-addon-docs || EXIT_STATUS=$$? ; \
1418
1436
$(MAKE ) lint-md || EXIT_STATUS=$$? ; \
1437
+ $(MAKE ) lint-yaml || EXIT_STATUS=$$? ; \
1419
1438
exit $$ EXIT_STATUS
1420
1439
CONFLICT_RE =^>>>>>>> [[:xdigit:]]+|^<<<<<<< [[:alpha:]]+
1421
1440
1422
1441
# Related CI job: node-test-linter
1423
- lint-ci : lint-js-ci lint-cpp lint-py lint-md lint-addon-docs
1442
+ lint-ci : lint-js-ci lint-cpp lint-py lint-md lint-addon-docs lint-yaml-build lint-yaml
1424
1443
@if ! ( grep -IEqrs " $( CONFLICT_RE) " --exclude=" error-message.js" benchmark deps doc lib src test tools ) \
1425
1444
&& ! ( $( FIND) . -maxdepth 1 -type f | xargs grep -IEqs " $( CONFLICT_RE) " ); then \
1426
1445
exit 0 ; \
0 commit comments