From ddc74670587b8e09d17a742a6aaef259cea6672f Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 31 Jul 2020 17:58:53 +0200 Subject: [PATCH 1/5] src: fix linter failures Fix linter failures when running the linter on all source files. --- src/api/hooks.cc | 2 +- src/inspector/main_thread_interface.cc | 2 +- src/node_report.cc | 4 +--- src/quic/node_quic_session.cc | 1 - src/quic/node_quic_socket.cc | 1 - src/quic/node_quic_socket.h | 2 -- 6 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/api/hooks.cc b/src/api/hooks.cc index 037bdda6f41c82..2eb4c146a7d723 100644 --- a/src/api/hooks.cc +++ b/src/api/hooks.cc @@ -10,10 +10,10 @@ using v8::HandleScope; using v8::Integer; using v8::Isolate; using v8::Local; +using v8::NewStringType; using v8::Object; using v8::String; using v8::Value; -using v8::NewStringType; void RunAtExit(Environment* env) { env->RunAtExitCallbacks(); diff --git a/src/inspector/main_thread_interface.cc b/src/inspector/main_thread_interface.cc index a15cd52d239e40..0cf75a37146729 100644 --- a/src/inspector/main_thread_interface.cc +++ b/src/inspector/main_thread_interface.cc @@ -14,8 +14,8 @@ namespace node { namespace inspector { namespace { -using v8_inspector::StringView; using v8_inspector::StringBuffer; +using v8_inspector::StringView; template class DeletableWrapper : public Deletable { diff --git a/src/node_report.cc b/src/node_report.cc index c93e03afe63918..e7bfe7fef09d14 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -43,13 +43,11 @@ using v8::HeapSpaceStatistics; using v8::HeapStatistics; using v8::Isolate; using v8::Local; -using v8::Number; using v8::Object; -using v8::StackTrace; using v8::String; using v8::TryCatch; -using v8::Value; using v8::V8; +using v8::Value; namespace per_process = node::per_process; diff --git a/src/quic/node_quic_session.cc b/src/quic/node_quic_session.cc index 041c601a3c3268..8857a56a60d219 100644 --- a/src/quic/node_quic_session.cc +++ b/src/quic/node_quic_session.cc @@ -43,7 +43,6 @@ using crypto::SecureContext; using v8::Array; using v8::ArrayBufferView; using v8::Context; -using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; diff --git a/src/quic/node_quic_socket.cc b/src/quic/node_quic_socket.cc index ae0847d8d27bd9..8005b5d8099e5f 100644 --- a/src/quic/node_quic_socket.cc +++ b/src/quic/node_quic_socket.cc @@ -29,7 +29,6 @@ using crypto::EntropySource; using crypto::SecureContext; using v8::ArrayBufferView; -using v8::Boolean; using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; diff --git a/src/quic/node_quic_socket.h b/src/quic/node_quic_socket.h index f108eb47901b81..5b071c41b898df 100644 --- a/src/quic/node_quic_socket.h +++ b/src/quic/node_quic_socket.h @@ -27,10 +27,8 @@ namespace node { using v8::Context; -using v8::FunctionCallbackInfo; using v8::Local; using v8::Object; -using v8::Value; namespace quic { From 22c467d5ae4c505a2e61b6bcba644a72a8513ecc Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 31 Jul 2020 17:59:38 +0200 Subject: [PATCH 2/5] 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: https://github.com/nodejs/node/pull/34565 --- tools/checkimports.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/checkimports.py b/tools/checkimports.py index 609a75f542748f..21407573de091c 100755 --- a/tools/checkimports.py +++ b/tools/checkimports.py @@ -5,7 +5,7 @@ import io import re import sys - +import itertools def do_exist(file_name, lines, imported): if not any(not re.match('using \w+::{0};'.format(imported), line) and @@ -41,5 +41,10 @@ def is_valid(file_name): return valid if __name__ == '__main__': - files = glob.iglob(sys.argv[1] if len(sys.argv) > 1 else 'src/*.cc') + if len(sys.argv) > 1: + files = [] + for pattern in sys.argv[1:]: + files = itertools.chain(files, glob.iglob(pattern)) + else: + files = glob.iglob('src/*.cc') sys.exit(0 if all(map(is_valid, files)) else 1) From 37f2d44e8ca749a07aa8f2ff8bc28a75e8056736 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 3 Aug 2020 06:37:12 -0400 Subject: [PATCH 3/5] temp debug --- tools/checkimports.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/checkimports.py b/tools/checkimports.py index 21407573de091c..275d325dd7cc8a 100755 --- a/tools/checkimports.py +++ b/tools/checkimports.py @@ -16,6 +16,7 @@ def do_exist(file_name, lines, imported): def is_valid(file_name): + print("Processing '{0}'...".format(file_name)) with io.open(file_name, encoding='utf-8') as source_file: lines = [line.strip() for line in source_file] From 98872a987abbe4944a3a5c6e5fc901446b2cb8ac Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 3 Aug 2020 06:46:55 -0400 Subject: [PATCH 4/5] fixup! temp debug --- tools/checkimports.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/checkimports.py b/tools/checkimports.py index 275d325dd7cc8a..20e0d7692e8efc 100755 --- a/tools/checkimports.py +++ b/tools/checkimports.py @@ -46,6 +46,7 @@ def is_valid(file_name): files = [] for pattern in sys.argv[1:]: files = itertools.chain(files, glob.iglob(pattern)) + print(files) else: files = glob.iglob('src/*.cc') sys.exit(0 if all(map(is_valid, files)) else 1) From 0f8778ce355a598288c85270f46e5115109001ab Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 3 Aug 2020 07:09:22 -0400 Subject: [PATCH 5/5] fixup! temp debug --- tools/checkimports.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/checkimports.py b/tools/checkimports.py index 20e0d7692e8efc..85e247a5bfc777 100755 --- a/tools/checkimports.py +++ b/tools/checkimports.py @@ -46,7 +46,7 @@ def is_valid(file_name): files = [] for pattern in sys.argv[1:]: files = itertools.chain(files, glob.iglob(pattern)) - print(files) + print(sys.argv[1:]) else: files = glob.iglob('src/*.cc') - sys.exit(0 if all(map(is_valid, files)) else 1) + sys.exit(0 if all(list(map(is_valid, files))) else 1)