@@ -27,6 +27,7 @@ set msi=
27
27
set upload =
28
28
set licensertf =
29
29
set jslint =
30
+ set cpplint =
30
31
set build_testgc_addon =
31
32
set noetw =
32
33
set noetw_msi_arg =
@@ -58,7 +59,7 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok
58
59
if /i " %1 " == " noetw" set noetw = 1& goto arg-ok
59
60
if /i " %1 " == " noperfctr" set noperfctr = 1& goto arg-ok
60
61
if /i " %1 " == " licensertf" set licensertf = 1& goto arg-ok
61
- if /i " %1 " == " test" set test_args = %test_args% addons doctool known_issues message parallel sequential -J& set jslint=1& set build_addons=1& goto arg-ok
62
+ if /i " %1 " == " test" set test_args = %test_args% addons doctool known_issues message parallel sequential -J& set cpplint=1 & set jslint=1& set build_addons=1& goto arg-ok
62
63
if /i " %1 " == " test-ci" set test_args = %test_args% %test_ci_args% -p tap --logfile test.tap addons doctool inspector known_issues message sequential parallel& set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap& set build_addons=1& goto arg-ok
63
64
if /i " %1 " == " test-addons" set test_args = %test_args% addons& set build_addons=1& goto arg-ok
64
65
if /i " %1 " == " test-simple" set test_args = %test_args% sequential parallel -J& goto arg-ok
@@ -68,11 +69,13 @@ if /i "%1"=="test-inspector" set test_args=%test_args% inspector&goto arg-ok
68
69
if /i " %1 " == " test-tick-processor" set test_args = %test_args% tick-processor& goto arg-ok
69
70
if /i " %1 " == " test-internet" set test_args = %test_args% internet& goto arg-ok
70
71
if /i " %1 " == " test-pummel" set test_args = %test_args% pummel& goto arg-ok
71
- if /i " %1 " == " test-all" set test_args = %test_args% sequential parallel message gc inspector internet pummel& set build_testgc_addon=1& set jslint=1& goto arg-ok
72
+ if /i " %1 " == " test-all" set test_args = %test_args% sequential parallel message gc inspector internet pummel& set build_testgc_addon=1& set cpplint=1 & set jslint=1& goto arg-ok
72
73
if /i " %1 " == " test-known-issues" set test_args = %test_args% known_issues& goto arg-ok
73
74
if /i " %1 " == " test-node-inspect" set test_node_inspect = 1& goto arg-ok
74
75
if /i " %1 " == " jslint" set jslint = 1& goto arg-ok
75
76
if /i " %1 " == " jslint-ci" set jslint_ci = 1& goto arg-ok
77
+ if /i " %1 " == " lint" set cpplint = 1& set jslint=1& goto arg-ok
78
+ if /i " %1 " == " lint-ci" set cpplint = 1& set jslint_ci=1& goto arg-ok
76
79
if /i " %1 " == " package" set package = 1& goto arg-ok
77
80
if /i " %1 " == " msi" set msi = 1& set licensertf=1& set download_arg=" --download=all" & set i18n_arg=small-icu& goto arg-ok
78
81
if /i " %1 " == " build-release" set build_release = 1& set sign=1& goto arg-ok
@@ -323,14 +326,14 @@ for /d %%F in (test\addons\??_*) do (
323
326
" %node_exe% " tools\doc\addon-verify.js
324
327
if %errorlevel% neq 0 exit /b %errorlevel%
325
328
:: building addons
326
- SetLocal EnableDelayedExpansion
329
+ setlocal EnableDelayedExpansion
327
330
for /d %%F in (test\addons\*) do (
328
331
" %node_exe% " deps\npm\node_modules\node-gyp\bin\node-gyp rebuild ^
329
332
--directory=" %%F " ^
330
333
--nodedir=" %cd% "
331
334
if !errorlevel! neq 0 exit /b !errorlevel!
332
335
)
333
- EndLocal
336
+ endlocal
334
337
goto run-tests
335
338
336
339
:run-tests
@@ -340,15 +343,57 @@ set USE_EMBEDDED_NODE_INSPECT=1
340
343
goto node-tests
341
344
342
345
:node-tests
343
- if " %test_args% " == " " goto jslint
346
+ if " %test_args% " == " " goto cpplint
344
347
if " %config% " == " Debug" set test_args = --mode=debug %test_args%
345
348
if " %config% " == " Release" set test_args = --mode=release %test_args%
346
349
echo running 'cctest %cctest_args% '
347
350
" %config% \cctest" %cctest_args%
348
351
echo running 'python tools\test.py %test_args% '
349
352
python tools\test.py %test_args%
353
+ goto cpplint
354
+
355
+ :cpplint
356
+ if not defined cpplint goto jslint
357
+ echo running cpplint
358
+ set cppfilelist =
359
+ setlocal enabledelayedexpansion
360
+ for /f " tokens=*" %%G in ('dir /b /s /a src\*.c src\*.cc src\*.h ^
361
+ test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h ^
362
+ test\gc\binding.cc tools\icu\*.cc tools\icu\*.h') do (
363
+ set relpath = %%G
364
+ set relpath = !relpath:* %~dp0 =!
365
+ call :add-to-list !relpath!
366
+ )
367
+ ( endlocal
368
+ set cppfilelist = %localcppfilelist%
369
+ )
370
+ python tools/cpplint.py %cppfilelist%
371
+ python tools/check-imports.py
350
372
goto jslint
351
373
374
+ :add-to-list
375
+ echo %1 | findstr /c:" src\node_root_certs.h"
376
+ if %errorlevel% equ 0 goto exit
377
+
378
+ echo %1 | findstr /c:" src\queue.h"
379
+ if %errorlevel% equ 0 goto exit
380
+
381
+ echo %1 | findstr /c:" src\tree.h"
382
+ if %errorlevel% equ 0 goto exit
383
+
384
+ @ rem skip subfolders under /src
385
+ echo %1 | findstr /r /c:" src\\.*\\.*"
386
+ if %errorlevel% equ 0 goto exit
387
+
388
+ echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.h"
389
+ if %errorlevel% equ 0 goto exit
390
+
391
+ echo %1 | findstr /r /c:" test\\addons\\[0-9].*_.*\.cc"
392
+ if %errorlevel% equ 0 goto exit
393
+
394
+ set " localcppfilelist = %localcppfilelist% %1 "
395
+ goto exit
396
+
352
397
:jslint
353
398
if defined jslint_ci goto jslint-ci
354
399
if not defined jslint goto exit
0 commit comments