clang-format codebase
diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c
index b75e853..f73b12c 100644
--- a/src/ruby/ext/grpc/rb_byte_buffer.c
+++ b/src/ruby/ext/grpc/rb_byte_buffer.c
@@ -49,7 +49,6 @@
   grpc_byte_buffer *wrapped;
 } grpc_rb_byte_buffer;
 
-
 /* Destroys ByteBuffer instances. */
 static void grpc_rb_byte_buffer_free(void *p) {
   grpc_rb_byte_buffer *bb = NULL;
@@ -169,7 +168,6 @@
   return output_obj;
 }
 
-
 /* Initializes ByteBuffer instances. */
 static VALUE grpc_rb_byte_buffer_init(VALUE self, VALUE src) {
   gpr_slice a_slice;
@@ -205,8 +203,8 @@
 VALUE rb_cByteBuffer = Qnil;
 
 void Init_google_rpc_byte_buffer() {
-  rb_cByteBuffer = rb_define_class_under(rb_mGoogleRpcCore, "ByteBuffer",
-                                         rb_cObject);
+  rb_cByteBuffer =
+      rb_define_class_under(rb_mGoogleRpcCore, "ByteBuffer", rb_cObject);
 
   /* Allocates an object managed by the ruby runtime */
   rb_define_alloc_func(rb_cByteBuffer, grpc_rb_byte_buffer_alloc);
@@ -223,7 +221,7 @@
   id_empty = rb_intern("");
 }
 
-VALUE grpc_rb_byte_buffer_create_with_mark(VALUE mark, grpc_byte_buffer* bb) {
+VALUE grpc_rb_byte_buffer_create_with_mark(VALUE mark, grpc_byte_buffer *bb) {
   grpc_rb_byte_buffer *byte_buffer = NULL;
   if (bb == NULL) {
     return Qnil;
@@ -236,7 +234,7 @@
 }
 
 /* Gets the wrapped byte_buffer from the ruby wrapper */
-grpc_byte_buffer* grpc_rb_get_wrapped_byte_buffer(VALUE v) {
+grpc_byte_buffer *grpc_rb_get_wrapped_byte_buffer(VALUE v) {
   grpc_rb_byte_buffer *wrapper = NULL;
   Data_Get_Struct(v, grpc_rb_byte_buffer, wrapper);
   return wrapper->wrapped;
diff --git a/src/ruby/ext/grpc/rb_byte_buffer.h b/src/ruby/ext/grpc/rb_byte_buffer.h
index 1bdcfe4..322c268 100644
--- a/src/ruby/ext/grpc/rb_byte_buffer.h
+++ b/src/ruby/ext/grpc/rb_byte_buffer.h
@@ -51,4 +51,4 @@
 /* Gets the wrapped byte_buffer from its ruby object. */
 grpc_byte_buffer* grpc_rb_get_wrapped_byte_buffer(VALUE v);
 
-#endif  /* GRPC_RB_BYTE_BUFFER_H_ */
+#endif /* GRPC_RB_BYTE_BUFFER_H_ */
diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c
index bf292fa..76b80bc 100644
--- a/src/ruby/ext/grpc/rb_call.c
+++ b/src/ruby/ext/grpc/rb_call.c
@@ -78,7 +78,7 @@
 
   ref_count = rb_hash_aref(hash_all_calls, OFFT2NUM((VALUE)call));
   if (ref_count == Qnil) {
-    return;  /* No longer in the hash, so already deleted */
+    return; /* No longer in the hash, so already deleted */
   } else if (NUM2UINT(ref_count) == 1) {
     rb_hash_delete(hash_all_calls, OFFT2NUM((VALUE)call));
     grpc_call_destroy(call);
@@ -92,9 +92,9 @@
 VALUE rb_error_code_details;
 
 /* Obtains the error detail string for given error code */
-const char* grpc_call_error_detail_of(grpc_call_error err) {
+const char *grpc_call_error_detail_of(grpc_call_error err) {
   VALUE detail_ref = rb_hash_aref(rb_error_code_details, UINT2NUM(err));
-  const char* detail = "unknown error code!";
+  const char *detail = "unknown error code!";
   if (detail_ref != Qnil) {
     detail = StringValueCStr(detail_ref);
   }
@@ -164,7 +164,7 @@
   /* "11" == 1 mandatory args, 1 (flags) is optional */
   rb_scan_args(argc, argv, "11", &metadata, &flags);
   if (NIL_P(flags)) {
-    flags = UINT2NUM(0);  /* Default to no flags */
+    flags = UINT2NUM(0); /* Default to no flags */
   }
   if (TYPE(metadata) != T_HASH) {
     rb_raise(rb_eTypeError, "add metadata failed: metadata should be a hash");
@@ -217,14 +217,13 @@
   rb_scan_args(argc, argv, "41", &cqueue, &invoke_accepted_tag,
                &metadata_read_tag, &finished_tag, &flags);
   if (NIL_P(flags)) {
-    flags = UINT2NUM(0);  /* Default to no flags */
+    flags = UINT2NUM(0); /* Default to no flags */
   }
   cq = grpc_rb_get_wrapped_completion_queue(cqueue);
   Data_Get_Struct(self, grpc_call, call);
   err = grpc_call_start_invoke(call, cq, ROBJECT(invoke_accepted_tag),
                                ROBJECT(metadata_read_tag),
-                               ROBJECT(finished_tag),
-                               NUM2UINT(flags));
+                               ROBJECT(finished_tag), NUM2UINT(flags));
   if (err != GRPC_CALL_OK) {
     rb_raise(rb_eCallError, "invoke failed: %s (code=%d)",
              grpc_call_error_detail_of(err), err);
@@ -329,7 +328,7 @@
   /* "21" == 2 mandatory args, 1 (flags) is optional */
   rb_scan_args(argc, argv, "21", &byte_buffer, &tag, &flags);
   if (NIL_P(flags)) {
-    flags = UINT2NUM(0);  /* Default to no flags */
+    flags = UINT2NUM(0); /* Default to no flags */
   }
   bfr = grpc_rb_get_wrapped_byte_buffer(byte_buffer);
   Data_Get_Struct(self, grpc_call, call);
@@ -405,7 +404,7 @@
   /* "01" == 1 (flags) is optional */
   rb_scan_args(argc, argv, "01", &flags);
   if (NIL_P(flags)) {
-    flags = UINT2NUM(0);  /* Default to no flags */
+    flags = UINT2NUM(0); /* Default to no flags */
   }
   Data_Get_Struct(self, grpc_call, call);
   err = grpc_call_server_end_initial_metadata(call, NUM2UINT(flags));
@@ -445,7 +444,6 @@
   return Qnil;
 }
 
-
 /* rb_cCall is the ruby class that proxies grpc_call. */
 VALUE rb_cCall = Qnil;
 
@@ -477,8 +475,8 @@
 
   /* Add the detail strings to a Hash */
   rb_error_code_details = rb_hash_new();
-  rb_hash_aset(rb_error_code_details,
-               UINT2NUM(GRPC_CALL_OK), rb_str_new2("ok"));
+  rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_OK),
+               rb_str_new2("ok"));
   rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR),
                rb_str_new2("unknown error"));
   rb_hash_aset(rb_error_code_details, UINT2NUM(GRPC_CALL_ERROR_NOT_ON_SERVER),
@@ -506,8 +504,8 @@
 
 void Init_google_rpc_call() {
   /* CallError inherits from Exception to signal that it is non-recoverable */
-  rb_eCallError = rb_define_class_under(rb_mGoogleRpcCore, "CallError",
-                                        rb_eException);
+  rb_eCallError =
+      rb_define_class_under(rb_mGoogleRpcCore, "CallError", rb_eException);
   rb_cCall = rb_define_class_under(rb_mGoogleRpcCore, "Call", rb_cObject);
 
   /* Prevent allocation or inialization of the Call class */
@@ -519,8 +517,7 @@
   rb_define_method(rb_cCall, "server_accept", grpc_rb_call_server_accept, 2);
   rb_define_method(rb_cCall, "server_end_initial_metadata",
                    grpc_rb_call_server_end_initial_metadata, -1);
-  rb_define_method(rb_cCall, "add_metadata", grpc_rb_call_add_metadata,
-                   -1);
+  rb_define_method(rb_cCall, "add_metadata", grpc_rb_call_add_metadata, -1);
   rb_define_method(rb_cCall, "cancel", grpc_rb_call_cancel, 0);
   rb_define_method(rb_cCall, "start_invoke", grpc_rb_call_start_invoke, -1);
   rb_define_method(rb_cCall, "start_read", grpc_rb_call_start_read, 1);
@@ -551,25 +548,24 @@
 }
 
 /* Gets the call from the ruby object */
-grpc_call* grpc_rb_get_wrapped_call(VALUE v) {
+grpc_call *grpc_rb_get_wrapped_call(VALUE v) {
   grpc_call *c = NULL;
   Data_Get_Struct(v, grpc_call, c);
   return c;
 }
 
 /* Obtains the wrapped object for a given call */
-VALUE grpc_rb_wrap_call(grpc_call* c) {
+VALUE grpc_rb_wrap_call(grpc_call *c) {
   VALUE obj = Qnil;
   if (c == NULL) {
     return Qnil;
   }
   obj = rb_hash_aref(hash_all_calls, OFFT2NUM((VALUE)c));
-  if (obj == Qnil) {  /* Not in the hash add it */
+  if (obj == Qnil) { /* Not in the hash add it */
     rb_hash_aset(hash_all_calls, OFFT2NUM((VALUE)c), UINT2NUM(1));
   } else {
     rb_hash_aset(hash_all_calls, OFFT2NUM((VALUE)c),
                  UINT2NUM(NUM2UINT(obj) + 1));
   }
-  return Data_Wrap_Struct(rb_cCall, GC_NOT_MARKED, grpc_rb_call_destroy,
-                          c);
+  return Data_Wrap_Struct(rb_cCall, GC_NOT_MARKED, grpc_rb_call_destroy, c);
 }
diff --git a/src/ruby/ext/grpc/rb_call.h b/src/ruby/ext/grpc/rb_call.h
index 422e7e7..965e9ee 100644
--- a/src/ruby/ext/grpc/rb_call.h
+++ b/src/ruby/ext/grpc/rb_call.h
@@ -56,4 +56,4 @@
 /* Initializes the Call class. */
 void Init_google_rpc_call();
 
-#endif  /* GRPC_RB_CALL_H_ */
+#endif /* GRPC_RB_CALL_H_ */
diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c
index d951847..c0187d2 100644
--- a/src/ruby/ext/grpc/rb_channel.c
+++ b/src/ruby/ext/grpc/rb_channel.c
@@ -137,7 +137,7 @@
     ch = grpc_secure_channel_create(creds, target_chars, &args);
   }
   if (args.args != NULL) {
-    xfree(args.args);   /* Allocated by grpc_rb_hash_convert_to_channel_args */
+    xfree(args.args); /* Allocated by grpc_rb_hash_convert_to_channel_args */
   }
   if (ch == NULL) {
     rb_raise(rb_eRuntimeError, "could not create an rpc channel to target:%s",
@@ -256,7 +256,7 @@
 }
 
 /* Gets the wrapped channel from the ruby wrapper */
-grpc_channel* grpc_rb_get_wrapped_channel(VALUE v) {
+grpc_channel *grpc_rb_get_wrapped_channel(VALUE v) {
   grpc_rb_channel *wrapper = NULL;
   Data_Get_Struct(v, grpc_rb_channel, wrapper);
   return wrapper->wrapped;
diff --git a/src/ruby/ext/grpc/rb_channel.h b/src/ruby/ext/grpc/rb_channel.h
index b0a3634..6c1210e 100644
--- a/src/ruby/ext/grpc/rb_channel.h
+++ b/src/ruby/ext/grpc/rb_channel.h
@@ -46,4 +46,4 @@
 /* Gets the wrapped channel from the ruby wrapper */
 grpc_channel* grpc_rb_get_wrapped_channel(VALUE v);
 
-#endif  /* GRPC_RB_CHANNEL_H_ */
+#endif /* GRPC_RB_CHANNEL_H_ */
diff --git a/src/ruby/ext/grpc/rb_channel_args.c b/src/ruby/ext/grpc/rb_channel_args.c
index eebced0..b918e12 100644
--- a/src/ruby/ext/grpc/rb_channel_args.c
+++ b/src/ruby/ext/grpc/rb_channel_args.c
@@ -46,7 +46,6 @@
   grpc_channel_args* args;
 
   switch (TYPE(key)) {
-
     case T_STRING:
       the_key = StringValuePtr(key);
       break;
@@ -68,13 +67,12 @@
     return ST_STOP;
   }
 
-  args->args[args->num_args - 1].key = (char *)the_key;
+  args->args[args->num_args - 1].key = (char*)the_key;
   switch (TYPE(val)) {
-
     case T_SYMBOL:
       args->args[args->num_args - 1].type = GRPC_ARG_STRING;
       args->args[args->num_args - 1].value.string =
-          (char *)rb_id2name(SYM2ID(val));
+          (char*)rb_id2name(SYM2ID(val));
       --args->num_args;
       return ST_CONTINUE;
 
@@ -109,11 +107,10 @@
   grpc_channel_args* dst;
 } channel_convert_params;
 
-
 static VALUE grpc_rb_hash_convert_to_channel_args0(VALUE as_value) {
   ID id_size = rb_intern("size");
   VALUE rb_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject);
-  channel_convert_params* params = (channel_convert_params *)as_value;
+  channel_convert_params* params = (channel_convert_params*)as_value;
   size_t num_args = 0;
 
   if (!NIL_P(params->src_hash) && TYPE(params->src_hash) != T_HASH) {
@@ -146,7 +143,7 @@
   /* Make a protected call to grpc_rb_hash_convert_channel_args */
   params.src_hash = src_hash;
   params.dst = dst;
-  rb_protect(grpc_rb_hash_convert_to_channel_args0, (VALUE) &params, &status);
+  rb_protect(grpc_rb_hash_convert_to_channel_args0, (VALUE)&params, &status);
   if (status != 0) {
     if (dst->args != NULL) {
       /* Free any allocated memory before propagating the error */
diff --git a/src/ruby/ext/grpc/rb_channel_args.h b/src/ruby/ext/grpc/rb_channel_args.h
index bbff017..07be662 100644
--- a/src/ruby/ext/grpc/rb_channel_args.h
+++ b/src/ruby/ext/grpc/rb_channel_args.h
@@ -49,5 +49,4 @@
 void grpc_rb_hash_convert_to_channel_args(VALUE src_hash,
                                           grpc_channel_args* dst);
 
-
-#endif  /* GRPC_RB_CHANNEL_ARGS_H_ */
+#endif /* GRPC_RB_CHANNEL_ARGS_H_ */
diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c
index dc95838..c1b74e2 100644
--- a/src/ruby/ext/grpc/rb_completion_queue.c
+++ b/src/ruby/ext/grpc/rb_completion_queue.c
@@ -45,33 +45,28 @@
   grpc_completion_queue *cq;
   grpc_event *event;
   gpr_timespec timeout;
-  void* tag;
+  void *tag;
 } next_call_stack;
 
 /* Calls grpc_completion_queue_next without holding the ruby GIL */
-static void *grpc_rb_completion_queue_next_no_gil(
-    next_call_stack *next_call) {
-  next_call->event = grpc_completion_queue_next(next_call->cq,
-                                                next_call->timeout);
+static void *grpc_rb_completion_queue_next_no_gil(next_call_stack *next_call) {
+  next_call->event =
+      grpc_completion_queue_next(next_call->cq, next_call->timeout);
   return NULL;
 }
 
 /* Calls grpc_completion_queue_pluck without holding the ruby GIL */
-static void *grpc_rb_completion_queue_pluck_no_gil(
-    next_call_stack *next_call) {
-  next_call->event = grpc_completion_queue_pluck(next_call->cq,
-                                                 next_call->tag,
+static void *grpc_rb_completion_queue_pluck_no_gil(next_call_stack *next_call) {
+  next_call->event = grpc_completion_queue_pluck(next_call->cq, next_call->tag,
                                                  next_call->timeout);
   return NULL;
 }
 
-
 /* Shuts down and drains the completion queue if necessary.
  *
  * This is done when the ruby completion queue object is about to be GCed.
  */
-static void grpc_rb_completion_queue_shutdown_drain(
-    grpc_completion_queue* cq) {
+static void grpc_rb_completion_queue_shutdown_drain(grpc_completion_queue *cq) {
   next_call_stack next_call;
   grpc_completion_type type;
   int drained = 0;
@@ -120,13 +115,12 @@
 
 /* Allocates a completion queue. */
 static VALUE grpc_rb_completion_queue_alloc(VALUE cls) {
-  grpc_completion_queue* cq = grpc_completion_queue_create();
+  grpc_completion_queue *cq = grpc_completion_queue_create();
   if (cq == NULL) {
-    rb_raise(rb_eArgError,
-             "could not create a completion queue: not sure why");
+    rb_raise(rb_eArgError, "could not create a completion queue: not sure why");
   }
-  return Data_Wrap_Struct(cls, GC_NOT_MARKED,
-                          grpc_rb_completion_queue_destroy, cq);
+  return Data_Wrap_Struct(cls, GC_NOT_MARKED, grpc_rb_completion_queue_destroy,
+                          cq);
 }
 
 /* Blocks until the next event is available, and returns the event. */
@@ -166,9 +160,8 @@
 VALUE rb_cCompletionQueue = Qnil;
 
 void Init_google_rpc_completion_queue() {
-  rb_cCompletionQueue = rb_define_class_under(rb_mGoogleRpcCore,
-                                              "CompletionQueue",
-                                              rb_cObject);
+  rb_cCompletionQueue =
+      rb_define_class_under(rb_mGoogleRpcCore, "CompletionQueue", rb_cObject);
 
   /* constructor: uses an alloc func without an initializer. Using a simple
      alloc func works here as the grpc header does not specify any args for
@@ -176,16 +169,16 @@
   rb_define_alloc_func(rb_cCompletionQueue, grpc_rb_completion_queue_alloc);
 
   /* Add the next method that waits for the next event. */
-  rb_define_method(rb_cCompletionQueue, "next",
-                   grpc_rb_completion_queue_next, 1);
+  rb_define_method(rb_cCompletionQueue, "next", grpc_rb_completion_queue_next,
+                   1);
 
   /* Add the pluck method that waits for the next event of given tag */
-  rb_define_method(rb_cCompletionQueue, "pluck",
-                   grpc_rb_completion_queue_pluck, 2);
+  rb_define_method(rb_cCompletionQueue, "pluck", grpc_rb_completion_queue_pluck,
+                   2);
 }
 
 /* Gets the wrapped completion queue from the ruby wrapper */
-grpc_completion_queue* grpc_rb_get_wrapped_completion_queue(VALUE v) {
+grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v) {
   grpc_completion_queue *cq = NULL;
   Data_Get_Struct(v, grpc_completion_queue, cq);
   return cq;
diff --git a/src/ruby/ext/grpc/rb_completion_queue.h b/src/ruby/ext/grpc/rb_completion_queue.h
index 1ec2718..c563662 100644
--- a/src/ruby/ext/grpc/rb_completion_queue.h
+++ b/src/ruby/ext/grpc/rb_completion_queue.h
@@ -47,4 +47,4 @@
 /* Initializes the CompletionQueue class. */
 void Init_google_rpc_completion_queue();
 
-#endif  /* GRPC_RB_COMPLETION_QUEUE_H_ */
+#endif /* GRPC_RB_COMPLETION_QUEUE_H_ */
diff --git a/src/ruby/ext/grpc/rb_credentials.c b/src/ruby/ext/grpc/rb_credentials.c
index 658adac..5dec518 100644
--- a/src/ruby/ext/grpc/rb_credentials.c
+++ b/src/ruby/ext/grpc/rb_credentials.c
@@ -40,7 +40,6 @@
 
 #include "rb_grpc.h"
 
-
 /* grpc_rb_credentials wraps a grpc_credentials.  It provides a
  * peer ruby object, 'mark' to minimize copying when a credential is
  * created from ruby. */
@@ -92,8 +91,7 @@
   wrapper->wrapped = NULL;
   wrapper->mark = Qnil;
   return Data_Wrap_Struct(cls, grpc_rb_credentials_mark,
-                          grpc_rb_credentials_free,
-                          wrapper);
+                          grpc_rb_credentials_free, wrapper);
 }
 
 /* Clones Credentials instances.
@@ -111,8 +109,7 @@
   /* Raise an error if orig is not a credentials object or a subclass. */
   if (TYPE(orig) != T_DATA ||
       RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_credentials_free) {
-    rb_raise(rb_eTypeError, "not a %s",
-             rb_obj_classname(rb_cCredentials));
+    rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(rb_cCredentials));
   }
 
   Data_Get_Struct(orig, grpc_rb_credentials, orig_cred);
@@ -238,14 +235,12 @@
         RSTRING_PTR(pem_cert_chain), RSTRING_LEN(pem_cert_chain));
   } else if (pem_private_key == Qnil) {
     creds = grpc_ssl_credentials_create(
-        RSTRING_PTR(pem_root_certs), RSTRING_LEN(pem_root_certs),
-        NULL, 0,
+        RSTRING_PTR(pem_root_certs), RSTRING_LEN(pem_root_certs), NULL, 0,
         RSTRING_PTR(pem_cert_chain), RSTRING_LEN(pem_cert_chain));
   } else {
     creds = grpc_ssl_credentials_create(
         RSTRING_PTR(pem_root_certs), RSTRING_LEN(pem_root_certs),
-        RSTRING_PTR(pem_private_key), RSTRING_LEN(pem_private_key),
-        NULL, 0);
+        RSTRING_PTR(pem_private_key), RSTRING_LEN(pem_private_key), NULL, 0);
   }
   if (creds == NULL) {
     rb_raise(rb_eRuntimeError, "could not create a credentials, not sure why");
@@ -265,15 +260,14 @@
 VALUE rb_cCredentials = Qnil;
 
 void Init_google_rpc_credentials() {
-  rb_cCredentials = rb_define_class_under(rb_mGoogleRpcCore, "Credentials",
-                                          rb_cObject);
+  rb_cCredentials =
+      rb_define_class_under(rb_mGoogleRpcCore, "Credentials", rb_cObject);
 
   /* Allocates an object managed by the ruby runtime */
   rb_define_alloc_func(rb_cCredentials, grpc_rb_credentials_alloc);
 
   /* Provides a ruby constructor and support for dup/clone. */
-  rb_define_method(rb_cCredentials, "initialize",
-                   grpc_rb_credentials_init, -1);
+  rb_define_method(rb_cCredentials, "initialize", grpc_rb_credentials_init, -1);
   rb_define_method(rb_cCredentials, "initialize_copy",
                    grpc_rb_credentials_init_copy, 1);
 
@@ -294,7 +288,7 @@
 }
 
 /* Gets the wrapped grpc_credentials from the ruby wrapper */
-grpc_credentials* grpc_rb_get_wrapped_credentials(VALUE v) {
+grpc_credentials *grpc_rb_get_wrapped_credentials(VALUE v) {
   grpc_rb_credentials *wrapper = NULL;
   Data_Get_Struct(v, grpc_rb_credentials, wrapper);
   return wrapper->wrapped;
diff --git a/src/ruby/ext/grpc/rb_credentials.h b/src/ruby/ext/grpc/rb_credentials.h
index d18c88a..fada363 100644
--- a/src/ruby/ext/grpc/rb_credentials.h
+++ b/src/ruby/ext/grpc/rb_credentials.h
@@ -47,4 +47,4 @@
 /* Gets the wrapped credentials from the ruby wrapper */
 grpc_credentials* grpc_rb_get_wrapped_credentials(VALUE v);
 
-#endif  /* GRPC_RB_CREDENTIALS_H_ */
+#endif /* GRPC_RB_CREDENTIALS_H_ */
diff --git a/src/ruby/ext/grpc/rb_event.c b/src/ruby/ext/grpc/rb_event.c
index 9200f92..0fae950 100644
--- a/src/ruby/ext/grpc/rb_event.c
+++ b/src/ruby/ext/grpc/rb_event.c
@@ -50,7 +50,6 @@
   grpc_event *wrapped;
 } grpc_rb_event;
 
-
 /* rb_mCompletionType is a ruby module that holds the completion type values */
 VALUE rb_mCompletionType = Qnil;
 
@@ -107,15 +106,15 @@
       return rb_const_get(rb_mCompletionType, rb_intern("READ"));
 
     case GRPC_INVOKE_ACCEPTED:
-      grpc_rb_event_result(self);  /* validates the result */
+      grpc_rb_event_result(self); /* validates the result */
       return rb_const_get(rb_mCompletionType, rb_intern("INVOKE_ACCEPTED"));
 
     case GRPC_WRITE_ACCEPTED:
-      grpc_rb_event_result(self);  /* validates the result */
+      grpc_rb_event_result(self); /* validates the result */
       return rb_const_get(rb_mCompletionType, rb_intern("WRITE_ACCEPTED"));
 
     case GRPC_FINISH_ACCEPTED:
-      grpc_rb_event_result(self);  /* validates the result */
+      grpc_rb_event_result(self); /* validates the result */
       return rb_const_get(rb_mCompletionType, rb_intern("FINISH_ACCEPTED"));
 
     case GRPC_CLIENT_METADATA_READ:
@@ -129,8 +128,8 @@
       return rb_const_get(rb_mCompletionType, rb_intern("SERVER_RPC_NEW"));
 
     default:
-      rb_raise(rb_eRuntimeError,
-               "unrecognized event code for an rpc event:%d", event->type);
+      rb_raise(rb_eRuntimeError, "unrecognized event code for an rpc event:%d",
+               event->type);
   }
   return Qnil; /* should not be reached */
 }
@@ -189,7 +188,6 @@
   /* Figure out which metadata to read. */
   event = wrapper->wrapped;
   switch (event->type) {
-
     case GRPC_CLIENT_METADATA_READ:
       count = event->data.client_metadata_read.count;
       metadata = event->data.client_metadata_read.elements;
@@ -218,22 +216,18 @@
     key = rb_str_new2(metadata[i].key);
     value = rb_hash_aref(result, key);
     if (value == Qnil) {
-      value = rb_str_new(
-          metadata[i].value,
-          metadata[i].value_length);
+      value = rb_str_new(metadata[i].value, metadata[i].value_length);
       rb_hash_aset(result, key, value);
     } else if (TYPE(value) == T_ARRAY) {
       /* Add the string to the returned array */
-      rb_ary_push(value, rb_str_new(
-          metadata[i].value,
-          metadata[i].value_length));
+      rb_ary_push(value,
+                  rb_str_new(metadata[i].value, metadata[i].value_length));
     } else {
       /* Add the current value with this key and the new one to an array */
       new_ary = rb_ary_new();
       rb_ary_push(new_ary, value);
-      rb_ary_push(new_ary, rb_str_new(
-          metadata[i].value,
-          metadata[i].value_length));
+      rb_ary_push(new_ary,
+                  rb_str_new(metadata[i].value, metadata[i].value_length));
       rb_hash_aset(result, key, new_ary);
     }
   }
@@ -252,7 +246,6 @@
   event = wrapper->wrapped;
 
   switch (event->type) {
-
     case GRPC_QUEUE_SHUTDOWN:
       return Qnil;
 
@@ -287,29 +280,24 @@
       return grpc_rb_event_metadata(self);
 
     case GRPC_FINISHED:
-      return rb_struct_new(
-          rb_sStatus,
-          UINT2NUM(event->data.finished.status),
-          (event->data.finished.details == NULL ?
-           Qnil : rb_str_new2(event->data.finished.details)),
-          grpc_rb_event_metadata(self),
-          NULL);
+      return rb_struct_new(rb_sStatus, UINT2NUM(event->data.finished.status),
+                           (event->data.finished.details == NULL
+                                ? Qnil
+                                : rb_str_new2(event->data.finished.details)),
+                           grpc_rb_event_metadata(self), NULL);
       break;
 
     case GRPC_SERVER_RPC_NEW:
       return rb_struct_new(
-          rb_sNewServerRpc,
-          rb_str_new2(event->data.server_rpc_new.method),
+          rb_sNewServerRpc, rb_str_new2(event->data.server_rpc_new.method),
           rb_str_new2(event->data.server_rpc_new.host),
-          Data_Wrap_Struct(
-              rb_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE,
-              (void *)&event->data.server_rpc_new.deadline),
-          grpc_rb_event_metadata(self),
-          NULL);
+          Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE,
+                           (void *)&event->data.server_rpc_new.deadline),
+          grpc_rb_event_metadata(self), NULL);
 
     default:
-      rb_raise(rb_eRuntimeError,
-               "unrecognized event code for an rpc event:%d", event->type);
+      rb_raise(rb_eRuntimeError, "unrecognized event code for an rpc event:%d",
+               event->type);
   }
 
   return Qfalse;
@@ -319,7 +307,7 @@
   grpc_event *event = NULL;
   grpc_rb_event *wrapper = NULL;
   Data_Get_Struct(self, grpc_rb_event, wrapper);
-  if (wrapper->wrapped == NULL) {  /* already closed  */
+  if (wrapper->wrapped == NULL) { /* already closed  */
     return Qnil;
   }
   event = wrapper->wrapped;
@@ -337,8 +325,8 @@
 VALUE rb_eEventError = Qnil;
 
 void Init_google_rpc_event() {
-  rb_eEventError = rb_define_class_under(rb_mGoogleRpcCore, "EventError",
-                                         rb_eStandardError);
+  rb_eEventError =
+      rb_define_class_under(rb_mGoogleRpcCore, "EventError", rb_eStandardError);
   rb_cEvent = rb_define_class_under(rb_mGoogleRpcCore, "Event", rb_cObject);
 
   /* Prevent allocation or inialization from ruby. */
@@ -355,8 +343,8 @@
   rb_define_alias(rb_cEvent, "close", "finish");
 
   /* Constants representing the completion types */
-  rb_mCompletionType = rb_define_module_under(rb_mGoogleRpcCore,
-                                              "CompletionType");
+  rb_mCompletionType =
+      rb_define_module_under(rb_mGoogleRpcCore, "CompletionType");
   rb_define_const(rb_mCompletionType, "QUEUE_SHUTDOWN",
                   INT2NUM(GRPC_QUEUE_SHUTDOWN));
   rb_define_const(rb_mCompletionType, "READ", INT2NUM(GRPC_READ));
@@ -368,8 +356,7 @@
                   INT2NUM(GRPC_FINISH_ACCEPTED));
   rb_define_const(rb_mCompletionType, "CLIENT_METADATA_READ",
                   INT2NUM(GRPC_CLIENT_METADATA_READ));
-  rb_define_const(rb_mCompletionType, "FINISHED",
-                  INT2NUM(GRPC_FINISHED));
+  rb_define_const(rb_mCompletionType, "FINISHED", INT2NUM(GRPC_FINISHED));
   rb_define_const(rb_mCompletionType, "SERVER_RPC_NEW",
                   INT2NUM(GRPC_SERVER_RPC_NEW));
   rb_define_const(rb_mCompletionType, "RESERVED",
diff --git a/src/ruby/ext/grpc/rb_event.h b/src/ruby/ext/grpc/rb_event.h
index e4e4a79..a406e9e 100644
--- a/src/ruby/ext/grpc/rb_event.h
+++ b/src/ruby/ext/grpc/rb_event.h
@@ -50,4 +50,4 @@
 /* Initializes the Event and EventError classes. */
 void Init_google_rpc_event();
 
-#endif  /* GRPC_RB_EVENT_H_ */
+#endif /* GRPC_RB_EVENT_H_ */
diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c
index eae011d..8feefb0 100644
--- a/src/ruby/ext/grpc/rb_grpc.c
+++ b/src/ruby/ext/grpc/rb_grpc.c
@@ -98,18 +98,16 @@
   const char *want = " want <secs from epoch>|<Time>|<GRPC::TimeConst.*>";
 
   switch (TYPE(time)) {
-
     case T_DATA:
       if (CLASS_OF(time) == rb_cTimeVal) {
         Data_Get_Struct(time, gpr_timespec, time_const);
         t = *time_const;
       } else if (CLASS_OF(time) == rb_cTime) {
-        t.tv_sec =  NUM2INT(rb_funcall(time, id_tv_sec, 0));
+        t.tv_sec = NUM2INT(rb_funcall(time, id_tv_sec, 0));
         t.tv_nsec = NUM2INT(rb_funcall(time, id_tv_nsec, 0));
       } else {
-        rb_raise(rb_eTypeError,
-                 "bad input: (%s)->c_timeval, got <%s>,%s",
-                 tstr, rb_obj_classname(time), want);
+        rb_raise(rb_eTypeError, "bad input: (%s)->c_timeval, got <%s>,%s", tstr,
+                 rb_obj_classname(time), want);
       }
       break;
 
@@ -136,7 +134,7 @@
           rb_raise(rb_eRangeError, "%f out of Time range",
                    RFLOAT(time)->float_value);
         }
-        t.tv_nsec = (time_t)(d*1e9+0.5);
+        t.tv_nsec = (time_t)(d * 1e9 + 0.5);
       }
       break;
 
@@ -148,9 +146,8 @@
       break;
 
     default:
-      rb_raise(rb_eTypeError,
-               "bad input: (%s)->c_timeval, got <%s>,%s",
-               tstr, rb_obj_classname(time), want);
+      rb_raise(rb_eTypeError, "bad input: (%s)->c_timeval, got <%s>,%s", tstr,
+               rb_obj_classname(time), want);
       break;
   }
   return t;
@@ -158,8 +155,8 @@
 
 void Init_google_status_codes() {
   /* Constants representing the status codes or grpc_status_code in status.h */
-  VALUE rb_mStatusCodes = rb_define_module_under(rb_mGoogleRpcCore,
-                                                 "StatusCodes");
+  VALUE rb_mStatusCodes =
+      rb_define_module_under(rb_mGoogleRpcCore, "StatusCodes");
   rb_define_const(rb_mStatusCodes, "OK", INT2NUM(GRPC_STATUS_OK));
   rb_define_const(rb_mStatusCodes, "CANCELLED", INT2NUM(GRPC_STATUS_CANCELLED));
   rb_define_const(rb_mStatusCodes, "UNKNOWN", INT2NUM(GRPC_STATUS_UNKNOWN));
@@ -218,19 +215,19 @@
 
 /* Adds a module with constants that map to gpr's static timeval structs. */
 void Init_google_time_consts() {
-  VALUE rb_mTimeConsts = rb_define_module_under(rb_mGoogleRpcCore,
-                                                "TimeConsts");
-  rb_cTimeVal = rb_define_class_under(rb_mGoogleRpcCore, "TimeSpec",
-                                      rb_cObject);
+  VALUE rb_mTimeConsts =
+      rb_define_module_under(rb_mGoogleRpcCore, "TimeConsts");
+  rb_cTimeVal =
+      rb_define_class_under(rb_mGoogleRpcCore, "TimeSpec", rb_cObject);
   rb_define_const(rb_mTimeConsts, "ZERO",
-                  Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED,
-                                   GC_DONT_FREE, (void *)&gpr_time_0));
+                  Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE,
+                                   (void *)&gpr_time_0));
   rb_define_const(rb_mTimeConsts, "INFINITE_FUTURE",
-                  Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED,
-                                   GC_DONT_FREE, (void *)&gpr_inf_future));
+                  Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE,
+                                   (void *)&gpr_inf_future));
   rb_define_const(rb_mTimeConsts, "INFINITE_PAST",
-                  Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED,
-                                   GC_DONT_FREE, (void *)&gpr_inf_past));
+                  Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE,
+                                   (void *)&gpr_inf_past));
   rb_define_method(rb_cTimeVal, "to_time", grpc_rb_time_val_to_time, 0);
   rb_define_method(rb_cTimeVal, "inspect", grpc_rb_time_val_inspect, 0);
   rb_define_method(rb_cTimeVal, "to_s", grpc_rb_time_val_to_s, 0);
@@ -241,9 +238,7 @@
   id_tv_nsec = rb_intern("tv_nsec");
 }
 
-void grpc_rb_shutdown(void *vm) {
-  grpc_shutdown();
-}
+void grpc_rb_shutdown(void *vm) { grpc_shutdown(); }
 
 /* Initialize the Google RPC module structs */
 
diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h
index c2c8942..d5e8930 100644
--- a/src/ruby/ext/grpc/rb_grpc.h
+++ b/src/ruby/ext/grpc/rb_grpc.h
@@ -74,4 +74,4 @@
 /* grpc_rb_time_timeval creates a gpr_timespec from a ruby time object. */
 gpr_timespec grpc_rb_time_timeval(VALUE time, int interval);
 
-#endif  /* GRPC_RB_H_ */
+#endif /* GRPC_RB_H_ */
diff --git a/src/ruby/ext/grpc/rb_metadata.c b/src/ruby/ext/grpc/rb_metadata.c
index dcacc4a..88eb62a 100644
--- a/src/ruby/ext/grpc/rb_metadata.c
+++ b/src/ruby/ext/grpc/rb_metadata.c
@@ -48,7 +48,6 @@
   grpc_metadata *wrapped;
 } grpc_rb_metadata;
 
-
 /* Destroys Metadata instances. */
 static void grpc_rb_metadata_free(void *p) {
   if (p == NULL) {
@@ -102,7 +101,7 @@
   wrapper->wrapped = md;
   if (TYPE(key) == T_SYMBOL) {
     md->key = (char *)rb_id2name(SYM2ID(key));
-  } else {  /* StringValueCStr does all other type exclusions for us */
+  } else { /* StringValueCStr does all other type exclusions for us */
     md->key = StringValueCStr(key);
   }
   md->value = RSTRING_PTR(value);
@@ -189,8 +188,8 @@
 /* rb_cMetadata is the Metadata class whose instances proxy grpc_metadata. */
 VALUE rb_cMetadata = Qnil;
 void Init_google_rpc_metadata() {
-  rb_cMetadata = rb_define_class_under(rb_mGoogleRpcCore, "Metadata",
-                                       rb_cObject);
+  rb_cMetadata =
+      rb_define_class_under(rb_mGoogleRpcCore, "Metadata", rb_cObject);
 
   /* Allocates an object managed by the ruby runtime */
   rb_define_alloc_func(rb_cMetadata, grpc_rb_metadata_alloc);
@@ -209,7 +208,7 @@
 }
 
 /* Gets the wrapped metadata from the ruby wrapper */
-grpc_metadata* grpc_rb_get_wrapped_metadata(VALUE v) {
+grpc_metadata *grpc_rb_get_wrapped_metadata(VALUE v) {
   grpc_rb_metadata *wrapper = NULL;
   Data_Get_Struct(v, grpc_rb_metadata, wrapper);
   return wrapper->wrapped;
diff --git a/src/ruby/ext/grpc/rb_metadata.h b/src/ruby/ext/grpc/rb_metadata.h
index 6b70591..329ef15 100644
--- a/src/ruby/ext/grpc/rb_metadata.h
+++ b/src/ruby/ext/grpc/rb_metadata.h
@@ -42,7 +42,7 @@
 
 /* grpc_rb_metadata_create_with_mark creates a grpc_rb_metadata with a ruby mark
  * object that will be kept alive while the metadata is alive. */
-extern VALUE grpc_rb_metadata_create_with_mark(VALUE mark, grpc_metadata *md);
+extern VALUE grpc_rb_metadata_create_with_mark(VALUE mark, grpc_metadata* md);
 
 /* Gets the wrapped metadata from the ruby wrapper */
 grpc_metadata* grpc_rb_get_wrapped_metadata(VALUE v);
@@ -50,4 +50,4 @@
 /* Initializes the Metadata class. */
 void Init_google_rpc_metadata();
 
-#endif  /* GRPC_RB_METADATA_H_ */
+#endif /* GRPC_RB_METADATA_H_ */
diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c
index 84fba5b..ef2a9f1 100644
--- a/src/ruby/ext/grpc/rb_server.c
+++ b/src/ruby/ext/grpc/rb_server.c
@@ -128,7 +128,7 @@
   }
 
   if (args.args != NULL) {
-    xfree(args.args);  /* Allocated by grpc_rb_hash_convert_to_channel_args */
+    xfree(args.args); /* Allocated by grpc_rb_hash_convert_to_channel_args */
   }
   if (srv == NULL) {
     rb_raise(rb_eRuntimeError, "could not create a gRPC server, not sure why");
@@ -240,8 +240,8 @@
                StringValueCStr(port));
     }
   } else if (TYPE(is_secure) != T_FALSE) {
-    added_ok = grpc_server_add_secure_http2_port(s->wrapped,
-                                                 StringValueCStr(port));
+    added_ok =
+        grpc_server_add_secure_http2_port(s->wrapped, StringValueCStr(port));
     if (added_ok == 0) {
       rb_raise(rb_eRuntimeError,
                "could not add secure port %s to server, not sure why",
@@ -271,7 +271,7 @@
 }
 
 /* Gets the wrapped server from the ruby wrapper */
-grpc_server* grpc_rb_get_wrapped_server(VALUE v) {
+grpc_server *grpc_rb_get_wrapped_server(VALUE v) {
   grpc_rb_server *wrapper = NULL;
   Data_Get_Struct(v, grpc_rb_server, wrapper);
   return wrapper->wrapped;
diff --git a/src/ruby/ext/grpc/rb_server.h b/src/ruby/ext/grpc/rb_server.h
index 7fcd32c..92047ef 100644
--- a/src/ruby/ext/grpc/rb_server.h
+++ b/src/ruby/ext/grpc/rb_server.h
@@ -47,4 +47,4 @@
 /* Gets the wrapped server from the ruby wrapper */
 grpc_server* grpc_rb_get_wrapped_server(VALUE v);
 
-#endif  /* GRPC_RB_SERVER_H_ */
+#endif /* GRPC_RB_SERVER_H_ */
diff --git a/src/ruby/ext/grpc/rb_server_credentials.c b/src/ruby/ext/grpc/rb_server_credentials.c
index fa0d6f2..e534c11 100644
--- a/src/ruby/ext/grpc/rb_server_credentials.c
+++ b/src/ruby/ext/grpc/rb_server_credentials.c
@@ -40,7 +40,6 @@
 
 #include "rb_grpc.h"
 
-
 /* grpc_rb_server_credentials wraps a grpc_server_credentials.  It provides a
    peer ruby object, 'mark' to minimize copying when a server credential is
    created from ruby. */
@@ -91,8 +90,7 @@
   wrapper->wrapped = NULL;
   wrapper->mark = Qnil;
   return Data_Wrap_Struct(cls, grpc_rb_server_credentials_mark,
-                          grpc_rb_server_credentials_free,
-                          wrapper);
+                          grpc_rb_server_credentials_free, wrapper);
 }
 
 /* Clones ServerCredentials instances.
@@ -123,7 +121,6 @@
   return copy;
 }
 
-
 /* The attribute used on the mark object to hold the pem_root_certs. */
 static ID id_pem_root_certs;
 
@@ -188,9 +185,8 @@
 VALUE rb_cServerCredentials = Qnil;
 
 void Init_google_rpc_server_credentials() {
-  rb_cServerCredentials = rb_define_class_under(rb_mGoogleRpcCore,
-                                                "ServerCredentials",
-                                                rb_cObject);
+  rb_cServerCredentials =
+      rb_define_class_under(rb_mGoogleRpcCore, "ServerCredentials", rb_cObject);
 
   /* Allocates an object managed by the ruby runtime */
   rb_define_alloc_func(rb_cServerCredentials, grpc_rb_server_credentials_alloc);
@@ -199,8 +195,7 @@
   rb_define_method(rb_cServerCredentials, "initialize",
                    grpc_rb_server_credentials_init, 3);
   rb_define_method(rb_cServerCredentials, "initialize_copy",
-                   grpc_rb_server_credentials_init_copy,
-                   1);
+                   grpc_rb_server_credentials_init_copy, 1);
 
   id_pem_cert_chain = rb_intern("__pem_cert_chain");
   id_pem_private_key = rb_intern("__pem_private_key");
@@ -208,7 +203,7 @@
 }
 
 /* Gets the wrapped grpc_server_credentials from the ruby wrapper */
-grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v) {
+grpc_server_credentials *grpc_rb_get_wrapped_server_credentials(VALUE v) {
   grpc_rb_server_credentials *wrapper = NULL;
   Data_Get_Struct(v, grpc_rb_server_credentials, wrapper);
   return wrapper->wrapped;
diff --git a/src/ruby/ext/grpc/rb_server_credentials.h b/src/ruby/ext/grpc/rb_server_credentials.h
index 3918951..2a2e1fb 100644
--- a/src/ruby/ext/grpc/rb_server_credentials.h
+++ b/src/ruby/ext/grpc/rb_server_credentials.h
@@ -47,4 +47,4 @@
 /* Gets the wrapped server_credentials from the ruby wrapper */
 grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v);
 
-#endif  /* GRPC_RB_SERVER_CREDENTIALS_H_ */
+#endif /* GRPC_RB_SERVER_CREDENTIALS_H_ */