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

Checkimports #7

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/hooks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/inspector/main_thread_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace node {
namespace inspector {
namespace {

using v8_inspector::StringView;
using v8_inspector::StringBuffer;
using v8_inspector::StringView;

template <typename T>
class DeletableWrapper : public Deletable {
Expand Down
4 changes: 1 addition & 3 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion src/quic/node_quic_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/quic/node_quic_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/quic/node_quic_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
namespace node {

using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Local;
using v8::Object;
using v8::Value;

namespace quic {

Expand Down
13 changes: 10 additions & 3 deletions tools/checkimports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]

Expand All @@ -41,5 +42,11 @@ def is_valid(file_name):
return valid

if __name__ == '__main__':
files = glob.iglob(sys.argv[1] if len(sys.argv) > 1 else 'src/*.cc')
sys.exit(0 if all(map(is_valid, files)) else 1)
if len(sys.argv) > 1:
files = []
for pattern in sys.argv[1:]:
files = itertools.chain(files, glob.iglob(pattern))
print(sys.argv[1:])
else:
files = glob.iglob('src/*.cc')
sys.exit(0 if all(list(map(is_valid, files))) else 1)