-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: add cpp linting to windows build #11856
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ set msi= | |
set upload= | ||
set licensertf= | ||
set jslint= | ||
set cpplint= | ||
set build_testgc_addon= | ||
set noetw= | ||
set noetw_msi_arg= | ||
|
@@ -58,7 +59,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% addons doctool known_issues message parallel sequential -J&set jslint=1&set build_addons=1&goto arg-ok | ||
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 | ||
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 | ||
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 | ||
|
@@ -68,11 +69,13 @@ 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 build_testgc_addon=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 build_testgc_addon=1&set cpplint=1&set jslint=1&goto arg-ok | ||
if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok | ||
if /i "%1"=="test-node-inspect" set test_node_inspect=1&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"=="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"=="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&set sign=1&goto arg-ok | ||
|
@@ -323,14 +326,14 @@ for /d %%F in (test\addons\??_*) do ( | |
"%node_exe%" tools\doc\addon-verify.js | ||
if %errorlevel% neq 0 exit /b %errorlevel% | ||
:: building addons | ||
SetLocal EnableDelayedExpansion | ||
setlocal EnableDelayedExpansion | ||
for /d %%F in (test\addons\*) do ( | ||
"%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild ^ | ||
--directory="%%F" ^ | ||
--nodedir="%cd%" | ||
if !errorlevel! neq 0 exit /b !errorlevel! | ||
) | ||
EndLocal | ||
endlocal | ||
goto run-tests | ||
|
||
:run-tests | ||
|
@@ -340,15 +343,57 @@ set USE_EMBEDDED_NODE_INSPECT=1 | |
goto node-tests | ||
|
||
:node-tests | ||
if "%test_args%"=="" goto jslint | ||
if "%test_args%"=="" goto cpplint | ||
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% | ||
echo running 'python tools\test.py %test_args%' | ||
python tools\test.py %test_args% | ||
goto cpplint | ||
|
||
:cpplint | ||
if not defined cpplint goto jslint | ||
echo running cpplint | ||
set cppfilelist= | ||
setlocal enabledelayedexpansion | ||
for /f "tokens=*" %%G in ('dir /b /s /a src\*.c src\*.cc src\*.h ^ | ||
test\addons\*.cc test\addons\*.h test\cctest\*.cc test\cctest\*.h ^ | ||
test\gc\binding.cc tools\icu\*.cc tools\icu\*.h') do ( | ||
set relpath=%%G | ||
set relpath=!relpath:*%~dp0=! | ||
call :add-to-list !relpath! | ||
) | ||
( endlocal | ||
set cppfilelist=%localcppfilelist% | ||
) | ||
python tools/cpplint.py %cppfilelist% | ||
python tools/check-imports.py | ||
goto jslint | ||
|
||
:add-to-list | ||
echo %1 | findstr /c:"src\node_root_certs.h" | ||
if %errorlevel% equ 0 goto exit | ||
|
||
echo %1 | findstr /c:"src\queue.h" | ||
if %errorlevel% equ 0 goto exit | ||
|
||
echo %1 | findstr /c:"src\tree.h" | ||
if %errorlevel% equ 0 goto exit | ||
|
||
@rem skip subfolders under /src | ||
echo %1 | findstr /r /c:"src\\.*\\.*" | ||
if %errorlevel% equ 0 goto exit | ||
|
||
echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.h" | ||
if %errorlevel% equ 0 goto exit | ||
|
||
echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.cc" | ||
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 | ||
|
@@ -362,6 +407,7 @@ echo running jslint-ci | |
%config%\node tools\jslint.js -J -f tap -o test-eslint.tap benchmark lib test tools | ||
goto exit | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary whitespace change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks I will correct this. |
||
:no-lint | ||
echo Linting is not available through the source tarball. | ||
echo Use the git repo instead: $ git clone https://github.com/nodejs/node.git | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No documented in line 420 :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in #12278