Skip to content
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

tools: fix C++ import checker argument expansion #34582

Closed

Conversation

addaleax
Copy link
Member

src: fix linter failures

Fix linter failures when running the linter on all source files.

tools: fix C++ import checker argument expansion

Makefile assumes that it can pass a list of files to the import
checker, whereas the import checker expects a single argument
that is interpreted as a blob.

Fix that mismatch by accepting multiple arguments in the import
checker.

Refs: #34565

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Fix linter failures when running the linter on all source files.
Makefile assumes that it can pass a list of files to the import
checker, whereas the import checker expects a single argument
that is interpreted as a blob.

Fix that mismatch by accepting multiple arguments in the import
checker.

Refs: nodejs#34565
@addaleax addaleax requested a review from a team July 31, 2020 16:04
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jul 31, 2020
@richardlau
Copy link
Member

There's still some sort of weirdness going on. The lint-cpp job from the linter workflow is failing for this PR:

Run make lint-cpp
  make lint-cpp
  shell: /bin/bash -e {0}
  env:
    PYTHON_VERSION: 3.8
    NODE_VERSION: 10.x
    pythonLocation: /opt/hostedtoolcache/Python/3.8.5/x64
Running C++ linter...
using statements aren't sorted in 'test/addons/repl-domain-abort/binding.cc'.
	Line 28: Actual: v8::Local, Expected: v8::Isolate
	Line 29: Actual: v8::Isolate, Expected: v8::Local
Makefile:1337: recipe for target 'tools/.cpplintstamp' failed
make: *** [tools/.cpplintstamp] Error 1
##[error]Process completed with exit code 2.

but I'm seeing more failures when I run against a fresh clone locally:

-bash-4.2$ ls
-bash-4.2$ git clone https://github.com/addaleax/node -b fix-cpp-import-check-weirdness --depth=1
Cloning into 'node'...
remote: Enumerating objects: 32499, done.
remote: Counting objects: 100% (32499/32499), done.
remote: Compressing objects: 100% (27110/27110), done.
remote: Total 32499 (delta 7011), reused 14193 (delta 4235), pack-reused 0
Receiving objects: 100% (32499/32499), 74.99 MiB | 2.49 MiB/s, done.
Resolving deltas: 100% (7011/7011), done.
Checking out files: 100% (32854/32854), done.
-bash-4.2$ cd node/
-bash-4.2$ git rev-parse HEAD
22c467d5ae4c505a2e61b6bcba644a72a8513ecc
-bash-4.2$ make lint-cpp
Running C++ linter...
using statements aren't sorted in 'test/addons/repl-domain-abort/binding.cc'.
        Line 28: Actual: v8::Local, Expected: v8::Isolate
        Line 29: Actual: v8::Isolate, Expected: v8::Local
File "test/addons/async-hooks-promise/binding.cc" does not use "NewStringType"
File "test/addons/dlopen-ping-pong/binding.cc" does not use "NewStringType"
using statements aren't sorted in 'test/addons/dlopen-ping-pong/binding.cc'.
        Line 19: Actual: v8::Object, Expected: v8::NewStringType
        Line 20: Actual: v8::NewStringType, Expected: v8::Object
File "test/addons/non-node-context/binding.cc" does not use "Function"
File "test/addons/non-node-context/binding.cc" does not use "FunctionTemplate"
File "test/addons/non-node-context/binding.cc" does not use "NewStringType"
File "test/addons/uv-handle-leak/binding.cc" does not use "Object"
using statements aren't sorted in 'test/cctest/test_util.cc'.
        Line 61: Actual: node::StringEqualNoCase, Expected: node::Calloc
        Line 72: Actual: node::StringEqualNoCaseN, Expected: node::Malloc
        Line 87: Actual: node::ToLower, Expected: node::MaybeStackBuffer
        Line 101: Actual: node::Malloc, Expected: node::MaybeStackBuffer
        Line 109: Actual: node::Calloc, Expected: node::SPrintF
        Line 117: Actual: node::UncheckedMalloc, Expected: node::StringEqualNoCase
        Line 125: Actual: node::UncheckedCalloc, Expected: node::StringEqualNoCaseN
        Line 134: Actual: node::MaybeStackBuffer, Expected: node::ToLower
        Line 214: Actual: node::MaybeStackBuffer, Expected: node::UncheckedCalloc
        Line 257: Actual: node::SPrintF, Expected: node::UncheckedMalloc
using statements aren't sorted in 'test/cctest/test_base64.cc'.
        Line 8: Actual: node::base64_encode, Expected: node::base64_decode
        Line 9: Actual: node::base64_decode, Expected: node::base64_encode
using statements aren't sorted in 'test/embedding/embedtest.cc'.
        Line 19: Actual: v8::Value, Expected: v8::V8
        Line 20: Actual: v8::V8, Expected: v8::Value
make: *** [tools/.cpplintstamp] Error 1
-bash-4.2$

@richardlau
Copy link
Member

Unfortunately it looks like Jenkins is currently broken (nodejs/build#2362 (comment) cc @nodejs/build-infra) -- would be interesting to see how the CI linter results tally.

@mmarchini mmarchini added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 1, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 1, 2020
@nodejs-github-bot
Copy link
Collaborator

tools/checkimports.py Outdated Show resolved Hide resolved
Co-authored-by: Richard Lau <riclau@uk.ibm.com>
@addaleax addaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. tools Issues and PRs related to the tools directory. labels Aug 3, 2020
@nodejs-github-bot
Copy link
Collaborator

@addaleax addaleax added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 6, 2020
@addaleax
Copy link
Member Author

addaleax commented Aug 6, 2020

I can do a manual backport

@nodejs-github-bot
Copy link
Collaborator

@jasnell
Copy link
Member

jasnell commented Aug 7, 2020

Landed in 93959b2...318c982

@jasnell jasnell closed this Aug 7, 2020
jasnell pushed a commit that referenced this pull request Aug 7, 2020
Fix linter failures when running the linter on all source files.

PR-URL: #34582
Refs: #34565
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
jasnell pushed a commit that referenced this pull request Aug 7, 2020
Makefile assumes that it can pass a list of files to the import
checker, whereas the import checker expects a single argument
that is interpreted as a blob.

Fix that mismatch by accepting multiple arguments in the import
checker.

Refs: #34565

PR-URL: #34582
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
addaleax added a commit that referenced this pull request Aug 8, 2020
Fix linter failures when running the linter on all source files.

PR-URL: #34582
Refs: #34565
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
addaleax added a commit that referenced this pull request Aug 8, 2020
Makefile assumes that it can pass a list of files to the import
checker, whereas the import checker expects a single argument
that is interpreted as a blob.

Fix that mismatch by accepting multiple arguments in the import
checker.

Refs: #34565

PR-URL: #34582
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@codebytere codebytere mentioned this pull request Aug 10, 2020
codebytere pushed a commit that referenced this pull request Aug 11, 2020
Fix linter failures when running the linter on all source files.

PR-URL: #34582
Refs: #34565
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
codebytere pushed a commit that referenced this pull request Aug 11, 2020
Makefile assumes that it can pass a list of files to the import
checker, whereas the import checker expects a single argument
that is interpreted as a blob.

Fix that mismatch by accepting multiple arguments in the import
checker.

Refs: #34565

PR-URL: #34582
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants