From 32e9b051fece34f8c7d5d677ca09c5eb4f587310 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 21 Sep 2025 22:40:40 +0200 Subject: [PATCH 1/6] Format protofiles using Buf --- .../tests/inputs/any/any.proto | 8 +- .../tests/inputs/bool/bool.proto | 2 +- .../tests/inputs/bytes/bytes.proto | 2 +- .../tests/inputs/casing/casing.proto | 4 +- .../casing_inner_class.proto | 2 +- .../casing_message_field_uppercase.proto | 2 +- .../tests/inputs/compiler_lib/plugin.proto | 6 +- .../tests/inputs/deprecated/deprecated.proto | 20 ++-- .../inputs/documentation/documentation.proto | 50 ++++----- .../tests/inputs/double/double.proto | 2 +- .../inputs/empty_service/empty_service.proto | 3 +- .../encoding_decoding/encoding_decoding.proto | 12 +- .../tests/inputs/entry/entry.proto | 4 +- .../tests/inputs/enum/enum.proto | 58 +++++----- .../tests/inputs/example/example.proto | 72 +++++------- .../example_service/example_service.proto | 4 +- .../tests/inputs/features/features.proto | 104 +++++++++--------- .../field_name_identical_to_type.proto | 12 +- .../tests/inputs/float/float.proto | 14 +-- .../google_impl_behavior_equivalence.proto | 10 +- .../inputs/googletypes/googletypes.proto | 2 +- .../googletypes_request.proto | 28 +++-- .../googletypes_response.proto | 22 ++-- .../googletypes_response_embedded.proto | 24 ++-- .../googletypes_service_returns_empty.proto | 6 +- ...ogletypes_service_returns_googletype.proto | 11 +- .../grpc_reflection_v1/reflection.proto | 5 +- .../grpclib_reflection/example_service.proto | 4 +- .../grpclib_reflection/reflection.proto | 5 +- .../capitalized.proto | 5 +- .../child.proto | 4 +- .../package_message.proto | 6 +- .../child.proto | 4 +- .../import_child_scoping_rules/child.proto | 4 +- .../import_child_scoping_rules.proto | 2 +- .../import_child_scoping_rules/package.proto | 10 +- .../import_circular_dependency.proto | 2 +- .../import_circular_dependency/other.proto | 4 +- .../import_circular_dependency/root.proto | 4 +- .../inputs/import_cousin_package/cousin.proto | 3 +- .../inputs/import_cousin_package/test.proto | 2 +- .../cousin.proto | 3 +- .../test.proto | 2 +- .../child.proto | 4 +- ...mport_nested_child_package_from_root.proto | 2 +- .../import_packages_same_name.proto | 2 +- .../import_packages_same_name/posts_v1.proto | 4 +- .../import_packages_same_name/users_v1.proto | 4 +- .../import_parent_package_from_child.proto | 4 +- .../parent_package_message.proto | 3 +- .../child.proto | 2 +- .../import_root_package_from_child/root.proto | 4 +- .../inputs/import_root_sibling/sibling.proto | 4 +- .../child_package_request_message.proto | 4 +- .../import_service_input_message.proto | 19 ++-- .../request_message.proto | 4 +- .../tests/inputs/int32/int32.proto | 6 +- .../inputs/invalid_field/invalid_field.proto | 2 +- .../manual_validation/manual_validation.proto | 2 +- .../tests/inputs/map/map.proto | 2 +- .../tests/inputs/mapmessage/mapmessage.proto | 2 +- .../message_wrapping/message_wrapping.proto | 8 +- .../namespace_builtin_types.proto | 50 ++++----- .../namespace_keywords.proto | 72 ++++++------ .../tests/inputs/nested/nested.proto | 30 ++--- .../tests/inputs/nested2/nested2.proto | 20 ++-- .../tests/inputs/nested2/package.proto | 4 +- .../inputs/nestedtwice/nestedtwice.proto | 6 +- .../tests/inputs/oneof/oneof.proto | 1 - .../oneof_default_value_serialization.proto | 24 ++-- .../tests/inputs/oneof_enum/oneof_enum.proto | 2 +- .../tests/inputs/pickling/pickling.proto | 33 +++--- .../proto3_field_presence.proto | 24 ++-- .../proto3_field_presence_oneof.proto | 14 +-- .../recursivemessage/recursivemessage.proto | 11 +- .../tests/inputs/ref/repeatedmessage.proto | 2 +- .../regression_387/regression_387.proto | 2 +- .../regression_414/regression_414.proto | 2 +- .../tests/inputs/repeated/repeated.proto | 2 +- .../repeated_duration_timestamp.proto | 5 +- .../repeatedmessage/repeatedmessage.proto | 2 +- .../repeatedpacked/repeatedpacked.proto | 6 +- .../rpc_empty_input_message.proto | 4 +- .../tests/inputs/service/service.proto | 8 +- .../service_separate_packages/messages.proto | 4 +- .../service_separate_packages/service.proto | 12 +- .../inputs/service_uppercase/service.proto | 2 +- .../tests/inputs/signed/signed.proto | 10 +- .../simple_service/simple_service.proto | 12 +- .../inputs/stream_stream/stream_stream.proto | 2 +- .../timestamp_dict_encode.proto | 2 +- .../tests/inputs/unwrap/unwrap.proto | 4 +- .../tests/inputs/validation/validation.proto | 24 ++-- 93 files changed, 486 insertions(+), 545 deletions(-) diff --git a/betterproto2_compiler/tests/inputs/any/any.proto b/betterproto2_compiler/tests/inputs/any/any.proto index 5bb95d71..0c50c505 100644 --- a/betterproto2_compiler/tests/inputs/any/any.proto +++ b/betterproto2_compiler/tests/inputs/any/any.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -import "google/protobuf/any.proto"; - package any; +import "google/protobuf/any.proto"; + message Person { - string first_name = 1; - string last_name = 2; + string first_name = 1; + string last_name = 2; } diff --git a/betterproto2_compiler/tests/inputs/bool/bool.proto b/betterproto2_compiler/tests/inputs/bool/bool.proto index 77836b8e..b99a9e0d 100644 --- a/betterproto2_compiler/tests/inputs/bool/bool.proto +++ b/betterproto2_compiler/tests/inputs/bool/bool.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package bool; message Test { - bool value = 1; + bool value = 1; } diff --git a/betterproto2_compiler/tests/inputs/bytes/bytes.proto b/betterproto2_compiler/tests/inputs/bytes/bytes.proto index 98954685..081d375d 100644 --- a/betterproto2_compiler/tests/inputs/bytes/bytes.proto +++ b/betterproto2_compiler/tests/inputs/bytes/bytes.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package bytes; message Test { - bytes data = 1; + bytes data = 1; } diff --git a/betterproto2_compiler/tests/inputs/casing/casing.proto b/betterproto2_compiler/tests/inputs/casing/casing.proto index 2023d934..c989f493 100644 --- a/betterproto2_compiler/tests/inputs/casing/casing.proto +++ b/betterproto2_compiler/tests/inputs/casing/casing.proto @@ -15,6 +15,4 @@ message Test { int32 UPPERCASE = 4; } -message snake_case_message { - -} \ No newline at end of file +message snake_case_message {} diff --git a/betterproto2_compiler/tests/inputs/casing_inner_class/casing_inner_class.proto b/betterproto2_compiler/tests/inputs/casing_inner_class/casing_inner_class.proto index 7d231beb..ddf9f1dd 100644 --- a/betterproto2_compiler/tests/inputs/casing_inner_class/casing_inner_class.proto +++ b/betterproto2_compiler/tests/inputs/casing_inner_class/casing_inner_class.proto @@ -8,4 +8,4 @@ message Test { sint32 old_exp = 1; } inner_class inner = 2; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/casing_message_field_uppercase/casing_message_field_uppercase.proto b/betterproto2_compiler/tests/inputs/casing_message_field_uppercase/casing_message_field_uppercase.proto index c6d42c31..39b431df 100644 --- a/betterproto2_compiler/tests/inputs/casing_message_field_uppercase/casing_message_field_uppercase.proto +++ b/betterproto2_compiler/tests/inputs/casing_message_field_uppercase/casing_message_field_uppercase.proto @@ -6,4 +6,4 @@ message Test { int32 UPPERCASE = 1; int32 UPPERCASE_V2 = 2; int32 UPPER_CAMEL_CASE = 3; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/compiler_lib/plugin.proto b/betterproto2_compiler/tests/inputs/compiler_lib/plugin.proto index 4c7ef0dd..5f799f9b 100644 --- a/betterproto2_compiler/tests/inputs/compiler_lib/plugin.proto +++ b/betterproto2_compiler/tests/inputs/compiler_lib/plugin.proto @@ -21,13 +21,13 @@ syntax = "proto2"; package google.protobuf.compiler; -option java_package = "com.google.protobuf.compiler"; -option java_outer_classname = "PluginProtos"; import "google/protobuf/descriptor.proto"; option csharp_namespace = "Google.Protobuf.Compiler"; option go_package = "google.golang.org/protobuf/types/pluginpb"; +option java_outer_classname = "PluginProtos"; +option java_package = "com.google.protobuf.compiler"; // The version number of protocol compiler. message Version { @@ -177,4 +177,4 @@ message CodeGeneratorResponse { optional GeneratedCodeInfo generated_code_info = 16; } repeated File file = 15; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/deprecated/deprecated.proto b/betterproto2_compiler/tests/inputs/deprecated/deprecated.proto index 2e64c621..1b909bc8 100644 --- a/betterproto2_compiler/tests/inputs/deprecated/deprecated.proto +++ b/betterproto2_compiler/tests/inputs/deprecated/deprecated.proto @@ -4,21 +4,23 @@ package deprecated; // Some documentation about the Test message. message Test { - Message message = 1 [deprecated=true]; - int32 value = 2; - message Nested { - int32 nested_value = 1 [deprecated=true]; - } + Message message = 1 [deprecated = true]; + int32 value = 2; + message Nested { + int32 nested_value = 1 [deprecated = true]; + } } message Message { - option deprecated = true; - string value = 1; + option deprecated = true; + string value = 1; } message Empty {} service TestService { - rpc func(Empty) returns (Empty); - rpc deprecated_func(Empty) returns (Empty) { option deprecated = true; }; + rpc func(Empty) returns (Empty); + rpc deprecated_func(Empty) returns (Empty) { + option deprecated = true; + } } diff --git a/betterproto2_compiler/tests/inputs/documentation/documentation.proto b/betterproto2_compiler/tests/inputs/documentation/documentation.proto index e2d24f55..6b99c2ff 100644 --- a/betterproto2_compiler/tests/inputs/documentation/documentation.proto +++ b/betterproto2_compiler/tests/inputs/documentation/documentation.proto @@ -7,26 +7,26 @@ package documentation; // Documentation of message 2 // other line 2 message Test { // Documentation of message 3 - // Documentation of field 1 - // other line 1 + // Documentation of field 1 + // other line 1 - // Documentation of field 2 - // other line 2 - uint32 x = 1; // Documentation of field 3 + // Documentation of field 2 + // other line 2 + uint32 x = 1; // Documentation of field 3 - // Documentation of oneof 1 + // Documentation of oneof 1 + // other line 1 + + // Documentation of oneof 2 + // other line 2 + oneof oneof_example { // Documentation of oneof 3 + // Documentation of oneof field 1 // other line 1 - // Documentation of oneof 2 + // Documentation of oneof field 2 // other line 2 - oneof oneof_example { // Documentation of oneof 3 - // Documentation of oneof field 1 - // other line 1 - - // Documentation of oneof field 2 - // other line 2 - int32 a = 2; // Documentation of oneof field 3 - } + int32 a = 2; // Documentation of oneof field 3 + } } // Documentation of enum 1 @@ -35,12 +35,12 @@ message Test { // Documentation of message 3 // Documentation of enum 2 // other line 2 enum Enum { // Documentation of enum 3 - // Documentation of variant 1 - // other line 1 + // Documentation of variant 1 + // other line 1 - // Documentation of variant 2 - // other line 2 - Enum_Variant = 0; // Documentation of variant 3 + // Documentation of variant 2 + // other line 2 + Enum_Variant = 0; // Documentation of variant 3 } // Documentation of service 1 @@ -49,12 +49,12 @@ enum Enum { // Documentation of enum 3 // Documentation of service 2 // other line 2 service Service { // Documentation of service 3 - // Documentation of method 1 - // other line 1 + // Documentation of method 1 + // other line 1 - // Documentation of method 2 - // other line 2 - rpc get(Test) returns (Test); // Documentation of method 3 + // Documentation of method 2 + // other line 2 + rpc get(Test) returns (Test); // Documentation of method 3 } // A comment with backslashes \ and triple quotes """ diff --git a/betterproto2_compiler/tests/inputs/double/double.proto b/betterproto2_compiler/tests/inputs/double/double.proto index 66aea95d..bc1b72f5 100644 --- a/betterproto2_compiler/tests/inputs/double/double.proto +++ b/betterproto2_compiler/tests/inputs/double/double.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package double; message Test { - double count = 1; + double count = 1; } diff --git a/betterproto2_compiler/tests/inputs/empty_service/empty_service.proto b/betterproto2_compiler/tests/inputs/empty_service/empty_service.proto index e96ff649..64ceae08 100644 --- a/betterproto2_compiler/tests/inputs/empty_service/empty_service.proto +++ b/betterproto2_compiler/tests/inputs/empty_service/empty_service.proto @@ -3,5 +3,4 @@ syntax = "proto3"; package empty_service; -service Test { -} +service Test {} diff --git a/betterproto2_compiler/tests/inputs/encoding_decoding/encoding_decoding.proto b/betterproto2_compiler/tests/inputs/encoding_decoding/encoding_decoding.proto index 2cf8e391..ddd485bc 100644 --- a/betterproto2_compiler/tests/inputs/encoding_decoding/encoding_decoding.proto +++ b/betterproto2_compiler/tests/inputs/encoding_decoding/encoding_decoding.proto @@ -3,13 +3,13 @@ syntax = "proto3"; package encoding_decoding; message Overflow32 { - uint32 uint = 1; - int32 int = 2; - sint32 sint = 3; + uint32 uint = 1; + int32 int = 2; + sint32 sint = 3; } message Overflow64 { - uint64 uint = 1; - int64 int = 2; - sint64 sint = 3; + uint64 uint = 1; + int64 int = 2; + sint64 sint = 3; } diff --git a/betterproto2_compiler/tests/inputs/entry/entry.proto b/betterproto2_compiler/tests/inputs/entry/entry.proto index 3f2af4d1..618b3197 100644 --- a/betterproto2_compiler/tests/inputs/entry/entry.proto +++ b/betterproto2_compiler/tests/inputs/entry/entry.proto @@ -12,9 +12,9 @@ package entry; // error because the parent type does not have a "nested_type" attribute. message Test { - repeated ExportEntry export = 1; + repeated ExportEntry export = 1; } message ExportEntry { - string name = 1; + string name = 1; } diff --git a/betterproto2_compiler/tests/inputs/enum/enum.proto b/betterproto2_compiler/tests/inputs/enum/enum.proto index 5d97db67..01a05bf8 100644 --- a/betterproto2_compiler/tests/inputs/enum/enum.proto +++ b/betterproto2_compiler/tests/inputs/enum/enum.proto @@ -4,64 +4,64 @@ package enum; // Tests that enums are correctly serialized and that it correctly handles skipped and out-of-order enum values message Test { - Choice choice = 1; - repeated Choice choices = 2; + Choice choice = 1; + repeated Choice choices = 2; } enum Choice { - ZERO = 0; - ONE = 1; - // TWO = 2; - FOUR = 4; - THREE = 3; - MINUS_ONE = -1; + ZERO = 0; + ONE = 1; + // TWO = 2; + FOUR = 4; + THREE = 3; + MINUS_ONE = -1; } // A "C" like enum with the enum name prefixed onto members, these should be stripped enum ArithmeticOperator { - ARITHMETIC_OPERATOR_NONE = 0; - ARITHMETIC_OPERATOR_PLUS = 1; - ARITHMETIC_OPERATOR_MINUS = 2; - ARITHMETIC_OPERATOR_0_PREFIXED = 3; + ARITHMETIC_OPERATOR_NONE = 0; + ARITHMETIC_OPERATOR_PLUS = 1; + ARITHMETIC_OPERATOR_MINUS = 2; + ARITHMETIC_OPERATOR_0_PREFIXED = 3; } // If not all the fields are prefixed, the prefix should not be stripped at all enum NoStriping { - NO_STRIPING_NONE = 0; - NO_STRIPING_A = 1; - B = 2; + NO_STRIPING_NONE = 0; + NO_STRIPING_A = 1; + B = 2; } // Make sure that the prefix are removed even if it's difficult to infer the position // of underscores. enum HTTPCode { - HTTP_CODE_UNSPECIFIED = 0; - HTTP_CODE_OK = 200; - HTTP_CODE_NOT_FOUND = 404; + HTTP_CODE_UNSPECIFIED = 0; + HTTP_CODE_OK = 200; + HTTP_CODE_NOT_FOUND = 404; } message EnumMessage { - ArithmeticOperator arithmetic_operator = 1; - NoStriping no_striping = 2; + ArithmeticOperator arithmetic_operator = 1; + NoStriping no_striping = 2; } enum OldVersion { - OLD_VERSION_UNSPECIFIED = 0; - OLD_VERSION_V1 = 1; - OLD_VERSION_V2 = 2; + OLD_VERSION_UNSPECIFIED = 0; + OLD_VERSION_V1 = 1; + OLD_VERSION_V2 = 2; } message OldVersionMessage { - OldVersion old_version = 1; + OldVersion old_version = 1; } enum NewVersion { - NEW_VERSION_UNSPECIFIED = 0; - NEW_VERSION_V1 = 1; - NEW_VERSION_V2 = 2; - NEW_VERSION_V3 = 3; + NEW_VERSION_UNSPECIFIED = 0; + NEW_VERSION_V1 = 1; + NEW_VERSION_V2 = 2; + NEW_VERSION_V3 = 3; } message NewVersionMessage { - NewVersion new_version = 1; + NewVersion new_version = 1; } diff --git a/betterproto2_compiler/tests/inputs/example/example.proto b/betterproto2_compiler/tests/inputs/example/example.proto index 56bd3647..c0ea8c9b 100644 --- a/betterproto2_compiler/tests/inputs/example/example.proto +++ b/betterproto2_compiler/tests/inputs/example/example.proto @@ -36,20 +36,17 @@ // A valid .proto file can be translated directly to a FileDescriptorProto // without any other information (e.g. without reading its imports). - syntax = "proto2"; package example; +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.Reflection"; // package google.protobuf; - option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; +option java_package = "com.google.protobuf"; option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - // descriptor.proto must be optimized for speed because reflection-based // algorithms don't work during bootstrapping. option optimize_for = SPEED; @@ -62,8 +59,8 @@ message FileDescriptorSet { // Describes a complete .proto file. message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. // Names of files imported by this file. repeated string dependency = 3; @@ -103,8 +100,8 @@ message DescriptorProto { repeated EnumDescriptorProto enum_type = 4; message ExtensionRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. optional ExtensionRangeOptions options = 3; } @@ -118,8 +115,8 @@ message DescriptorProto { // fields or extension ranges in the same message. Reserved ranges may // not overlap. message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. } repeated ReservedRange reserved_range = 9; // Reserved field names, which may not be used by fields in the same message. @@ -131,7 +128,6 @@ message ExtensionRangeOptions { // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; - // Clients can define custom options in extensions of this message. See above. extensions 1000 to max; } @@ -159,7 +155,7 @@ message FieldDescriptorProto { // implementations should still be able to parse the group wire format and // treat group fields as unknown fields. TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. + TYPE_MESSAGE = 11; // Length-delimited aggregate. // New in version 2. TYPE_BYTES = 12; @@ -167,8 +163,8 @@ message FieldDescriptorProto { TYPE_ENUM = 14; TYPE_SFIXED32 = 15; TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. } enum Label { @@ -261,8 +257,8 @@ message EnumDescriptorProto { // is inclusive such that it can appropriately represent the entire int32 // domain. message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. } // Range of reserved numeric values. Reserved numeric values may not be used @@ -308,7 +304,6 @@ message MethodDescriptorProto { optional bool server_streaming = 6 [default = false]; } - // =================================================================== // Options @@ -342,14 +337,12 @@ message MethodDescriptorProto { // to automatically assign option numbers. message FileOptions { - // Sets the Java package where classes generated from this .proto will be // placed. By default, the proto package is used, but this is often // inappropriate because proto packages do not normally start with backwards // domain names. optional string java_package = 1; - // If set, all the classes from the .proto file are wrapped in a single // outer class with the given name. This applies to both Proto1 // (equivalent to the old "--one_java_file" option) and Proto2 (where @@ -366,7 +359,7 @@ message FileOptions { optional bool java_multiple_files = 10 [default = false]; // This option does nothing. - optional bool java_generate_equals_and_hash = 20 [deprecated=true]; + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; // If set true, then the Java2 code generator will generate code that // throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -376,13 +369,12 @@ message FileOptions { // This option has no effect on when used with the lite runtime. optional bool java_string_check_utf8 = 27 [default = false]; - // Generated classes can be optimized for speed or code size. enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. } optional OptimizeMode optimize_for = 9 [default = SPEED]; @@ -393,9 +385,6 @@ message FileOptions { // - Otherwise, the basename of the .proto file, without extension. optional string go_package = 11; - - - // Should generic services be generated in each language? "Generic" services // are not specific to any particular RPC system. They are generated by the // main code generators in each language (without additional plugins). @@ -421,7 +410,6 @@ message FileOptions { // only to generated classes for C++. optional bool cc_enable_arenas = 31 [default = true]; - // Sets the objective c class prefix which is prepended to all objective c // generated classes from this .proto. There is no default. optional string objc_class_prefix = 36; @@ -454,7 +442,6 @@ message FileOptions { // determining the ruby package. optional string ruby_package = 45; - // The parser stores options it doesn't recognize here. // See the documentation for the "Options" section above. repeated UninterpretedOption uninterpreted_option = 999; @@ -521,9 +508,8 @@ message MessageOptions { // parser. optional bool map_entry = 7; - reserved 8; // javalite_serializable - reserved 9; // javanano_as_lite - + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -615,14 +601,13 @@ message FieldOptions { // For Google-internal migration only. Do not use. optional bool weak = 10 [default = false]; - // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; // Clients can define custom options in extensions of this message. See above. extensions 1000 to max; - reserved 4; // removed jtype + reserved 4; // removed jtype } message OneofOptions { @@ -634,7 +619,6 @@ message OneofOptions { } message EnumOptions { - // Set this option to true to allow mapping different tag names to the same // value. optional bool allow_alias = 2; @@ -645,7 +629,7 @@ message EnumOptions { // is a formalization for deprecating enums. optional bool deprecated = 3 [default = false]; - reserved 5; // javanano_as_lite + reserved 5; // javanano_as_lite // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -669,7 +653,6 @@ message EnumValueOptions { } message ServiceOptions { - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC // framework. We apologize for hoarding these numbers to ourselves, but // we were already using them long before we decided to release Protocol @@ -689,7 +672,6 @@ message ServiceOptions { } message MethodOptions { - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC // framework. We apologize for hoarding these numbers to ourselves, but // we were already using them long before we decided to release Protocol @@ -706,11 +688,10 @@ message MethodOptions { // methods, and PUT verb for idempotent methods instead of the default POST. enum IdempotencyLevel { IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects } - optional IdempotencyLevel idempotency_level = 34 - [default = IDEMPOTENCY_UNKNOWN]; + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -719,7 +700,6 @@ message MethodOptions { extensions 1000 to max; } - // A message representing a option the parser does not recognize. This only // appears in options protos created by the compiler::Parser class. // DescriptorPool resolves these when building Descriptor objects. Therefore, diff --git a/betterproto2_compiler/tests/inputs/example_service/example_service.proto b/betterproto2_compiler/tests/inputs/example_service/example_service.proto index 4ef60236..cea65e0b 100644 --- a/betterproto2_compiler/tests/inputs/example_service/example_service.proto +++ b/betterproto2_compiler/tests/inputs/example_service/example_service.proto @@ -13,12 +13,12 @@ service Test { message ExampleRequest { string example_string = 1; - int64 example_integer = 2; + int64 example_integer = 2; google.protobuf.Struct example_struct = 3; } message ExampleResponse { string example_string = 1; - int64 example_integer = 2; + int64 example_integer = 2; google.protobuf.Struct example_struct = 3; } diff --git a/betterproto2_compiler/tests/inputs/features/features.proto b/betterproto2_compiler/tests/inputs/features/features.proto index 760abca8..fdc70af6 100644 --- a/betterproto2_compiler/tests/inputs/features/features.proto +++ b/betterproto2_compiler/tests/inputs/features/features.proto @@ -1,108 +1,108 @@ syntax = "proto3"; -import "google/protobuf/timestamp.proto"; +package features; + import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; -package features; - message Bar { - string name = 1; + string name = 1; } message Foo { - string name = 1; - Bar child = 2; + string name = 1; + Bar child = 2; } enum Enum { - ZERO = 0; - ONE = 1; + ZERO = 0; + ONE = 1; } message EnumMsg { - Enum enum = 1; + Enum enum = 1; } message Newer { - bool x = 1; - int32 y = 2; - string z = 3; + bool x = 1; + int32 y = 2; + string z = 3; } message Older { - bool x = 1; + bool x = 1; } message IntMsg { - int32 val = 1; + int32 val = 1; } message OneofMsg { - oneof group1 { - int32 x = 1; - string y = 2; - } - oneof group2 { - IntMsg a = 3; - string b = 4; - } + oneof group1 { + int32 x = 1; + string y = 2; + } + oneof group2 { + IntMsg a = 3; + string b = 4; + } } message JsonCasingMsg { - int32 pascal_case = 1; - int32 camel_case = 2; - int32 snake_case = 3; - int32 kabob_case = 4; + int32 pascal_case = 1; + int32 camel_case = 2; + int32 snake_case = 3; + int32 kabob_case = 4; } message OptionalBoolMsg { - google.protobuf.BoolValue field = 1; + google.protobuf.BoolValue field = 1; } message OptionalDatetimeMsg { - google.protobuf.Timestamp field = 1; + google.protobuf.Timestamp field = 1; } message Empty {} message TimeMsg { - google.protobuf.Timestamp timestamp = 1; - google.protobuf.Duration duration = 2; + google.protobuf.Timestamp timestamp = 1; + google.protobuf.Duration duration = 2; } message MsgA { - int32 some_int = 1; - double some_double = 2; - string some_str = 3; - bool some_bool = 4; + int32 some_int = 1; + double some_double = 2; + string some_str = 3; + bool some_bool = 4; } message MsgB { - int32 some_int = 1; - double some_double = 2; - string some_str = 3; - bool some_bool = 4; - int32 some_default_int = 5; - double some_default_double = 6; - string some_default_str = 7; - bool some_default_bool = 8; + int32 some_int = 1; + double some_double = 2; + string some_str = 3; + bool some_bool = 4; + int32 some_default_int = 5; + double some_default_double = 6; + string some_default_str = 7; + bool some_default_bool = 8; } message MsgC { - oneof group1 { - int32 int_field = 1; - string string_field = 2; - Empty empty_field = 3; - } + oneof group1 { + int32 int_field = 1; + string string_field = 2; + Empty empty_field = 3; + } } message MsgD { - repeated google.protobuf.Timestamp timestamps = 1; + repeated google.protobuf.Timestamp timestamps = 1; } message MsgE { - bool bool_field = 1; - optional int32 int_field = 2; - repeated string str_field = 3; -} \ No newline at end of file + bool bool_field = 1; + optional int32 int_field = 2; + repeated string str_field = 3; +} diff --git a/betterproto2_compiler/tests/inputs/field_name_identical_to_type/field_name_identical_to_type.proto b/betterproto2_compiler/tests/inputs/field_name_identical_to_type/field_name_identical_to_type.proto index 81a0fc43..d11eff54 100644 --- a/betterproto2_compiler/tests/inputs/field_name_identical_to_type/field_name_identical_to_type.proto +++ b/betterproto2_compiler/tests/inputs/field_name_identical_to_type/field_name_identical_to_type.proto @@ -5,9 +5,9 @@ package field_name_identical_to_type; // Tests that messages may contain fields with names that are identical to their python types (PR #294) message Test { - int32 int = 1; - float float = 2; - string str = 3; - bytes bytes = 4; - bool bool = 5; -} \ No newline at end of file + int32 int = 1; + float float = 2; + string str = 3; + bytes bytes = 4; + bool bool = 5; +} diff --git a/betterproto2_compiler/tests/inputs/float/float.proto b/betterproto2_compiler/tests/inputs/float/float.proto index fea12b3d..73974665 100644 --- a/betterproto2_compiler/tests/inputs/float/float.proto +++ b/betterproto2_compiler/tests/inputs/float/float.proto @@ -4,11 +4,11 @@ package float; // Some documentation about the Test message. message Test { - double positive = 1; - double negative = 2; - double nan = 3; - double three = 4; - double three_point_one_four = 5; - double neg_three = 6; - double neg_three_point_one_four = 7; + double positive = 1; + double negative = 2; + double nan = 3; + double three = 4; + double three_point_one_four = 5; + double neg_three = 6; + double neg_three_point_one_four = 7; } diff --git a/betterproto2_compiler/tests/inputs/google_impl_behavior_equivalence/google_impl_behavior_equivalence.proto b/betterproto2_compiler/tests/inputs/google_impl_behavior_equivalence/google_impl_behavior_equivalence.proto index 66ef8a64..6ea7eaef 100644 --- a/betterproto2_compiler/tests/inputs/google_impl_behavior_equivalence/google_impl_behavior_equivalence.proto +++ b/betterproto2_compiler/tests/inputs/google_impl_behavior_equivalence/google_impl_behavior_equivalence.proto @@ -1,9 +1,11 @@ syntax = "proto3"; +package google_impl_behavior_equivalence; import "google/protobuf/timestamp.proto"; -package google_impl_behavior_equivalence; -message Foo { int64 bar = 1; } +message Foo { + int64 bar = 1; +} message Test { oneof group { @@ -17,6 +19,8 @@ message Spam { google.protobuf.Timestamp ts = 1; } -message Request { Empty foo = 1; } +message Request { + Empty foo = 1; +} message Empty {} diff --git a/betterproto2_compiler/tests/inputs/googletypes/googletypes.proto b/betterproto2_compiler/tests/inputs/googletypes/googletypes.proto index ef8cb4a1..3d0f4494 100644 --- a/betterproto2_compiler/tests/inputs/googletypes/googletypes.proto +++ b/betterproto2_compiler/tests/inputs/googletypes/googletypes.proto @@ -3,9 +3,9 @@ syntax = "proto3"; package googletypes; import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; -import "google/protobuf/empty.proto"; message Test { google.protobuf.BoolValue maybe = 1; diff --git a/betterproto2_compiler/tests/inputs/googletypes_request/googletypes_request.proto b/betterproto2_compiler/tests/inputs/googletypes_request/googletypes_request.proto index 1cedcaaf..914b29f6 100644 --- a/betterproto2_compiler/tests/inputs/googletypes_request/googletypes_request.proto +++ b/betterproto2_compiler/tests/inputs/googletypes_request/googletypes_request.proto @@ -10,20 +10,18 @@ import "google/protobuf/wrappers.proto"; // Tests that google types can be used as params service Test { - rpc SendDouble (google.protobuf.DoubleValue) returns (Input); - rpc SendFloat (google.protobuf.FloatValue) returns (Input); - rpc SendInt64 (google.protobuf.Int64Value) returns (Input); - rpc SendUInt64 (google.protobuf.UInt64Value) returns (Input); - rpc SendInt32 (google.protobuf.Int32Value) returns (Input); - rpc SendUInt32 (google.protobuf.UInt32Value) returns (Input); - rpc SendBool (google.protobuf.BoolValue) returns (Input); - rpc SendString (google.protobuf.StringValue) returns (Input); - rpc SendBytes (google.protobuf.BytesValue) returns (Input); - rpc SendDatetime (google.protobuf.Timestamp) returns (Input); - rpc SendTimedelta (google.protobuf.Duration) returns (Input); - rpc SendEmpty (google.protobuf.Empty) returns (Input); + rpc SendDouble(google.protobuf.DoubleValue) returns (Input); + rpc SendFloat(google.protobuf.FloatValue) returns (Input); + rpc SendInt64(google.protobuf.Int64Value) returns (Input); + rpc SendUInt64(google.protobuf.UInt64Value) returns (Input); + rpc SendInt32(google.protobuf.Int32Value) returns (Input); + rpc SendUInt32(google.protobuf.UInt32Value) returns (Input); + rpc SendBool(google.protobuf.BoolValue) returns (Input); + rpc SendString(google.protobuf.StringValue) returns (Input); + rpc SendBytes(google.protobuf.BytesValue) returns (Input); + rpc SendDatetime(google.protobuf.Timestamp) returns (Input); + rpc SendTimedelta(google.protobuf.Duration) returns (Input); + rpc SendEmpty(google.protobuf.Empty) returns (Input); } -message Input { - -} +message Input {} diff --git a/betterproto2_compiler/tests/inputs/googletypes_response/googletypes_response.proto b/betterproto2_compiler/tests/inputs/googletypes_response/googletypes_response.proto index 8917d1c7..5e71bb14 100644 --- a/betterproto2_compiler/tests/inputs/googletypes_response/googletypes_response.proto +++ b/betterproto2_compiler/tests/inputs/googletypes_response/googletypes_response.proto @@ -7,17 +7,15 @@ import "google/protobuf/wrappers.proto"; // Tests that wrapped values can be used directly as return values service Test { - rpc GetDouble (Input) returns (google.protobuf.DoubleValue); - rpc GetFloat (Input) returns (google.protobuf.FloatValue); - rpc GetInt64 (Input) returns (google.protobuf.Int64Value); - rpc GetUInt64 (Input) returns (google.protobuf.UInt64Value); - rpc GetInt32 (Input) returns (google.protobuf.Int32Value); - rpc GetUInt32 (Input) returns (google.protobuf.UInt32Value); - rpc GetBool (Input) returns (google.protobuf.BoolValue); - rpc GetString (Input) returns (google.protobuf.StringValue); - rpc GetBytes (Input) returns (google.protobuf.BytesValue); + rpc GetDouble(Input) returns (google.protobuf.DoubleValue); + rpc GetFloat(Input) returns (google.protobuf.FloatValue); + rpc GetInt64(Input) returns (google.protobuf.Int64Value); + rpc GetUInt64(Input) returns (google.protobuf.UInt64Value); + rpc GetInt32(Input) returns (google.protobuf.Int32Value); + rpc GetUInt32(Input) returns (google.protobuf.UInt32Value); + rpc GetBool(Input) returns (google.protobuf.BoolValue); + rpc GetString(Input) returns (google.protobuf.StringValue); + rpc GetBytes(Input) returns (google.protobuf.BytesValue); } -message Input { - -} +message Input {} diff --git a/betterproto2_compiler/tests/inputs/googletypes_response_embedded/googletypes_response_embedded.proto b/betterproto2_compiler/tests/inputs/googletypes_response_embedded/googletypes_response_embedded.proto index 47284e3a..4c0dc42d 100644 --- a/betterproto2_compiler/tests/inputs/googletypes_response_embedded/googletypes_response_embedded.proto +++ b/betterproto2_compiler/tests/inputs/googletypes_response_embedded/googletypes_response_embedded.proto @@ -6,21 +6,19 @@ import "google/protobuf/wrappers.proto"; // Tests that wrapped values are supported as part of output message service Test { - rpc getOutput (Input) returns (Output); + rpc getOutput(Input) returns (Output); } -message Input { - -} +message Input {} message Output { - google.protobuf.DoubleValue double_value = 1; - google.protobuf.FloatValue float_value = 2; - google.protobuf.Int64Value int64_value = 3; - google.protobuf.UInt64Value uint64_value = 4; - google.protobuf.Int32Value int32_value = 5; - google.protobuf.UInt32Value uint32_value = 6; - google.protobuf.BoolValue bool_value = 7; - google.protobuf.StringValue string_value = 8; - google.protobuf.BytesValue bytes_value = 9; + google.protobuf.DoubleValue double_value = 1; + google.protobuf.FloatValue float_value = 2; + google.protobuf.Int64Value int64_value = 3; + google.protobuf.UInt64Value uint64_value = 4; + google.protobuf.Int32Value int32_value = 5; + google.protobuf.UInt32Value uint32_value = 6; + google.protobuf.BoolValue bool_value = 7; + google.protobuf.StringValue string_value = 8; + google.protobuf.BytesValue bytes_value = 9; } diff --git a/betterproto2_compiler/tests/inputs/googletypes_service_returns_empty/googletypes_service_returns_empty.proto b/betterproto2_compiler/tests/inputs/googletypes_service_returns_empty/googletypes_service_returns_empty.proto index 2153ad5e..ff82f31c 100644 --- a/betterproto2_compiler/tests/inputs/googletypes_service_returns_empty/googletypes_service_returns_empty.proto +++ b/betterproto2_compiler/tests/inputs/googletypes_service_returns_empty/googletypes_service_returns_empty.proto @@ -5,9 +5,7 @@ package googletypes_service_returns_empty; import "google/protobuf/empty.proto"; service Test { - rpc Send (RequestMessage) returns (google.protobuf.Empty) { - } + rpc Send(RequestMessage) returns (google.protobuf.Empty) {} } -message RequestMessage { -} \ No newline at end of file +message RequestMessage {} diff --git a/betterproto2_compiler/tests/inputs/googletypes_service_returns_googletype/googletypes_service_returns_googletype.proto b/betterproto2_compiler/tests/inputs/googletypes_service_returns_googletype/googletypes_service_returns_googletype.proto index 457707b7..2aa19abf 100644 --- a/betterproto2_compiler/tests/inputs/googletypes_service_returns_googletype/googletypes_service_returns_googletype.proto +++ b/betterproto2_compiler/tests/inputs/googletypes_service_returns_googletype/googletypes_service_returns_googletype.proto @@ -8,11 +8,10 @@ import "google/protobuf/struct.proto"; // Tests that imports are generated correctly when returning Google well-known types service Test { - rpc GetEmpty (RequestMessage) returns (google.protobuf.Empty); - rpc GetStruct (RequestMessage) returns (google.protobuf.Struct); - rpc GetListValue (RequestMessage) returns (google.protobuf.ListValue); - rpc GetValue (RequestMessage) returns (google.protobuf.Value); + rpc GetEmpty(RequestMessage) returns (google.protobuf.Empty); + rpc GetStruct(RequestMessage) returns (google.protobuf.Struct); + rpc GetListValue(RequestMessage) returns (google.protobuf.ListValue); + rpc GetValue(RequestMessage) returns (google.protobuf.Value); } -message RequestMessage { -} \ No newline at end of file +message RequestMessage {} diff --git a/betterproto2_compiler/tests/inputs/grpc_reflection_v1/reflection.proto b/betterproto2_compiler/tests/inputs/grpc_reflection_v1/reflection.proto index f9f349fe..b7063108 100644 --- a/betterproto2_compiler/tests/inputs/grpc_reflection_v1/reflection.proto +++ b/betterproto2_compiler/tests/inputs/grpc_reflection_v1/reflection.proto @@ -25,14 +25,13 @@ package grpc.reflection.v1; option go_package = "google.golang.org/grpc/reflection/grpc_reflection_v1"; option java_multiple_files = true; -option java_package = "io.grpc.reflection.v1"; option java_outer_classname = "ServerReflectionProto"; +option java_package = "io.grpc.reflection.v1"; service ServerReflection { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - rpc ServerReflectionInfo(stream ServerReflectionRequest) - returns (stream ServerReflectionResponse); + rpc ServerReflectionInfo(stream ServerReflectionRequest) returns (stream ServerReflectionResponse); } // The message sent by the client when calling ServerReflectionInfo method. diff --git a/betterproto2_compiler/tests/inputs/grpclib_reflection/example_service.proto b/betterproto2_compiler/tests/inputs/grpclib_reflection/example_service.proto index 4ef60236..cea65e0b 100644 --- a/betterproto2_compiler/tests/inputs/grpclib_reflection/example_service.proto +++ b/betterproto2_compiler/tests/inputs/grpclib_reflection/example_service.proto @@ -13,12 +13,12 @@ service Test { message ExampleRequest { string example_string = 1; - int64 example_integer = 2; + int64 example_integer = 2; google.protobuf.Struct example_struct = 3; } message ExampleResponse { string example_string = 1; - int64 example_integer = 2; + int64 example_integer = 2; google.protobuf.Struct example_struct = 3; } diff --git a/betterproto2_compiler/tests/inputs/grpclib_reflection/reflection.proto b/betterproto2_compiler/tests/inputs/grpclib_reflection/reflection.proto index f9f349fe..b7063108 100644 --- a/betterproto2_compiler/tests/inputs/grpclib_reflection/reflection.proto +++ b/betterproto2_compiler/tests/inputs/grpclib_reflection/reflection.proto @@ -25,14 +25,13 @@ package grpc.reflection.v1; option go_package = "google.golang.org/grpc/reflection/grpc_reflection_v1"; option java_multiple_files = true; -option java_package = "io.grpc.reflection.v1"; option java_outer_classname = "ServerReflectionProto"; +option java_package = "io.grpc.reflection.v1"; service ServerReflection { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - rpc ServerReflectionInfo(stream ServerReflectionRequest) - returns (stream ServerReflectionResponse); + rpc ServerReflectionInfo(stream ServerReflectionRequest) returns (stream ServerReflectionResponse); } // The message sent by the client when calling ServerReflectionInfo method. diff --git a/betterproto2_compiler/tests/inputs/import_capitalized_package/capitalized.proto b/betterproto2_compiler/tests/inputs/import_capitalized_package/capitalized.proto index e80c95cd..19dbce97 100644 --- a/betterproto2_compiler/tests/inputs/import_capitalized_package/capitalized.proto +++ b/betterproto2_compiler/tests/inputs/import_capitalized_package/capitalized.proto @@ -1,8 +1,5 @@ syntax = "proto3"; - package import_capitalized_package.Capitalized; -message Message { - -} +message Message {} diff --git a/betterproto2_compiler/tests/inputs/import_child_package_from_package/child.proto b/betterproto2_compiler/tests/inputs/import_child_package_from_package/child.proto index d99c7c31..41859d9d 100644 --- a/betterproto2_compiler/tests/inputs/import_child_package_from_package/child.proto +++ b/betterproto2_compiler/tests/inputs/import_child_package_from_package/child.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_child_package_from_package.package.childpackage; -message ChildMessage { - -} +message ChildMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_child_package_from_package/package_message.proto b/betterproto2_compiler/tests/inputs/import_child_package_from_package/package_message.proto index 79d66f37..01cd46e0 100644 --- a/betterproto2_compiler/tests/inputs/import_child_package_from_package/package_message.proto +++ b/betterproto2_compiler/tests/inputs/import_child_package_from_package/package_message.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -import "child.proto"; - package import_child_package_from_package.package; +import "child.proto"; + message PackageMessage { - package.childpackage.ChildMessage c = 1; + package.childpackage.ChildMessage c = 1; } diff --git a/betterproto2_compiler/tests/inputs/import_child_package_from_root/child.proto b/betterproto2_compiler/tests/inputs/import_child_package_from_root/child.proto index 2a46d5f5..44072920 100644 --- a/betterproto2_compiler/tests/inputs/import_child_package_from_root/child.proto +++ b/betterproto2_compiler/tests/inputs/import_child_package_from_root/child.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_child_package_from_root.childpackage; -message Message { - -} +message Message {} diff --git a/betterproto2_compiler/tests/inputs/import_child_scoping_rules/child.proto b/betterproto2_compiler/tests/inputs/import_child_scoping_rules/child.proto index f491e0da..cd25e8d7 100644 --- a/betterproto2_compiler/tests/inputs/import_child_scoping_rules/child.proto +++ b/betterproto2_compiler/tests/inputs/import_child_scoping_rules/child.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_child_scoping_rules.aaa.bbb.ccc.ddd; -message ChildMessage { - -} +message ChildMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_child_scoping_rules/import_child_scoping_rules.proto b/betterproto2_compiler/tests/inputs/import_child_scoping_rules/import_child_scoping_rules.proto index 272852cc..1e0dc645 100644 --- a/betterproto2_compiler/tests/inputs/import_child_scoping_rules/import_child_scoping_rules.proto +++ b/betterproto2_compiler/tests/inputs/import_child_scoping_rules/import_child_scoping_rules.proto @@ -5,5 +5,5 @@ package import_child_scoping_rules; import "package.proto"; message Test { - aaa.bbb.Msg msg = 1; + aaa.bbb.Msg msg = 1; } diff --git a/betterproto2_compiler/tests/inputs/import_child_scoping_rules/package.proto b/betterproto2_compiler/tests/inputs/import_child_scoping_rules/package.proto index 6b51fe56..2c0fc92a 100644 --- a/betterproto2_compiler/tests/inputs/import_child_scoping_rules/package.proto +++ b/betterproto2_compiler/tests/inputs/import_child_scoping_rules/package.proto @@ -5,9 +5,9 @@ package import_child_scoping_rules.aaa.bbb; import "child.proto"; message Msg { - .import_child_scoping_rules.aaa.bbb.ccc.ddd.ChildMessage a = 1; - import_child_scoping_rules.aaa.bbb.ccc.ddd.ChildMessage b = 2; - aaa.bbb.ccc.ddd.ChildMessage c = 3; - bbb.ccc.ddd.ChildMessage d = 4; - ccc.ddd.ChildMessage e = 5; + .import_child_scoping_rules.aaa.bbb.ccc.ddd.ChildMessage a = 1; + import_child_scoping_rules.aaa.bbb.ccc.ddd.ChildMessage b = 2; + aaa.bbb.ccc.ddd.ChildMessage c = 3; + bbb.ccc.ddd.ChildMessage d = 4; + ccc.ddd.ChildMessage e = 5; } diff --git a/betterproto2_compiler/tests/inputs/import_circular_dependency/import_circular_dependency.proto b/betterproto2_compiler/tests/inputs/import_circular_dependency/import_circular_dependency.proto index 4441be9f..714057ff 100644 --- a/betterproto2_compiler/tests/inputs/import_circular_dependency/import_circular_dependency.proto +++ b/betterproto2_compiler/tests/inputs/import_circular_dependency/import_circular_dependency.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package import_circular_dependency; -import "root.proto"; import "other.proto"; +import "root.proto"; // This test-case verifies support for circular dependencies in the generated python files. // diff --git a/betterproto2_compiler/tests/inputs/import_circular_dependency/other.proto b/betterproto2_compiler/tests/inputs/import_circular_dependency/other.proto index 833b8699..c7b5771e 100644 --- a/betterproto2_compiler/tests/inputs/import_circular_dependency/other.proto +++ b/betterproto2_compiler/tests/inputs/import_circular_dependency/other.proto @@ -1,8 +1,8 @@ syntax = "proto3"; +package import_circular_dependency.other; import "root.proto"; -package import_circular_dependency.other; message OtherPackageMessage { - RootPackageMessage rootPackageMessage = 1; + RootPackageMessage rootPackageMessage = 1; } diff --git a/betterproto2_compiler/tests/inputs/import_circular_dependency/root.proto b/betterproto2_compiler/tests/inputs/import_circular_dependency/root.proto index 73839477..a39b4fb1 100644 --- a/betterproto2_compiler/tests/inputs/import_circular_dependency/root.proto +++ b/betterproto2_compiler/tests/inputs/import_circular_dependency/root.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_circular_dependency; -message RootPackageMessage { - -} +message RootPackageMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_cousin_package/cousin.proto b/betterproto2_compiler/tests/inputs/import_cousin_package/cousin.proto index 2870dfe9..f5cd3c4c 100644 --- a/betterproto2_compiler/tests/inputs/import_cousin_package/cousin.proto +++ b/betterproto2_compiler/tests/inputs/import_cousin_package/cousin.proto @@ -2,5 +2,4 @@ syntax = "proto3"; package import_cousin_package.cousin.cousin_subpackage; -message CousinMessage { -} +message CousinMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_cousin_package/test.proto b/betterproto2_compiler/tests/inputs/import_cousin_package/test.proto index 89ec3d84..e779620e 100644 --- a/betterproto2_compiler/tests/inputs/import_cousin_package/test.proto +++ b/betterproto2_compiler/tests/inputs/import_cousin_package/test.proto @@ -7,5 +7,5 @@ import "cousin.proto"; // Verify that we can import message unrelated to us message Test { - cousin.cousin_subpackage.CousinMessage message = 1; + cousin.cousin_subpackage.CousinMessage message = 1; } diff --git a/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/cousin.proto b/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/cousin.proto index 84b6a407..6913e33d 100644 --- a/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/cousin.proto +++ b/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/cousin.proto @@ -2,5 +2,4 @@ syntax = "proto3"; package import_cousin_package_same_name.cousin.subpackage; -message CousinMessage { -} +message CousinMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/test.proto b/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/test.proto index 7b420d30..addf8770 100644 --- a/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/test.proto +++ b/betterproto2_compiler/tests/inputs/import_cousin_package_same_name/test.proto @@ -7,5 +7,5 @@ import "cousin.proto"; // Verify that we can import a message unrelated to us, in a subpackage with the same name as us. message Test { - cousin.subpackage.CousinMessage message = 1; + cousin.subpackage.CousinMessage message = 1; } diff --git a/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/child.proto b/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/child.proto index fcd7e2f6..97ca1522 100644 --- a/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/child.proto +++ b/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/child.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_nested_child_package_from_root.package.child.otherchild; -message ChildMessage { - -} +message ChildMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/import_nested_child_package_from_root.proto b/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/import_nested_child_package_from_root.proto index 96da1ace..6d8ac279 100644 --- a/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/import_nested_child_package_from_root.proto +++ b/betterproto2_compiler/tests/inputs/import_nested_child_package_from_root/import_nested_child_package_from_root.proto @@ -5,5 +5,5 @@ package import_nested_child_package_from_root; import "child.proto"; message Test { - package.child.otherchild.ChildMessage child = 1; + package.child.otherchild.ChildMessage child = 1; } diff --git a/betterproto2_compiler/tests/inputs/import_packages_same_name/import_packages_same_name.proto b/betterproto2_compiler/tests/inputs/import_packages_same_name/import_packages_same_name.proto index dff7efed..54ac7780 100644 --- a/betterproto2_compiler/tests/inputs/import_packages_same_name/import_packages_same_name.proto +++ b/betterproto2_compiler/tests/inputs/import_packages_same_name/import_packages_same_name.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package import_packages_same_name; -import "users_v1.proto"; import "posts_v1.proto"; +import "users_v1.proto"; // Tests generated message can correctly reference two packages with the same leaf-name diff --git a/betterproto2_compiler/tests/inputs/import_packages_same_name/posts_v1.proto b/betterproto2_compiler/tests/inputs/import_packages_same_name/posts_v1.proto index d3b9b1ca..6b70b952 100644 --- a/betterproto2_compiler/tests/inputs/import_packages_same_name/posts_v1.proto +++ b/betterproto2_compiler/tests/inputs/import_packages_same_name/posts_v1.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_packages_same_name.posts.v1; -message Post { - -} +message Post {} diff --git a/betterproto2_compiler/tests/inputs/import_packages_same_name/users_v1.proto b/betterproto2_compiler/tests/inputs/import_packages_same_name/users_v1.proto index d3a17e92..27bc81f7 100644 --- a/betterproto2_compiler/tests/inputs/import_packages_same_name/users_v1.proto +++ b/betterproto2_compiler/tests/inputs/import_packages_same_name/users_v1.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_packages_same_name.users.v1; -message User { - -} +message User {} diff --git a/betterproto2_compiler/tests/inputs/import_parent_package_from_child/import_parent_package_from_child.proto b/betterproto2_compiler/tests/inputs/import_parent_package_from_child/import_parent_package_from_child.proto index edc47362..7991f757 100644 --- a/betterproto2_compiler/tests/inputs/import_parent_package_from_child/import_parent_package_from_child.proto +++ b/betterproto2_compiler/tests/inputs/import_parent_package_from_child/import_parent_package_from_child.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -import "parent_package_message.proto"; - package import_parent_package_from_child.parent.child; +import "parent_package_message.proto"; + // Tests generated imports when a message refers to a message defined in its parent package message Test { diff --git a/betterproto2_compiler/tests/inputs/import_parent_package_from_child/parent_package_message.proto b/betterproto2_compiler/tests/inputs/import_parent_package_from_child/parent_package_message.proto index fb3fd31d..2be64b2c 100644 --- a/betterproto2_compiler/tests/inputs/import_parent_package_from_child/parent_package_message.proto +++ b/betterproto2_compiler/tests/inputs/import_parent_package_from_child/parent_package_message.proto @@ -2,5 +2,4 @@ syntax = "proto3"; package import_parent_package_from_child.parent; -message ParentPackageMessage { -} +message ParentPackageMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_root_package_from_child/child.proto b/betterproto2_compiler/tests/inputs/import_root_package_from_child/child.proto index bd519677..20525d15 100644 --- a/betterproto2_compiler/tests/inputs/import_root_package_from_child/child.proto +++ b/betterproto2_compiler/tests/inputs/import_root_package_from_child/child.proto @@ -7,5 +7,5 @@ import "root.proto"; // Verify that we can import root message from child package message Test { - RootMessage message = 1; + RootMessage message = 1; } diff --git a/betterproto2_compiler/tests/inputs/import_root_package_from_child/root.proto b/betterproto2_compiler/tests/inputs/import_root_package_from_child/root.proto index 6ae955ad..a874f90e 100644 --- a/betterproto2_compiler/tests/inputs/import_root_package_from_child/root.proto +++ b/betterproto2_compiler/tests/inputs/import_root_package_from_child/root.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_root_package_from_child; - -message RootMessage { -} +message RootMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_root_sibling/sibling.proto b/betterproto2_compiler/tests/inputs/import_root_sibling/sibling.proto index 6b6ba2ea..8014b7a5 100644 --- a/betterproto2_compiler/tests/inputs/import_root_sibling/sibling.proto +++ b/betterproto2_compiler/tests/inputs/import_root_sibling/sibling.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package import_root_sibling; -message SiblingMessage { - -} +message SiblingMessage {} diff --git a/betterproto2_compiler/tests/inputs/import_service_input_message/child_package_request_message.proto b/betterproto2_compiler/tests/inputs/import_service_input_message/child_package_request_message.proto index 54fc1123..214d8ac1 100644 --- a/betterproto2_compiler/tests/inputs/import_service_input_message/child_package_request_message.proto +++ b/betterproto2_compiler/tests/inputs/import_service_input_message/child_package_request_message.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package import_service_input_message.child; message ChildRequestMessage { - int32 child_argument = 1; -} \ No newline at end of file + int32 child_argument = 1; +} diff --git a/betterproto2_compiler/tests/inputs/import_service_input_message/import_service_input_message.proto b/betterproto2_compiler/tests/inputs/import_service_input_message/import_service_input_message.proto index cbf48fa9..bf0c4950 100644 --- a/betterproto2_compiler/tests/inputs/import_service_input_message/import_service_input_message.proto +++ b/betterproto2_compiler/tests/inputs/import_service_input_message/import_service_input_message.proto @@ -2,24 +2,23 @@ syntax = "proto3"; package import_service_input_message; -import "request_message.proto"; import "child_package_request_message.proto"; +import "request_message.proto"; // Tests generated service correctly imports the RequestMessage service Test { - rpc DoThing (RequestMessage) returns (RequestResponse); - rpc DoThing2 (child.ChildRequestMessage) returns (RequestResponse); - rpc DoThing3 (Nested.RequestMessage) returns (RequestResponse); + rpc DoThing(RequestMessage) returns (RequestResponse); + rpc DoThing2(child.ChildRequestMessage) returns (RequestResponse); + rpc DoThing3(Nested.RequestMessage) returns (RequestResponse); } - message RequestResponse { - int32 value = 1; + int32 value = 1; } message Nested { - message RequestMessage { - int32 nestedArgument = 1; - } -} \ No newline at end of file + message RequestMessage { + int32 nestedArgument = 1; + } +} diff --git a/betterproto2_compiler/tests/inputs/import_service_input_message/request_message.proto b/betterproto2_compiler/tests/inputs/import_service_input_message/request_message.proto index 36a6e788..24a5b822 100644 --- a/betterproto2_compiler/tests/inputs/import_service_input_message/request_message.proto +++ b/betterproto2_compiler/tests/inputs/import_service_input_message/request_message.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package import_service_input_message; message RequestMessage { - int32 argument = 1; -} \ No newline at end of file + int32 argument = 1; +} diff --git a/betterproto2_compiler/tests/inputs/int32/int32.proto b/betterproto2_compiler/tests/inputs/int32/int32.proto index 4721c235..1289aabe 100644 --- a/betterproto2_compiler/tests/inputs/int32/int32.proto +++ b/betterproto2_compiler/tests/inputs/int32/int32.proto @@ -4,7 +4,7 @@ package int32; // Some documentation about the Test message. message Test { - // Some documentation about the count. - int32 positive = 1; - int32 negative = 2; + // Some documentation about the count. + int32 positive = 1; + int32 negative = 2; } diff --git a/betterproto2_compiler/tests/inputs/invalid_field/invalid_field.proto b/betterproto2_compiler/tests/inputs/invalid_field/invalid_field.proto index e3a73ce1..1b5b1b45 100644 --- a/betterproto2_compiler/tests/inputs/invalid_field/invalid_field.proto +++ b/betterproto2_compiler/tests/inputs/invalid_field/invalid_field.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package invalid_field; message Test { - int32 x = 1; + int32 x = 1; } diff --git a/betterproto2_compiler/tests/inputs/manual_validation/manual_validation.proto b/betterproto2_compiler/tests/inputs/manual_validation/manual_validation.proto index 88603113..5bd8cf74 100644 --- a/betterproto2_compiler/tests/inputs/manual_validation/manual_validation.proto +++ b/betterproto2_compiler/tests/inputs/manual_validation/manual_validation.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package manual_validation; message Msg { - uint32 x = 1; + uint32 x = 1; } diff --git a/betterproto2_compiler/tests/inputs/map/map.proto b/betterproto2_compiler/tests/inputs/map/map.proto index ecef3ccb..9c23baa5 100644 --- a/betterproto2_compiler/tests/inputs/map/map.proto +++ b/betterproto2_compiler/tests/inputs/map/map.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package map; message Test { - map counts = 1; + map counts = 1; } diff --git a/betterproto2_compiler/tests/inputs/mapmessage/mapmessage.proto b/betterproto2_compiler/tests/inputs/mapmessage/mapmessage.proto index 2c704a49..ce6289d1 100644 --- a/betterproto2_compiler/tests/inputs/mapmessage/mapmessage.proto +++ b/betterproto2_compiler/tests/inputs/mapmessage/mapmessage.proto @@ -8,4 +8,4 @@ message Test { message Nested { int32 count = 1; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/message_wrapping/message_wrapping.proto b/betterproto2_compiler/tests/inputs/message_wrapping/message_wrapping.proto index b1f182f9..b74a507d 100644 --- a/betterproto2_compiler/tests/inputs/message_wrapping/message_wrapping.proto +++ b/betterproto2_compiler/tests/inputs/message_wrapping/message_wrapping.proto @@ -1,11 +1,11 @@ syntax = "proto3"; +package message_wrapping; + import "google/protobuf/duration.proto"; import "google/protobuf/wrappers.proto"; -package message_wrapping; - message MapMessage { - map map1 = 1; - map map2 = 2; + map map1 = 1; + map map2 = 2; } diff --git a/betterproto2_compiler/tests/inputs/namespace_builtin_types/namespace_builtin_types.proto b/betterproto2_compiler/tests/inputs/namespace_builtin_types/namespace_builtin_types.proto index 71cb0298..532c972e 100644 --- a/betterproto2_compiler/tests/inputs/namespace_builtin_types/namespace_builtin_types.proto +++ b/betterproto2_compiler/tests/inputs/namespace_builtin_types/namespace_builtin_types.proto @@ -5,36 +5,36 @@ package namespace_builtin_types; // Tests that messages may contain fields with names that are python types message Test { - // https://docs.python.org/2/library/stdtypes.html#numeric-types-int-float-long-complex - string int = 1; - string float = 2; - string complex = 3; + // https://docs.python.org/2/library/stdtypes.html#numeric-types-int-float-long-complex + string int = 1; + string float = 2; + string complex = 3; - // https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range - string list = 4; - string tuple = 5; - string range = 6; + // https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range + string list = 4; + string tuple = 5; + string range = 6; - // https://docs.python.org/3/library/stdtypes.html#str - string str = 7; + // https://docs.python.org/3/library/stdtypes.html#str + string str = 7; - // https://docs.python.org/3/library/stdtypes.html#bytearray-objects - string bytearray = 8; + // https://docs.python.org/3/library/stdtypes.html#bytearray-objects + string bytearray = 8; - // https://docs.python.org/3/library/stdtypes.html#bytes-and-bytearray-operations - string bytes = 9; + // https://docs.python.org/3/library/stdtypes.html#bytes-and-bytearray-operations + string bytes = 9; - // https://docs.python.org/3/library/stdtypes.html#memory-views - string memoryview = 10; + // https://docs.python.org/3/library/stdtypes.html#memory-views + string memoryview = 10; - // https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset - string set = 11; - string frozenset = 12; + // https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset + string set = 11; + string frozenset = 12; - // https://docs.python.org/3/library/stdtypes.html#dict - string map = 13; - string dict = 14; + // https://docs.python.org/3/library/stdtypes.html#dict + string map = 13; + string dict = 14; - // https://docs.python.org/3/library/stdtypes.html#boolean-values - string bool = 15; -} \ No newline at end of file + // https://docs.python.org/3/library/stdtypes.html#boolean-values + string bool = 15; +} diff --git a/betterproto2_compiler/tests/inputs/namespace_keywords/namespace_keywords.proto b/betterproto2_compiler/tests/inputs/namespace_keywords/namespace_keywords.proto index ac3e5c52..8f6711d8 100644 --- a/betterproto2_compiler/tests/inputs/namespace_keywords/namespace_keywords.proto +++ b/betterproto2_compiler/tests/inputs/namespace_keywords/namespace_keywords.proto @@ -8,39 +8,39 @@ package namespace_keywords; // print('\n'.join(f'string {k} = {i+1};' for i,k in enumerate(keyword.kwlist))) message Test { - string False = 1; - string None = 2; - string True = 3; - string and = 4; - string as = 5; - string assert = 6; - string async = 7; - string await = 8; - string break = 9; - string class = 10; - string continue = 11; - string def = 12; - string del = 13; - string elif = 14; - string else = 15; - string except = 16; - string finally = 17; - string for = 18; - string from = 19; - string global = 20; - string if = 21; - string import = 22; - string in = 23; - string is = 24; - string lambda = 25; - string nonlocal = 26; - string not = 27; - string or = 28; - string pass = 29; - string raise = 30; - string return = 31; - string try = 32; - string while = 33; - string with = 34; - string yield = 35; -} \ No newline at end of file + string False = 1; + string None = 2; + string True = 3; + string and = 4; + string as = 5; + string assert = 6; + string async = 7; + string await = 8; + string break = 9; + string class = 10; + string continue = 11; + string def = 12; + string del = 13; + string elif = 14; + string else = 15; + string except = 16; + string finally = 17; + string for = 18; + string from = 19; + string global = 20; + string if = 21; + string import = 22; + string in = 23; + string is = 24; + string lambda = 25; + string nonlocal = 26; + string not = 27; + string or = 28; + string pass = 29; + string raise = 30; + string return = 31; + string try = 32; + string while = 33; + string with = 34; + string yield = 35; +} diff --git a/betterproto2_compiler/tests/inputs/nested/nested.proto b/betterproto2_compiler/tests/inputs/nested/nested.proto index 619c721c..178012fd 100644 --- a/betterproto2_compiler/tests/inputs/nested/nested.proto +++ b/betterproto2_compiler/tests/inputs/nested/nested.proto @@ -4,23 +4,23 @@ package nested; // A test message with a nested message inside of it. message Test { - // This is the nested type. - message Nested { - // Stores a simple counter. - int32 count = 1; - } - // This is the nested enum. - enum Msg { - NONE = 0; - THIS = 1; - } + // This is the nested type. + message Nested { + // Stores a simple counter. + int32 count = 1; + } + // This is the nested enum. + enum Msg { + NONE = 0; + THIS = 1; + } - Nested nested = 1; - Sibling sibling = 2; - Sibling sibling2 = 3; - Msg msg = 4; + Nested nested = 1; + Sibling sibling = 2; + Sibling sibling2 = 3; + Msg msg = 4; } message Sibling { int32 foo = 1; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/nested2/nested2.proto b/betterproto2_compiler/tests/inputs/nested2/nested2.proto index cd6510c5..3c4ca546 100644 --- a/betterproto2_compiler/tests/inputs/nested2/nested2.proto +++ b/betterproto2_compiler/tests/inputs/nested2/nested2.proto @@ -5,17 +5,17 @@ package nested2; import "package.proto"; message Game { - message Player { - enum Race { - human = 0; - orc = 1; - } + message Player { + enum Race { + human = 0; + orc = 1; } + } } message Test { - Game game = 1; - Game.Player GamePlayer = 2; - Game.Player.Race GamePlayerRace = 3; - equipment.Weapon Weapon = 4; -} \ No newline at end of file + Game game = 1; + Game.Player GamePlayer = 2; + Game.Player.Race GamePlayerRace = 3; + equipment.Weapon Weapon = 4; +} diff --git a/betterproto2_compiler/tests/inputs/nested2/package.proto b/betterproto2_compiler/tests/inputs/nested2/package.proto index e12abb12..bc9f855b 100644 --- a/betterproto2_compiler/tests/inputs/nested2/package.proto +++ b/betterproto2_compiler/tests/inputs/nested2/package.proto @@ -2,6 +2,4 @@ syntax = "proto3"; package nested2.equipment; -message Weapon { - -} \ No newline at end of file +message Weapon {} diff --git a/betterproto2_compiler/tests/inputs/nestedtwice/nestedtwice.proto b/betterproto2_compiler/tests/inputs/nestedtwice/nestedtwice.proto index 84d142a3..38a7f45c 100644 --- a/betterproto2_compiler/tests/inputs/nestedtwice/nestedtwice.proto +++ b/betterproto2_compiler/tests/inputs/nestedtwice/nestedtwice.proto @@ -14,7 +14,7 @@ message Test { string a = 1; } /* EnumBottom doc. */ - enum EnumBottom{ + enum EnumBottom { /* EnumBottom.A doc. */ A = 0; B = 1; @@ -27,8 +27,8 @@ message Test { reserved 1; /* Middle.bottom doc. */ repeated Bottom bottom = 2; - repeated EnumBottom enumBottom=3; - repeated TopMiddleBottom topMiddleBottom=4; + repeated EnumBottom enumBottom = 3; + repeated TopMiddleBottom topMiddleBottom = 4; bool bar = 5; } /* Top.name doc. */ diff --git a/betterproto2_compiler/tests/inputs/oneof/oneof.proto b/betterproto2_compiler/tests/inputs/oneof/oneof.proto index 41f93b0e..59997856 100644 --- a/betterproto2_compiler/tests/inputs/oneof/oneof.proto +++ b/betterproto2_compiler/tests/inputs/oneof/oneof.proto @@ -20,4 +20,3 @@ message Test { MixedDrink mixed_drink = 13; } } - diff --git a/betterproto2_compiler/tests/inputs/oneof_default_value_serialization/oneof_default_value_serialization.proto b/betterproto2_compiler/tests/inputs/oneof_default_value_serialization/oneof_default_value_serialization.proto index f7ac6fe8..8d47bd6e 100644 --- a/betterproto2_compiler/tests/inputs/oneof_default_value_serialization/oneof_default_value_serialization.proto +++ b/betterproto2_compiler/tests/inputs/oneof_default_value_serialization/oneof_default_value_serialization.proto @@ -6,25 +6,25 @@ import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; -message Message{ +message Message { int64 value = 1; } -message NestedMessage{ +message NestedMessage { int64 id = 1; - oneof value_type{ + oneof value_type { Message wrapped_message_value = 2; } } -message Test{ +message Test { oneof value_type { - bool bool_value = 1; - int64 int64_value = 2; - google.protobuf.Timestamp timestamp_value = 3; - google.protobuf.Duration duration_value = 4; - Message wrapped_message_value = 5; - NestedMessage wrapped_nested_message_value = 6; - google.protobuf.BoolValue wrapped_bool_value = 7; + bool bool_value = 1; + int64 int64_value = 2; + google.protobuf.Timestamp timestamp_value = 3; + google.protobuf.Duration duration_value = 4; + Message wrapped_message_value = 5; + NestedMessage wrapped_nested_message_value = 6; + google.protobuf.BoolValue wrapped_bool_value = 7; } -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/oneof_enum/oneof_enum.proto b/betterproto2_compiler/tests/inputs/oneof_enum/oneof_enum.proto index 906abcb1..79c158cc 100644 --- a/betterproto2_compiler/tests/inputs/oneof_enum/oneof_enum.proto +++ b/betterproto2_compiler/tests/inputs/oneof_enum/oneof_enum.proto @@ -17,4 +17,4 @@ enum Signal { message Move { int32 x = 1; int32 y = 2; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/pickling/pickling.proto b/betterproto2_compiler/tests/inputs/pickling/pickling.proto index 3de7ae43..1504514a 100644 --- a/betterproto2_compiler/tests/inputs/pickling/pickling.proto +++ b/betterproto2_compiler/tests/inputs/pickling/pickling.proto @@ -5,39 +5,38 @@ package pickling; import "google/protobuf/any.proto"; import "google/protobuf/struct.proto"; - message Test {} message Fe { - string abc = 1; + string abc = 1; } message Fi { - string abc = 1; + string abc = 1; } message Fo { - string abc = 1; + string abc = 1; } message NestedData { - map struct_foo = 1; - map map_str_any_bar = 2; + map struct_foo = 1; + map map_str_any_bar = 2; } message Complex { - string foo_str = 1; - oneof grp { - Fe fe = 3; - Fi fi = 4; - Fo fo = 5; - } - NestedData nested_data = 6; - map mapping = 7; + string foo_str = 1; + oneof grp { + Fe fe = 3; + Fi fi = 4; + Fo fo = 5; + } + NestedData nested_data = 6; + map mapping = 7; } message PickledMessage { - bool foo = 1; - int32 bar = 2; - repeated string baz = 3; + bool foo = 1; + int32 bar = 2; + repeated string baz = 3; } diff --git a/betterproto2_compiler/tests/inputs/proto3_field_presence/proto3_field_presence.proto b/betterproto2_compiler/tests/inputs/proto3_field_presence/proto3_field_presence.proto index f28123df..e2b320fa 100644 --- a/betterproto2_compiler/tests/inputs/proto3_field_presence/proto3_field_presence.proto +++ b/betterproto2_compiler/tests/inputs/proto3_field_presence/proto3_field_presence.proto @@ -5,22 +5,22 @@ package proto3_field_presence; import "google/protobuf/timestamp.proto"; message InnerTest { - string test = 1; + string test = 1; } message Test { - optional uint32 test1 = 1; - optional bool test2 = 2; - optional string test3 = 3; - optional bytes test4 = 4; - optional InnerTest test5 = 5; - optional TestEnum test6 = 6; - optional uint64 test7 = 7; - optional float test8 = 8; - optional google.protobuf.Timestamp test9 = 9; + optional uint32 test1 = 1; + optional bool test2 = 2; + optional string test3 = 3; + optional bytes test4 = 4; + optional InnerTest test5 = 5; + optional TestEnum test6 = 6; + optional uint64 test7 = 7; + optional float test8 = 8; + optional google.protobuf.Timestamp test9 = 9; } enum TestEnum { - A = 0; - B = 1; + A = 0; + B = 1; } diff --git a/betterproto2_compiler/tests/inputs/proto3_field_presence_oneof/proto3_field_presence_oneof.proto b/betterproto2_compiler/tests/inputs/proto3_field_presence_oneof/proto3_field_presence_oneof.proto index caa76ec8..9429f10a 100644 --- a/betterproto2_compiler/tests/inputs/proto3_field_presence_oneof/proto3_field_presence_oneof.proto +++ b/betterproto2_compiler/tests/inputs/proto3_field_presence_oneof/proto3_field_presence_oneof.proto @@ -3,20 +3,20 @@ syntax = "proto3"; package proto3_field_presence_oneof; message Test { - oneof kind { - Nested nested = 1; - WithOptional with_optional = 2; - } + oneof kind { + Nested nested = 1; + WithOptional with_optional = 2; + } } message InnerNested { - optional bool a = 1; + optional bool a = 1; } message Nested { - InnerNested inner = 1; + InnerNested inner = 1; } message WithOptional { - optional bool b = 2; + optional bool b = 2; } diff --git a/betterproto2_compiler/tests/inputs/recursivemessage/recursivemessage.proto b/betterproto2_compiler/tests/inputs/recursivemessage/recursivemessage.proto index 1da2b57e..26382a61 100644 --- a/betterproto2_compiler/tests/inputs/recursivemessage/recursivemessage.proto +++ b/betterproto2_compiler/tests/inputs/recursivemessage/recursivemessage.proto @@ -3,13 +3,12 @@ syntax = "proto3"; package recursivemessage; message Test { - string name = 1; - Test child = 2; - Intermediate intermediate = 3; + string name = 1; + Test child = 2; + Intermediate intermediate = 3; } - message Intermediate { - int32 number = 1; - Test child = 2; + int32 number = 1; + Test child = 2; } diff --git a/betterproto2_compiler/tests/inputs/ref/repeatedmessage.proto b/betterproto2_compiler/tests/inputs/ref/repeatedmessage.proto index 0ffacafd..aac90ff5 100644 --- a/betterproto2_compiler/tests/inputs/ref/repeatedmessage.proto +++ b/betterproto2_compiler/tests/inputs/ref/repeatedmessage.proto @@ -8,4 +8,4 @@ message Test { message Sub { string greeting = 1; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/regression_387/regression_387.proto b/betterproto2_compiler/tests/inputs/regression_387/regression_387.proto index 57bd9544..0d025789 100644 --- a/betterproto2_compiler/tests/inputs/regression_387/regression_387.proto +++ b/betterproto2_compiler/tests/inputs/regression_387/regression_387.proto @@ -9,4 +9,4 @@ message Test { message ParentElement { string name = 1; repeated Test elems = 2; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/regression_414/regression_414.proto b/betterproto2_compiler/tests/inputs/regression_414/regression_414.proto index d20dddab..8e3dc91a 100644 --- a/betterproto2_compiler/tests/inputs/regression_414/regression_414.proto +++ b/betterproto2_compiler/tests/inputs/regression_414/regression_414.proto @@ -6,4 +6,4 @@ message Test { bytes body = 1; bytes auth = 2; repeated bytes signatures = 3; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/repeated/repeated.proto b/betterproto2_compiler/tests/inputs/repeated/repeated.proto index 4f3c788c..44c16d44 100644 --- a/betterproto2_compiler/tests/inputs/repeated/repeated.proto +++ b/betterproto2_compiler/tests/inputs/repeated/repeated.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package repeated; message Test { - repeated string names = 1; + repeated string names = 1; } diff --git a/betterproto2_compiler/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto b/betterproto2_compiler/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto index 38f1eaa3..db43f633 100644 --- a/betterproto2_compiler/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto +++ b/betterproto2_compiler/tests/inputs/repeated_duration_timestamp/repeated_duration_timestamp.proto @@ -5,8 +5,7 @@ package repeated_duration_timestamp; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; - message Test { - repeated google.protobuf.Timestamp times = 1; - repeated google.protobuf.Duration durations = 2; + repeated google.protobuf.Timestamp times = 1; + repeated google.protobuf.Duration durations = 2; } diff --git a/betterproto2_compiler/tests/inputs/repeatedmessage/repeatedmessage.proto b/betterproto2_compiler/tests/inputs/repeatedmessage/repeatedmessage.proto index 0ffacafd..aac90ff5 100644 --- a/betterproto2_compiler/tests/inputs/repeatedmessage/repeatedmessage.proto +++ b/betterproto2_compiler/tests/inputs/repeatedmessage/repeatedmessage.proto @@ -8,4 +8,4 @@ message Test { message Sub { string greeting = 1; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/repeatedpacked/repeatedpacked.proto b/betterproto2_compiler/tests/inputs/repeatedpacked/repeatedpacked.proto index a037d1b8..f7ef074b 100644 --- a/betterproto2_compiler/tests/inputs/repeatedpacked/repeatedpacked.proto +++ b/betterproto2_compiler/tests/inputs/repeatedpacked/repeatedpacked.proto @@ -3,7 +3,7 @@ syntax = "proto3"; package repeatedpacked; message Test { - repeated int32 counts = 1; - repeated sint64 signed = 2; - repeated double fixed = 3; + repeated int32 counts = 1; + repeated sint64 signed = 2; + repeated double fixed = 3; } diff --git a/betterproto2_compiler/tests/inputs/rpc_empty_input_message/rpc_empty_input_message.proto b/betterproto2_compiler/tests/inputs/rpc_empty_input_message/rpc_empty_input_message.proto index 9a4449c6..5803ceb0 100644 --- a/betterproto2_compiler/tests/inputs/rpc_empty_input_message/rpc_empty_input_message.proto +++ b/betterproto2_compiler/tests/inputs/rpc_empty_input_message/rpc_empty_input_message.proto @@ -5,9 +5,9 @@ package rpc_empty_input_message; message Test {} message Response { - int32 v = 1; + int32 v = 1; } service Service { - rpc read(Test) returns (Response); + rpc read(Test) returns (Response); } diff --git a/betterproto2_compiler/tests/inputs/service/service.proto b/betterproto2_compiler/tests/inputs/service/service.proto index 53d84fbd..e98d55aa 100644 --- a/betterproto2_compiler/tests/inputs/service/service.proto +++ b/betterproto2_compiler/tests/inputs/service/service.proto @@ -28,8 +28,8 @@ message GetThingResponse { } service Test { - rpc DoThing (DoThingRequest) returns (DoThingResponse); - rpc DoManyThings (stream DoThingRequest) returns (DoThingResponse); - rpc GetThingVersions (GetThingRequest) returns (stream GetThingResponse); - rpc GetDifferentThings (stream GetThingRequest) returns (stream GetThingResponse); + rpc DoThing(DoThingRequest) returns (DoThingResponse); + rpc DoManyThings(stream DoThingRequest) returns (DoThingResponse); + rpc GetThingVersions(GetThingRequest) returns (stream GetThingResponse); + rpc GetDifferentThings(stream GetThingRequest) returns (stream GetThingResponse); } diff --git a/betterproto2_compiler/tests/inputs/service_separate_packages/messages.proto b/betterproto2_compiler/tests/inputs/service_separate_packages/messages.proto index 270b188f..c15141bc 100644 --- a/betterproto2_compiler/tests/inputs/service_separate_packages/messages.proto +++ b/betterproto2_compiler/tests/inputs/service_separate_packages/messages.proto @@ -1,10 +1,10 @@ syntax = "proto3"; +package service_separate_packages.things.messages; + import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; -package service_separate_packages.things.messages; - message DoThingRequest { string name = 1; diff --git a/betterproto2_compiler/tests/inputs/service_separate_packages/service.proto b/betterproto2_compiler/tests/inputs/service_separate_packages/service.proto index 950eab49..b5c060a5 100644 --- a/betterproto2_compiler/tests/inputs/service_separate_packages/service.proto +++ b/betterproto2_compiler/tests/inputs/service_separate_packages/service.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -import "messages.proto"; - package service_separate_packages.things.service; +import "messages.proto"; + service Test { - rpc DoThing (things.messages.DoThingRequest) returns (things.messages.DoThingResponse); - rpc DoManyThings (stream things.messages.DoThingRequest) returns (things.messages.DoThingResponse); - rpc GetThingVersions (things.messages.GetThingRequest) returns (stream things.messages.GetThingResponse); - rpc GetDifferentThings (stream things.messages.GetThingRequest) returns (stream things.messages.GetThingResponse); + rpc DoThing(things.messages.DoThingRequest) returns (things.messages.DoThingResponse); + rpc DoManyThings(stream things.messages.DoThingRequest) returns (things.messages.DoThingResponse); + rpc GetThingVersions(things.messages.GetThingRequest) returns (stream things.messages.GetThingResponse); + rpc GetDifferentThings(stream things.messages.GetThingRequest) returns (stream things.messages.GetThingResponse); } diff --git a/betterproto2_compiler/tests/inputs/service_uppercase/service.proto b/betterproto2_compiler/tests/inputs/service_uppercase/service.proto index 786eec2c..ada19450 100644 --- a/betterproto2_compiler/tests/inputs/service_uppercase/service.proto +++ b/betterproto2_compiler/tests/inputs/service_uppercase/service.proto @@ -12,5 +12,5 @@ message DoTHINGResponse { } service Test { - rpc DoThing (DoTHINGRequest) returns (DoTHINGResponse); + rpc DoThing(DoTHINGRequest) returns (DoTHINGResponse); } diff --git a/betterproto2_compiler/tests/inputs/signed/signed.proto b/betterproto2_compiler/tests/inputs/signed/signed.proto index b40aad49..d85e3877 100644 --- a/betterproto2_compiler/tests/inputs/signed/signed.proto +++ b/betterproto2_compiler/tests/inputs/signed/signed.proto @@ -3,9 +3,9 @@ syntax = "proto3"; package signed; message Test { - // todo: rename fields after fixing bug where 'signed_32_positive' will map to 'signed_32Positive' as output json - sint32 signed32 = 1; // signed_32_positive - sint32 negative32 = 2; // signed_32_negative - sint64 string64 = 3; // signed_64_positive - sint64 negative64 = 4; // signed_64_negative + // todo: rename fields after fixing bug where 'signed_32_positive' will map to 'signed_32Positive' as output json + sint32 signed32 = 1; // signed_32_positive + sint32 negative32 = 2; // signed_32_negative + sint64 string64 = 3; // signed_64_positive + sint64 negative64 = 4; // signed_64_negative } diff --git a/betterproto2_compiler/tests/inputs/simple_service/simple_service.proto b/betterproto2_compiler/tests/inputs/simple_service/simple_service.proto index fc8e82b6..0297a523 100644 --- a/betterproto2_compiler/tests/inputs/simple_service/simple_service.proto +++ b/betterproto2_compiler/tests/inputs/simple_service/simple_service.proto @@ -3,19 +3,19 @@ syntax = "proto3"; package simple_service; message Request { - int32 value = 1; + int32 value = 1; } message Response { - string message = 1; + string message = 1; } service SimpleService { - rpc GetUnaryUnary (Request) returns (Response); + rpc GetUnaryUnary(Request) returns (Response); - rpc GetUnaryStream (Request) returns (stream Response); + rpc GetUnaryStream(Request) returns (stream Response); - rpc GetStreamUnary (stream Request) returns (Response); + rpc GetStreamUnary(stream Request) returns (Response); - rpc GetStreamStream (stream Request) returns (stream Response); + rpc GetStreamStream(stream Request) returns (stream Response); } diff --git a/betterproto2_compiler/tests/inputs/stream_stream/stream_stream.proto b/betterproto2_compiler/tests/inputs/stream_stream/stream_stream.proto index 2bfd5971..bb313434 100644 --- a/betterproto2_compiler/tests/inputs/stream_stream/stream_stream.proto +++ b/betterproto2_compiler/tests/inputs/stream_stream/stream_stream.proto @@ -3,5 +3,5 @@ syntax = "proto3"; package stream_stream; message Message { - string body = 1; + string body = 1; } diff --git a/betterproto2_compiler/tests/inputs/timestamp_dict_encode/timestamp_dict_encode.proto b/betterproto2_compiler/tests/inputs/timestamp_dict_encode/timestamp_dict_encode.proto index 9c4081ac..ded9101a 100644 --- a/betterproto2_compiler/tests/inputs/timestamp_dict_encode/timestamp_dict_encode.proto +++ b/betterproto2_compiler/tests/inputs/timestamp_dict_encode/timestamp_dict_encode.proto @@ -6,4 +6,4 @@ import "google/protobuf/timestamp.proto"; message Test { google.protobuf.Timestamp ts = 1; -} \ No newline at end of file +} diff --git a/betterproto2_compiler/tests/inputs/unwrap/unwrap.proto b/betterproto2_compiler/tests/inputs/unwrap/unwrap.proto index 15cdfe3c..54b3c94c 100644 --- a/betterproto2_compiler/tests/inputs/unwrap/unwrap.proto +++ b/betterproto2_compiler/tests/inputs/unwrap/unwrap.proto @@ -3,9 +3,9 @@ syntax = "proto3"; package unwrap; message NestedMessage { - int32 x = 1; + int32 x = 1; } message Message { - NestedMessage x = 1; + NestedMessage x = 1; } diff --git a/betterproto2_compiler/tests/inputs/validation/validation.proto b/betterproto2_compiler/tests/inputs/validation/validation.proto index e0e79092..1da98781 100644 --- a/betterproto2_compiler/tests/inputs/validation/validation.proto +++ b/betterproto2_compiler/tests/inputs/validation/validation.proto @@ -3,18 +3,18 @@ syntax = "proto3"; package validation; message Message { - int32 int32_value = 1; - int64 int64_value = 2; - uint32 uint32_value = 3; - uint64 uint64_value = 4; - sint32 sint32_value = 5; - sint64 sint64_value = 6; - fixed32 fixed32_value = 7; - fixed64 fixed64_value = 8; - sfixed32 sfixed32_value = 9; - sfixed64 sfixed64_value = 10; + int32 int32_value = 1; + int64 int64_value = 2; + uint32 uint32_value = 3; + uint64 uint64_value = 4; + sint32 sint32_value = 5; + sint64 sint64_value = 6; + fixed32 fixed32_value = 7; + fixed64 fixed64_value = 8; + sfixed32 sfixed32_value = 9; + sfixed64 sfixed64_value = 10; - float float_value = 11; + float float_value = 11; - string string_value = 12; + string string_value = 12; } From 9c4cddd109209c937b4aa1329e29083ea434345e Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 21 Sep 2025 22:45:50 +0200 Subject: [PATCH 2/6] Remove comment --- betterproto2_compiler/tests/inputs/example/example.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/betterproto2_compiler/tests/inputs/example/example.proto b/betterproto2_compiler/tests/inputs/example/example.proto index c0ea8c9b..cc2702b0 100644 --- a/betterproto2_compiler/tests/inputs/example/example.proto +++ b/betterproto2_compiler/tests/inputs/example/example.proto @@ -42,7 +42,6 @@ package example; option cc_enable_arenas = true; option csharp_namespace = "Google.Protobuf.Reflection"; -// package google.protobuf; option go_package = "google.golang.org/protobuf/types/descriptorpb"; option java_outer_classname = "DescriptorProtos"; option java_package = "com.google.protobuf"; From edbd8f270bf264743ef0830bc8e1dde8b54c330f Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 21 Sep 2025 23:11:58 +0200 Subject: [PATCH 3/6] Add buf pre-commit hook --- .pre-commit-config.yaml | 8 +++++++- betterproto2_compiler/pyproject.toml | 2 +- betterproto2_compiler/uv.lock | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a90307a4..f2096f78 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,9 +3,15 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.3 + rev: v0.13.1 hooks: - id: ruff-format args: ["--diff", "betterproto2/src", "betterproto2/tests", "betterproto2_compiler/src", "betterproto2_compiler/tests"] - id: ruff args: ["betterproto2/src", "betterproto2/tests", "betterproto2_compiler/src", "betterproto2_compiler/tests"] + + - repo: https://github.com/bufbuild/buf + rev: v1.57.2 + hooks: + - id: buf-format + files: ^betterproto2_compiler/tests/inputs/.*\.proto$ diff --git a/betterproto2_compiler/pyproject.toml b/betterproto2_compiler/pyproject.toml index 0372ace8..8e307f36 100644 --- a/betterproto2_compiler/pyproject.toml +++ b/betterproto2_compiler/pyproject.toml @@ -35,7 +35,7 @@ protoc-gen-python_betterproto2 = "betterproto2_compiler.plugin:main" [dependency-groups] dev = [ - "pre-commit>=2.17.0,<3", + "pre-commit>=3.0.0,<4", "grpcio-tools>=1.54.2,<2", "poethepoet>=0.32.2,<0.33", "pyright>=1.1.391,<2", diff --git a/betterproto2_compiler/uv.lock b/betterproto2_compiler/uv.lock index 8080938c..b957f749 100644 --- a/betterproto2_compiler/uv.lock +++ b/betterproto2_compiler/uv.lock @@ -106,7 +106,7 @@ dev = [ { name = "grpcio-tools", specifier = ">=1.54.2,<2" }, { name = "ipykernel", specifier = ">=6.29.5,<7" }, { name = "poethepoet", specifier = ">=0.32.2,<0.33" }, - { name = "pre-commit", specifier = ">=2.17.0,<3" }, + { name = "pre-commit", specifier = ">=3.0.0,<4" }, { name = "pyright", specifier = ">=1.1.391,<2" }, ] test = [ @@ -695,7 +695,7 @@ wheels = [ [[package]] name = "pre-commit" -version = "2.21.0" +version = "3.8.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "cfgv" }, @@ -704,9 +704,9 @@ dependencies = [ { name = "pyyaml" }, { name = "virtualenv" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/6b/00/1637ae945c6e10838ef5c41965f1c864e59301811bb203e979f335608e7c/pre_commit-2.21.0.tar.gz", hash = "sha256:31ef31af7e474a8d8995027fefdfcf509b5c913ff31f2015b4ec4beb26a6f658", size = 174966, upload-time = "2022-12-25T22:53:01.144Z" } +sdist = { url = "https://files.pythonhosted.org/packages/64/10/97ee2fa54dff1e9da9badbc5e35d0bbaef0776271ea5907eccf64140f72f/pre_commit-3.8.0.tar.gz", hash = "sha256:8bb6494d4a20423842e198980c9ecf9f96607a07ea29549e180eef9ae80fe7af", size = 177815, upload-time = "2024-07-28T19:59:01.538Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/a6/6b/6cfe3a8b351b54f4b6c6d2ad4286804e3367f628dce379c603d3b96635f4/pre_commit-2.21.0-py2.py3-none-any.whl", hash = "sha256:e2f91727039fc39a92f58a588a25b87f936de6567eed4f0e673e0507edc75bad", size = 201938, upload-time = "2022-12-25T22:52:59.649Z" }, + { url = "https://files.pythonhosted.org/packages/07/92/caae8c86e94681b42c246f0bca35c059a2f0529e5b92619f6aba4cf7e7b6/pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f", size = 204643, upload-time = "2024-07-28T19:58:59.335Z" }, ] [[package]] From 485d31562cff3bee048d21ed0abda2610d5cf084 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 21 Sep 2025 23:15:55 +0200 Subject: [PATCH 4/6] Update precommit --- .github/workflows/code-quality.yml | 2 +- betterproto2/pyproject.toml | 2 +- betterproto2/uv.lock | 2 +- betterproto2_compiler/pyproject.toml | 2 +- betterproto2_compiler/uv.lock | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 5c96bb99..29cd5f95 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: pre-commit/action@v3.0.1 + - uses: pre-commit/action@v4.2.0 - name: Install uv uses: astral-sh/setup-uv@v5 diff --git a/betterproto2/pyproject.toml b/betterproto2/pyproject.toml index 8479fc9a..f322a3a4 100644 --- a/betterproto2/pyproject.toml +++ b/betterproto2/pyproject.toml @@ -31,7 +31,7 @@ dev = [ "mkdocs-material>=9.6.14", "mkdocstrings[python]>=0.29.1", "mypy>=1.16.0", - "pre-commit>=4.2.0", + "pre-commit>=4.2.0,<5", "pyright>=1.1.401", # The Ruff version is pinned. To update it, also update it in .pre-commit-config.yaml "ruff==0.9.3", diff --git a/betterproto2/uv.lock b/betterproto2/uv.lock index ab2a0178..3e500f8e 100644 --- a/betterproto2/uv.lock +++ b/betterproto2/uv.lock @@ -124,7 +124,7 @@ dev = [ { name = "mkdocs-material", specifier = ">=9.6.14" }, { name = "mkdocstrings", extras = ["python"], specifier = ">=0.29.1" }, { name = "mypy", specifier = ">=1.16.0" }, - { name = "pre-commit", specifier = ">=4.2.0" }, + { name = "pre-commit", specifier = ">=4.2.0,<5" }, { name = "pyright", specifier = ">=1.1.401" }, { name = "ruff", specifier = "==0.9.3" }, ] diff --git a/betterproto2_compiler/pyproject.toml b/betterproto2_compiler/pyproject.toml index 8e307f36..2acfec9c 100644 --- a/betterproto2_compiler/pyproject.toml +++ b/betterproto2_compiler/pyproject.toml @@ -35,7 +35,7 @@ protoc-gen-python_betterproto2 = "betterproto2_compiler.plugin:main" [dependency-groups] dev = [ - "pre-commit>=3.0.0,<4", + "pre-commit>=4.2.0,<5", "grpcio-tools>=1.54.2,<2", "poethepoet>=0.32.2,<0.33", "pyright>=1.1.391,<2", diff --git a/betterproto2_compiler/uv.lock b/betterproto2_compiler/uv.lock index b957f749..133be216 100644 --- a/betterproto2_compiler/uv.lock +++ b/betterproto2_compiler/uv.lock @@ -54,7 +54,7 @@ dev = [ { name = "mkdocs-material", specifier = ">=9.6.14" }, { name = "mkdocstrings", extras = ["python"], specifier = ">=0.29.1" }, { name = "mypy", specifier = ">=1.16.0" }, - { name = "pre-commit", specifier = ">=4.2.0" }, + { name = "pre-commit", specifier = ">=4.2.0,<5" }, { name = "pyright", specifier = ">=1.1.401" }, { name = "ruff", specifier = "==0.9.3" }, ] @@ -106,7 +106,7 @@ dev = [ { name = "grpcio-tools", specifier = ">=1.54.2,<2" }, { name = "ipykernel", specifier = ">=6.29.5,<7" }, { name = "poethepoet", specifier = ">=0.32.2,<0.33" }, - { name = "pre-commit", specifier = ">=3.0.0,<4" }, + { name = "pre-commit", specifier = ">=4.2.0,<5" }, { name = "pyright", specifier = ">=1.1.391,<2" }, ] test = [ @@ -695,7 +695,7 @@ wheels = [ [[package]] name = "pre-commit" -version = "3.8.0" +version = "4.3.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "cfgv" }, @@ -704,9 +704,9 @@ dependencies = [ { name = "pyyaml" }, { name = "virtualenv" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/64/10/97ee2fa54dff1e9da9badbc5e35d0bbaef0776271ea5907eccf64140f72f/pre_commit-3.8.0.tar.gz", hash = "sha256:8bb6494d4a20423842e198980c9ecf9f96607a07ea29549e180eef9ae80fe7af", size = 177815, upload-time = "2024-07-28T19:59:01.538Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ff/29/7cf5bbc236333876e4b41f56e06857a87937ce4bf91e117a6991a2dbb02a/pre_commit-4.3.0.tar.gz", hash = "sha256:499fe450cc9d42e9d58e606262795ecb64dd05438943c62b66f6a8673da30b16", size = 193792, upload-time = "2025-08-09T18:56:14.651Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/07/92/caae8c86e94681b42c246f0bca35c059a2f0529e5b92619f6aba4cf7e7b6/pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f", size = 204643, upload-time = "2024-07-28T19:58:59.335Z" }, + { url = "https://files.pythonhosted.org/packages/5b/a5/987a405322d78a73b66e39e4a90e4ef156fd7141bf71df987e50717c321b/pre_commit-4.3.0-py2.py3-none-any.whl", hash = "sha256:2b0747ad7e6e967169136edffee14c16e148a778a54e4f967921aa1ebf2308d8", size = 220965, upload-time = "2025-08-09T18:56:13.192Z" }, ] [[package]] From 25d824bbb688b65b02233656fbad008c145d9dd1 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 21 Sep 2025 23:17:58 +0200 Subject: [PATCH 5/6] Fix workflow --- .github/workflows/code-quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 29cd5f95..5c96bb99 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: pre-commit/action@v4.2.0 + - uses: pre-commit/action@v3.0.1 - name: Install uv uses: astral-sh/setup-uv@v5 From be5eaa3811d9a01e764107e30f33c2e1937d32de Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 21 Sep 2025 23:21:31 +0200 Subject: [PATCH 6/6] Fix ruff version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2096f78..ae469416 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.1 + rev: v0.9.3 hooks: - id: ruff-format args: ["--diff", "betterproto2/src", "betterproto2/tests", "betterproto2_compiler/src", "betterproto2_compiler/tests"]