Skip to content

Commit

Permalink
protoxform: remove blank line spacing in any enum with no comments.
Browse files Browse the repository at this point in the history
Part of envoyproxy#8082.

Signed-off-by: Harvey Tuch <htuch@google.com>
  • Loading branch information
htuch committed Sep 23, 2019
1 parent 74ced53 commit d4c4b4a
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 53 deletions.
1 change: 0 additions & 1 deletion api/envoy/admin/v2alpha/metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ option java_package = "io.envoyproxy.envoy.admin.v2alpha";
message SimpleMetric {
enum Type {
COUNTER = 0;

GAUGE = 1;
}

Expand Down
1 change: 0 additions & 1 deletion api/envoy/admin/v2alpha/server_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ message ServerInfo {
message CommandLineOptions {
enum IpVersion {
v4 = 0;

v6 = 1;
}

Expand Down
4 changes: 0 additions & 4 deletions api/envoy/api/v2/cds.proto
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ message Cluster {
// ignored.
enum DnsLookupFamily {
AUTO = 0;

V4_ONLY = 1;

V6_ONLY = 2;
}

Expand Down Expand Up @@ -185,9 +183,7 @@ message Cluster {
// endpoints matching the values from the default_subset field.
enum LbSubsetFallbackPolicy {
NO_FALLBACK = 0;

ANY_ENDPOINT = 1;

DEFAULT_SUBSET = 2;
}

Expand Down
10 changes: 0 additions & 10 deletions api/envoy/api/v2/core/base.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,20 @@ import "validate/validate.proto";
// over a single upstream connection.
enum RoutingPriority {
DEFAULT = 0;

HIGH = 1;
}

// HTTP request method.
enum RequestMethod {
METHOD_UNSPECIFIED = 0;

GET = 1;

HEAD = 2;

POST = 3;

PUT = 4;

DELETE = 5;

CONNECT = 6;

OPTIONS = 7;

TRACE = 8;

PATCH = 9;
}

Expand Down
1 change: 0 additions & 1 deletion api/envoy/api/v2/route/route.proto
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ message RouteAction {
// Configures :ref:`internal redirect <arch_overview_internal_redirects>` behavior.
enum InternalRedirectAction {
PASS_THROUGH_INTERNAL_REDIRECT = 0;

HANDLE_INTERNAL_REDIRECT = 1;
}

Expand Down
16 changes: 0 additions & 16 deletions api/envoy/config/filter/accesslog/v2/accesslog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -209,37 +209,21 @@ message ResponseFlagFilter {
message GrpcStatusFilter {
enum Status {
OK = 0;

CANCELED = 1;

UNKNOWN = 2;

INVALID_ARGUMENT = 3;

DEADLINE_EXCEEDED = 4;

NOT_FOUND = 5;

ALREADY_EXISTS = 6;

PERMISSION_DENIED = 7;

RESOURCE_EXHAUSTED = 8;

FAILED_PRECONDITION = 9;

ABORTED = 10;

OUT_OF_RANGE = 11;

UNIMPLEMENTED = 12;

INTERNAL = 13;

UNAVAILABLE = 14;

DATA_LOSS = 15;

UNAUTHENTICATED = 16;
}

Expand Down
5 changes: 0 additions & 5 deletions api/envoy/config/filter/http/gzip/v2/gzip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,15 @@ import "validate/validate.proto";
message Gzip {
enum CompressionStrategy {
DEFAULT = 0;

FILTERED = 1;

HUFFMAN = 2;

RLE = 3;
}

message CompressionLevel {
enum Enum {
DEFAULT = 0;

BEST = 1;

SPEED = 2;
}
}
Expand Down
7 changes: 0 additions & 7 deletions api/envoy/data/accesslog/v2/accesslog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ message HTTPAccessLogEntry {
// HTTP version
enum HTTPVersion {
PROTOCOL_UNSPECIFIED = 0;

HTTP10 = 1;

HTTP11 = 2;

HTTP2 = 3;
}

Expand Down Expand Up @@ -239,13 +236,9 @@ message ResponseFlags {
message TLSProperties {
enum TLSVersion {
VERSION_UNSPECIFIED = 0;

TLSv1 = 1;

TLSv1_1 = 2;

TLSv1_2 = 3;

TLSv1_3 = 4;
}

Expand Down
5 changes: 0 additions & 5 deletions api/envoy/data/core/v2alpha/health_check_event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@ import "validate/validate.proto";

enum HealthCheckFailureType {
ACTIVE = 0;

PASSIVE = 1;

NETWORK = 2;
}

enum HealthCheckerType {
HTTP = 0;

TCP = 1;

GRPC = 2;

REDIS = 3;
}

Expand Down
9 changes: 6 additions & 3 deletions tools/protoxform/protoxform.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,13 @@ def VisitService(self, service_proto, type_context):

def VisitEnum(self, enum_proto, type_context):
leading_comment, trailing_comment = FormatTypeContextComments(type_context)
values = '\n'.join(
values = [
FormatEnumValue(type_context.ExtendField(index, value.name), value)
for index, value in enumerate(enum_proto.value))
return '%senum %s {\n%s%s\n}\n' % (leading_comment, enum_proto.name, trailing_comment, values)
for index, value in enumerate(enum_proto.value)
]
joined_values = ('\n' if any('//' in v for v in values) else '').join(values)
return '%senum %s {\n%s%s\n}\n' % (leading_comment, enum_proto.name, trailing_comment,
joined_values)

def VisitMessage(self, msg_proto, type_context, nested_msgs, nested_enums):
leading_comment, trailing_comment = FormatTypeContextComments(type_context)
Expand Down

0 comments on commit d4c4b4a

Please sign in to comment.