cpplint: disallow comma-first in C++
authorFedor Indutny <fedor.indutny@gmail.com>
Wed, 16 Oct 2013 16:34:39 +0000 (20:34 +0400)
committerFedor Indutny <fedor.indutny@gmail.com>
Wed, 16 Oct 2013 20:34:18 +0000 (00:34 +0400)
12 files changed:
src/env-inl.h
src/handle_wrap.cc
src/node_contextify.cc
src/node_crypto.h
src/node_file.cc
src/node_http_parser.cc
src/node_stat_watcher.cc
src/node_zlib.cc
src/stream_wrap.cc
src/stream_wrap.h
src/udp_wrap.cc
tools/cpplint.py

index 6ab93c4..6fd6494 100644 (file)
@@ -52,14 +52,14 @@ inline void Environment::IsolateData::Put() {
 }
 
 inline Environment::IsolateData::IsolateData(v8::Isolate* isolate)
-    : event_loop_(uv_default_loop())
-    , isolate_(isolate)
+    : event_loop_(uv_default_loop()),
+      isolate_(isolate),
 #define V(PropertyName, StringValue)                                          \
-    , PropertyName ## _index_(                                                \
-        FIXED_ONE_BYTE_STRING(isolate, StringValue).Eternalize(isolate))
+    PropertyName ## _index_(                                                  \
+        FIXED_ONE_BYTE_STRING(isolate, StringValue).Eternalize(isolate)),
     PER_ISOLATE_STRING_PROPERTIES(V)
 #undef V
-    ref_count_(0) {
+    ref_count_(0) {
 }
 
 inline uv_loop_t* Environment::IsolateData::event_loop() const {
@@ -155,11 +155,11 @@ inline Environment* Environment::GetCurrentChecked(
 }
 
 inline Environment::Environment(v8::Local<v8::Context> context)
-    : isolate_(context->GetIsolate())
-    , isolate_data_(IsolateData::GetOrCreate(context->GetIsolate()))
-    , using_smalloc_alloc_cb_(false)
-    , using_domains_(false)
-    , context_(context->GetIsolate(), context) {
+    : isolate_(context->GetIsolate()),
+      isolate_data_(IsolateData::GetOrCreate(context->GetIsolate())),
+      using_smalloc_alloc_cb_(false),
+      using_domains_(false),
+      context_(context->GetIsolate(), context) {
   // We'll be creating new objects so make sure we've entered the context.
   v8::Context::Scope context_scope(context);
   v8::HandleScope handle_scope(isolate());
index 05d4c4d..d1c1324 100644 (file)
@@ -89,9 +89,9 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
 HandleWrap::HandleWrap(Environment* env,
                        Handle<Object> object,
                        uv_handle_t* handle)
-    : env_(env)
-    , flags_(0)
-    , handle__(handle) {
+    : env_(env),
+      flags_(0),
+      handle__(handle) {
   handle__->data = this;
   HandleScope scope(node_isolate);
   persistent().Reset(node_isolate, object);
index ca281df..f78f49f 100644 (file)
@@ -64,12 +64,12 @@ class ContextifyContext {
 
  public:
   explicit ContextifyContext(Environment* env, Local<Object> sandbox)
-      : env_(env)
-      , sandbox_(env->isolate(), sandbox)
-      , context_(env->isolate(), CreateV8Context(env))
-      , proxy_global_(env->isolate(), context()->Global())
+      : env_(env),
+        sandbox_(env->isolate(), sandbox),
+        context_(env->isolate(), CreateV8Context(env)),
+        proxy_global_(env->isolate(), context()->Global()),
         // Wait for sandbox_, proxy_global_, and context_ to die
-      , references_(3) {
+        references_(3) {
     sandbox_.MakeWeak(this, WeakCallback);
     sandbox_.MarkIndependent();
     context_.MakeWeak(this, WeakCallback);
index 772db95..01a4db8 100644 (file)
@@ -94,10 +94,10 @@ class SecureContext : public WeakObject {
   static void SetTicketKeys(const v8::FunctionCallbackInfo<v8::Value>& args);
 
   SecureContext(Environment* env, v8::Local<v8::Object> wrap)
-      : WeakObject(env->isolate(), wrap)
-      , ca_store_(NULL)
-      , ctx_(NULL)
-      , env_(env) {
+      : WeakObject(env->isolate(), wrap),
+        ca_store_(NULL),
+        ctx_(NULL),
+        env_(env) {
   }
 
   void FreeCTXMem() {
@@ -134,10 +134,10 @@ class SSLWrap {
   };
 
   SSLWrap(Environment* env, SecureContext* sc, Kind kind)
-      : env_(env)
-      , kind_(kind)
-      , next_sess_(NULL)
-      , session_callbacks_(false) {
+      : env_(env),
+        kind_(kind),
+        next_sess_(NULL),
+        session_callbacks_(false) {
     ssl_ = SSL_new(sc->ctx_);
     assert(ssl_ != NULL);
   }
@@ -285,11 +285,11 @@ class Connection : public SSLWrap<Connection>, public WeakObject {
              v8::Local<v8::Object> wrap,
              SecureContext* sc,
              SSLWrap<Connection>::Kind kind)
-      : SSLWrap<Connection>(env, sc, kind)
-      , WeakObject(env->isolate(), wrap)
-      , bio_read_(NULL)
-      , bio_write_(NULL)
-      , hello_offset_(0) {
+      : SSLWrap<Connection>(env, sc, kind),
+        WeakObject(env->isolate(), wrap),
+        bio_read_(NULL),
+        bio_write_(NULL),
+        hello_offset_(0) {
     hello_parser_.Start(SSLWrap<Connection>::OnClientHello,
                         OnClientHelloParseEnd,
                         this);
@@ -347,10 +347,10 @@ class CipherBase : public WeakObject {
   CipherBase(v8::Isolate* isolate,
              v8::Local<v8::Object> wrap,
              CipherKind kind)
-      : WeakObject(isolate, wrap)
-      , cipher_(NULL)
-      , initialised_(false)
-      , kind_(kind) {
+      : WeakObject(isolate, wrap),
+        cipher_(NULL),
+        initialised_(false),
+        kind_(kind) {
   }
 
   ~CipherBase() {
@@ -380,9 +380,9 @@ class Hmac : public WeakObject {
   static void HmacDigest(const v8::FunctionCallbackInfo<v8::Value>& args);
 
   Hmac(v8::Isolate* isolate, v8::Local<v8::Object> wrap)
-      : WeakObject(isolate, wrap)
-      , md_(NULL)
-      , initialised_(false) {
+      : WeakObject(isolate, wrap),
+        md_(NULL),
+        initialised_(false) {
   }
 
   ~Hmac() {
@@ -409,9 +409,9 @@ class Hash : public WeakObject {
   static void HashDigest(const v8::FunctionCallbackInfo<v8::Value>& args);
 
   Hash(v8::Isolate* isolate, v8::Local<v8::Object> wrap)
-      : WeakObject(isolate, wrap)
-      , md_(NULL)
-      , initialised_(false) {
+      : WeakObject(isolate, wrap),
+        md_(NULL),
+        initialised_(false) {
   }
 
   ~Hash() {
@@ -443,9 +443,9 @@ class Sign : public WeakObject {
   static void SignFinal(const v8::FunctionCallbackInfo<v8::Value>& args);
 
   Sign(v8::Isolate* isolate, v8::Local<v8::Object> wrap)
-      : WeakObject(isolate, wrap)
-      , md_(NULL)
-      , initialised_(false) {
+      : WeakObject(isolate, wrap),
+        md_(NULL),
+        initialised_(false) {
   }
 
   ~Sign() {
@@ -477,9 +477,9 @@ class Verify : public WeakObject {
   static void VerifyFinal(const v8::FunctionCallbackInfo<v8::Value>& args);
 
   Verify(v8::Isolate* isolate, v8::Local<v8::Object> wrap)
-      : WeakObject(isolate, wrap)
-      , md_(NULL)
-      , initialised_(false) {
+      : WeakObject(isolate, wrap),
+        md_(NULL),
+        initialised_(false) {
   }
 
   ~Verify() {
@@ -515,9 +515,9 @@ class DiffieHellman : public WeakObject {
   static void SetPrivateKey(const v8::FunctionCallbackInfo<v8::Value>& args);
 
   DiffieHellman(v8::Isolate* isolate, v8::Local<v8::Object> wrap)
-      : WeakObject(isolate, wrap)
-      , initialised_(false)
-      , dh(NULL) {
+      : WeakObject(isolate, wrap),
+        initialised_(false),
+        dh(NULL) {
   }
 
   ~DiffieHellman() {
index fa49dd4..a6905aa 100644 (file)
@@ -67,9 +67,9 @@ using v8::Value;
 class FSReqWrap: public ReqWrap<uv_fs_t> {
  public:
   FSReqWrap(Environment* env, const char* syscall, char* data = NULL)
-    : ReqWrap<uv_fs_t>(env)
-    , syscall_(syscall)
-    , data_(data) {
+    : ReqWrap<uv_fs_t>(env),
+      syscall_(syscall),
+      data_(data) {
   }
 
   void ReleaseEarly() {
index 12e9ee2..f7faf0d 100644 (file)
@@ -190,10 +190,10 @@ struct StringPtr {
 class Parser : public WeakObject {
  public:
   Parser(Environment* env, Local<Object> wrap, enum http_parser_type type)
-      : WeakObject(env->isolate(), wrap)
-      , env_(env)
-      , current_buffer_len_(0)
-      , current_buffer_data_(NULL) {
+      : WeakObject(env->isolate(), wrap),
+        env_(env),
+        current_buffer_len_(0),
+        current_buffer_data_(NULL) {
     Init(type);
   }
 
index 892ccac..45936fe 100644 (file)
@@ -64,9 +64,9 @@ static void Delete(uv_handle_t* handle) {
 
 
 StatWatcher::StatWatcher(Environment* env, Local<Object> wrap)
-    : WeakObject(env->isolate(), wrap)
-    , watcher_(new uv_fs_poll_t)
-    , env_(env) {
+    : WeakObject(env->isolate(), wrap),
+      watcher_(new uv_fs_poll_t),
+      env_(env) {
   uv_fs_poll_init(env->event_loop(), watcher_);
   watcher_->data = static_cast<void*>(this);
 }
index 2d411ab..e9de782 100644 (file)
@@ -71,21 +71,21 @@ class ZCtx : public WeakObject {
  public:
 
   ZCtx(Environment* env, Local<Object> wrap, node_zlib_mode mode)
-      : WeakObject(env->isolate(), wrap)
-      , chunk_size_(0)
-      , dictionary_(NULL)
-      , dictionary_len_(0)
-      , env_(env)
-      , err_(0)
-      , flush_(0)
-      , init_done_(false)
-      , level_(0)
-      , memLevel_(0)
-      , mode_(mode)
-      , strategy_(0)
-      , windowBits_(0)
-      , write_in_progress_(false)
-      , refs_(0) {
+      : WeakObject(env->isolate(), wrap),
+        chunk_size_(0),
+        dictionary_(NULL),
+        dictionary_len_(0),
+        env_(env),
+        err_(0),
+        flush_(0),
+        init_done_(false),
+        level_(0),
+        memLevel_(0),
+        mode_(mode),
+        strategy_(0),
+        windowBits_(0),
+        write_in_progress_(false),
+        refs_(0) {
   }
 
 
index 49a2f90..f1949d9 100644 (file)
@@ -54,10 +54,10 @@ using v8::Value;
 StreamWrap::StreamWrap(Environment* env,
                        Local<Object> object,
                        uv_stream_t* stream)
-    : HandleWrap(env, object, reinterpret_cast<uv_handle_t*>(stream))
-    , stream_(stream)
-    , default_callbacks_(this)
-    , callbacks_(&default_callbacks_) {
+    : HandleWrap(env, object, reinterpret_cast<uv_handle_t*>(stream)),
+      stream_(stream),
+      default_callbacks_(this),
+      callbacks_(&default_callbacks_) {
 }
 
 
index 26fb5d5..374e7c7 100644 (file)
@@ -38,8 +38,8 @@ typedef class ReqWrap<uv_shutdown_t> ShutdownWrap;
 class WriteWrap: public ReqWrap<uv_write_t> {
  public:
   WriteWrap(Environment* env, v8::Local<v8::Object> obj, StreamWrap* wrap)
-      : ReqWrap<uv_write_t>(env, obj)
-      , wrap_(wrap) {
+      : ReqWrap<uv_write_t>(env, obj),
+        wrap_(wrap) {
   }
 
   void* operator new(size_t size, char* storage) { return storage; }
index fd679ab..151789d 100644 (file)
@@ -60,8 +60,8 @@ class SendWrap : public ReqWrap<uv_udp_send_t> {
 SendWrap::SendWrap(Environment* env,
                    Local<Object> req_wrap_obj,
                    bool have_callback)
-    : ReqWrap<uv_udp_send_t>(env, req_wrap_obj)
-    , have_callback_(have_callback) {
+    : ReqWrap<uv_udp_send_t>(env, req_wrap_obj),
+      have_callback_(have_callback) {
 }
 
 
index 3993d08..5dd1b25 100644 (file)
@@ -2108,6 +2108,9 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, error):
           'the base class list in a class definition, the colon should '
           'be on the following line.')
 
+  if len(line) > initial_spaces and line[initial_spaces] == ',':
+    error(filename, linenum, 'whitespace/commafirst', 4,
+          'Comma-first style is not allowed')
 
   # Check if the line is a header guard.
   is_header_guard = False