@@ -27,6 +27,7 @@ set msi=
2727set upload =
2828set licensertf =
2929set jslint =
30+ set cpplint =
3031set buildnodeweak =
3132set noetw =
3233set noetw_msi_arg =
@@ -57,7 +58,7 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok
5758if /i " %1 " == " noetw" set noetw = 1& goto arg-ok
5859if /i " %1 " == " noperfctr" set noperfctr = 1& goto arg-ok
5960if /i " %1 " == " licensertf" set licensertf = 1& goto arg-ok
60- if /i " %1 " == " test" set test_args = %test_args% doctool known_issues message parallel sequential addons -J& set jslint=1& set build_addons=1& goto arg-ok
61+ 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
6162if /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
6263if /i " %1 " == " test-addons" set test_args = %test_args% addons& set build_addons=1& goto arg-ok
6364if /i " %1 " == " test-simple" set test_args = %test_args% sequential parallel -J& goto arg-ok
@@ -67,10 +68,12 @@ if /i "%1"=="test-inspector" set test_args=%test_args% inspector&goto arg-ok
6768if /i " %1 " == " test-tick-processor" set test_args = %test_args% tick-processor& goto arg-ok
6869if /i " %1 " == " test-internet" set test_args = %test_args% internet& goto arg-ok
6970if /i " %1 " == " test-pummel" set test_args = %test_args% pummel& goto arg-ok
70- if /i " %1 " == " test-all" set test_args = %test_args% sequential parallel message gc inspector internet pummel& set buildnodeweak=1& set jslint=1& goto arg-ok
71+ 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
7172if /i " %1 " == " test-known-issues" set test_args = %test_args% known_issues& goto arg-ok
7273if /i " %1 " == " jslint" set jslint = 1& goto arg-ok
7374if /i " %1 " == " jslint-ci" set jslint_ci = 1& goto arg-ok
75+ if /i " %1 " == " lint" set cpplint = 1& set jslint=1& goto arg-ok
76+ if /i " %1 " == " lint-ci" set cpplint = 1& set jslint_ci=1& goto arg-ok
7477if /i " %1 " == " package" set package = 1& goto arg-ok
7578if /i " %1 " == " msi" set msi = 1& set licensertf=1& set download_arg=" --download=all" & set i18n_arg=small-icu& goto arg-ok
7679if /i " %1 " == " build-release" set build_release = 1& goto arg-ok
@@ -323,25 +326,67 @@ for /d %%F in (test\addons\??_*) do (
323326" %node_exe% " tools\doc\addon-verify.js
324327if %errorlevel% neq 0 exit /b %errorlevel%
325328:: building addons
326- SetLocal EnableDelayedExpansion
329+ setlocal EnableDelayedExpansion
327330for /d %%F in (test\addons\*) do (
328331 " %node_exe% " deps\npm\node_modules\node-gyp\bin\node-gyp rebuild ^
329332 --directory=" %%F " ^
330333 --nodedir=" %cd% "
331334 if !errorlevel! neq 0 exit /b !errorlevel!
332335)
333- EndLocal
336+ endlocal
334337goto run-tests
335338
336339:run-tests
337- if " %test_args% " == " " goto jslint
340+ if " %test_args% " == " " goto cpplint
338341if " %config% " == " Debug" set test_args = --mode=debug %test_args%
339342if " %config% " == " Release" set test_args = --mode=release %test_args%
340343echo running 'cctest %cctest_args% '
341344" %config% \cctest" %cctest_args%
342345call :run-python tools\test.py %test_args%
346+ goto cpplint
347+
348+ :cpplint
349+ if not defined cpplint goto jslint
350+ echo running cpplint
351+ set cppfilelist =
352+ setlocal enabledelayedexpansion
353+ for /f " tokens=*" %%G in ('dir /b /s /a src\*.c src\*.cc src\*.h ^
354+ test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h ^
355+ test\gc\binding.cc tools\icu\*.cc tools\icu\*.h') do (
356+ set relpath = %%G
357+ set relpath = !relpath:* %~dp0 =!
358+ call :add-to-list !relpath!
359+ )
360+ ( endlocal
361+ set cppfilelist = %localcppfilelist%
362+ )
363+ python tools/cpplint.py %cppfilelist%
364+ python tools/check-imports.py
343365goto jslint
344366
367+ :add-to-list
368+ echo %1 | findstr /c:" src\node_root_certs.h"
369+ if %errorlevel% equ 0 goto exit
370+
371+ echo %1 | findstr /c:" src\queue.h"
372+ if %errorlevel% equ 0 goto exit
373+
374+ echo %1 | findstr /c:" src\tree.h"
375+ if %errorlevel% equ 0 goto exit
376+
377+ @ rem skip subfolders under /src
378+ echo %1 | findstr /r /c:" src\\.*\\.*"
379+ if %errorlevel% equ 0 goto exit
380+
381+ echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.h"
382+ if %errorlevel% equ 0 goto exit
383+
384+ echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.cc"
385+ if %errorlevel% equ 0 goto exit
386+
387+ set " localcppfilelist = %localcppfilelist% %1 "
388+ goto exit
389+
345390:jslint
346391if defined jslint_ci goto jslint-ci
347392if not defined jslint goto exit
0 commit comments