Skip to content

Commit

Permalink
build: use generic names for linting tasks
Browse files Browse the repository at this point in the history
"jslint" is the name of a tool that actually is not used, which can
cause confusion.

Backport-PR-URL: #16297
PR-URL: #15272
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Alexey Orlenko <[email protected]>
  • Loading branch information
seishun authored and MylesBorins committed Oct 26, 2017
1 parent 1898779 commit 252d08a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 42 deletions.
38 changes: 22 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -753,23 +753,27 @@ bench-idle:
sleep 1
$(NODE) benchmark/idle_clients.js &

jslint:
lint-js:
@echo "Running JS linter..."
$(NODE) tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules --ext=.js,.md \
benchmark doc lib test tools

jslint-ci:
jslint: lint-js

lint-js-ci:
@echo "Running JS linter..."
$(NODE) tools/jslint.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
$(NODE) tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
benchmark doc lib test tools

CPPLINT_EXCLUDE ?=
CPPLINT_EXCLUDE += src/node_root_certs.h
CPPLINT_EXCLUDE += src/queue.h
CPPLINT_EXCLUDE += src/tree.h
CPPLINT_EXCLUDE += $(wildcard test/addons/??_*/*.cc test/addons/??_*/*.h)
jslint-ci: lint-js-ci

LINT_CPP_EXCLUDE ?=
LINT_CPP_EXCLUDE += src/node_root_certs.h
LINT_CPP_EXCLUDE += src/queue.h
LINT_CPP_EXCLUDE += src/tree.h
LINT_CPP_EXCLUDE += $(wildcard test/addons/??_*/*.cc test/addons/??_*/*.h)

CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard \
LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
src/*.c \
src/*.cc \
src/*.h \
Expand All @@ -781,19 +785,21 @@ CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard \
tools/icu/*.h \
))

cpplint:
lint-cpp:
@echo "Running C++ linter..."
@$(PYTHON) tools/cpplint.py $(CPPLINT_FILES)
@$(PYTHON) tools/cpplint.py $(LINT_CPP_FILES)
@$(PYTHON) tools/check-imports.py

cpplint: lint-cpp

ifneq ("","$(wildcard tools/eslint/)")
lint:
@EXIT_STATUS=0 ; \
$(MAKE) jslint || EXIT_STATUS=$$? ; \
$(MAKE) cpplint || EXIT_STATUS=$$? ; \
$(MAKE) lint-js || EXIT_STATUS=$$? ; \
$(MAKE) lint-cpp || EXIT_STATUS=$$? ; \
exit $$EXIT_STATUS
CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+
lint-ci: jslint-ci cpplint
lint-ci: lint-js-ci lint-cpp
@if ! ( grep -IEqrs "$(CONFLICT_RE)" benchmark deps doc lib src test tools ) \
&& ! ( find . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \
exit 0 ; \
Expand All @@ -811,13 +817,13 @@ lint:
lint-ci: lint
endif

.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean \
.PHONY: lint lint-cpp lint-js bench clean docopen docclean doc dist distclean \
check uninstall install install-includes install-bin all staticlib \
dynamiclib test test-all test-addons test-addons-clean build-addons \
website-upload pkg blog blogclean tar binary release-only \
bench-http-simple bench-idle bench-all bench bench-misc bench-array \
bench-buffer bench-net bench-http bench-fs bench-tls cctest run-ci \
test-v8 test-v8-intl test-v8-benchmarks test-v8-all v8 lint-ci \
bench-ci jslint-ci doc-only $(TARBALL)-headers test-ci test-ci-native \
bench-ci lint-js-ci doc-only $(TARBALL)-headers test-ci test-ci-native \
test-ci-js build-ci test-hash-seed clear-stalled

4 changes: 2 additions & 2 deletions tools/jslint.js → tools/lint-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if (cluster.isMaster) {
throw new Error('Bad parallel job count');
}

// Check for custom JSLint report formatter
// Check for custom ESLint report formatter
i = process.argv.indexOf('-f');
if (i !== -1) {
if (!process.argv[i + 1])
Expand All @@ -77,7 +77,7 @@ if (cluster.isMaster) {
formatter = cli.getFormatter();
}

// Check if outputting JSLint report to a file instead of stdout
// Check if outputting ESLint report to a file instead of stdout
i = process.argv.indexOf('-o');
if (i !== -1) {
if (!process.argv[i + 1])
Expand Down
51 changes: 27 additions & 24 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ set package=
set msi=
set upload=
set licensertf=
set jslint=
set cpplint=
set lint_js=
set lint_cpp=
set buildnodeweak=
set noetw=
set noetw_msi_arg=
Expand Down Expand Up @@ -58,7 +58,7 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok
if /i "%1"=="noetw" set noetw=1&goto arg-ok
if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok
if /i "%1"=="licensertf" set licensertf=1&goto arg-ok
if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons -J&set cpplint=1&set jslint=1&set build_addons=1&goto arg-ok
if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons -J&set lint_cpp=1&set lint_js=1&set build_addons=1&goto arg-ok
if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap doctool inspector known_issues message sequential parallel addons&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&goto arg-ok
if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok
if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok
Expand All @@ -68,13 +68,16 @@ if /i "%1"=="test-inspector" set test_args=%test_args% inspector&goto arg-ok
if /i "%1"=="test-tick-processor" set test_args=%test_args% tick-processor&goto arg-ok
if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok
if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok
if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc inspector internet pummel&set buildnodeweak=1&set cpplint=1&set jslint=1&goto arg-ok
if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc inspector internet pummel&set buildnodeweak=1&set lint_cpp=1&set lint_js=1&goto arg-ok
if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok
if /i "%1"=="jslint" set jslint=1&goto arg-ok
if /i "%1"=="jslint-ci" set jslint_ci=1&goto arg-ok
if /i "%1"=="cpplint" set cpplint=1&goto arg-ok
if /i "%1"=="lint" set cpplint=1&set jslint=1&goto arg-ok
if /i "%1"=="lint-ci" set cpplint=1&set jslint_ci=1&goto arg-ok
if /i "%1"=="lint-js" set lint_js=1&goto arg-ok
if /i "%1"=="jslint" set lint_js=1&goto arg-ok
if /i "%1"=="lint-js-ci" set lint_js_ci=1&goto arg-ok
if /i "%1"=="jslint-ci" set lint_js_ci=1&goto arg-ok
if /i "%1"=="lint-cpp" set lint_cpp=1&goto arg-ok
if /i "%1"=="cpplint" set lint_cpp=1&goto arg-ok
if /i "%1"=="lint" set lint_cpp=1&set lint_js=1&goto arg-ok
if /i "%1"=="lint-ci" set lint_cpp=1&set lint_js_ci=1&goto arg-ok
if /i "%1"=="package" set package=1&goto arg-ok
if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok
if /i "%1"=="build-release" set build_release=1&goto arg-ok
Expand Down Expand Up @@ -340,23 +343,23 @@ endlocal
goto run-tests

:run-tests
if "%test_args%"=="" goto cpplint
if "%test_args%"=="" goto lint-cpp
if "%config%"=="Debug" set test_args=--mode=debug %test_args%
if "%config%"=="Release" set test_args=--mode=release %test_args%
echo running 'cctest %cctest_args%'
"%config%\cctest" %cctest_args%
call :run-python tools\test.py %test_args%
goto cpplint
goto lint-cpp

:cpplint
if not defined cpplint goto jslint
call :run-cpplint src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h tools\icu\*.cc tools\icu\*.h
:lint-cpp
if not defined lint_cpp goto lint-js
call :run-lint-cpp src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h tools\icu\*.cc tools\icu\*.h
call :run-python tools/check-imports.py
goto jslint
goto lint-js

:run-cpplint
:run-lint-cpp
if "%*"=="" goto exit
echo running cpplint '%*'
echo running lint-cpp '%*'
set cppfilelist=
setlocal enabledelayedexpansion
for /f "tokens=*" %%G in ('dir /b /s /a %*') do (
Expand Down Expand Up @@ -393,17 +396,17 @@ if %errorlevel% equ 0 goto exit
set "localcppfilelist=%localcppfilelist% %1"
goto exit

:jslint
if defined jslint_ci goto jslint-ci
if not defined jslint goto exit
:lint-js
if defined lint_js_ci goto lint-js-ci
if not defined lint_js goto exit
if not exist tools\eslint goto no-lint
echo running jslint
echo running lint-js
%config%\node tools\eslint\bin\eslint.js --cache --rule "linebreak-style: 0" --rulesdir=tools\eslint-rules --ext=.js,.md benchmark doc lib test tools
goto exit

:jslint-ci
echo running jslint-ci
%config%\node tools\jslint.js -J -f tap -o test-eslint.tap benchmark doc lib test tools
:lint-js-ci
echo running lint-js-ci
%config%\node tools\lint-js.js -J -f tap -o test-eslint.tap benchmark doc lib test tools
goto exit

:no-lint
Expand Down

0 comments on commit 252d08a

Please sign in to comment.