forked from siderolabs/talos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prototool.yaml
263 lines (240 loc) · 18.1 KB
/
prototool.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# Paths to exclude when searching for Protobuf files.
# These can either be file or directory names.
# If there is a directory name, that directory and all sub-directories will be excluded.
#excludes:
# - path/to/a
# - path/to/b/file.proto
# Protoc directives.
protoc:
# The Protobuf version to use from https://github.com/protocolbuffers/protobuf/releases.
# By default use 3.11.0.
# You probably want to set this to make your builds completely reproducible.
version: 3.15.6
# Additional paths to include with -I to protoc.
# By default, the directory of the config file is included,
# or the current directory if there is no config file.
includes:
- vendor/
# If not set, compile will fail if there are unused imports.
# Setting this will ignore unused imports.
#allow_unused_imports: true
# Create directives.
#create:
# List of mappings from relative directory to base package.
# This affects how packages are generated with create.
#packages:
# This means that a file created "foo.proto" in the current directory will have package "bar".
# A file created "a/b/foo.proto" will have package "bar.a.b".
#- directory: .
# name: bar
# This means that a file created "idl/code.uber/a/b/c.proto" will have package "uber.a.b".
#- directory: idl/code.uber
# name: uber
# Lint directives.
lint:
# The lint group to use.
# Available groups: "uber1", "uber2", "google", "empty".
# The default group is the "uber1" lint group for backwards compatibility reasons,
# however we recommend using the "uber2" lint group.
# The special group "empty" has no linters, allowing you to manually specify all
# lint rules in lint.rules.add.
# Run prototool lint --list-all-lint-groups to see all available lint groups.
# Run prototool lint --list-lint-group GROUP to list the linters in the given lint group.
group: empty
# Linter files to ignore.
# These can either be file or directory names.
# If there is a directory name, that directory and all sub-directories will be ignored.
ignores:
- id: FILE_OPTIONS_GO_PACKAGE_NOT_LONG_FORM
files:
- vendor/google/rpc/status.proto
- id: NAMES_NO_COMMON
files:
- common/common.proto
# Linter rules.
# Run prototool lint --list-all-linters to see all available linters.
# Run prototool lint --list-linters to see the currently configured linters.
rules:
# The specific linters to add.
# TODO Enable more: https://github.com/talos-systems/talos/issues/2722.
add:
# All rules except language-specific (C#, Java, Obj-C, PHP, Ruby, but not Go).
- COMMENTS_NO_C_STYLE # Verifies that there are no /* c-style */ comments.
# - COMMENTS_NO_INLINE # Verifies that there are no inline comments.
# - ENUMS_HAVE_COMMENTS # Verifies that all enums have a comment of the form "// EnumName ...".
# - ENUMS_HAVE_SENTENCE_COMMENTS # Verifies that all enums have a comment that contains at least one complete sentence.
# - ENUMS_NO_ALLOW_ALIAS # Verifies that no enums use the option "allow_alias".
# - ENUM_FIELDS_HAVE_COMMENTS # Verifies that all enum fields have a comment of the form "// FIELD_NAME ...".
# - ENUM_FIELDS_HAVE_SENTENCE_COMMENTS # Verifies that all enum fields have a comment that contains at least one complete sentence.
- ENUM_FIELD_NAMES_UPPERCASE # Verifies that all enum field names are UPPERCASE.
- ENUM_FIELD_NAMES_UPPER_SNAKE_CASE # Verifies that all enum field names are UPPER_SNAKE_CASE.
# - ENUM_FIELD_PREFIXES # Verifies that all enum fields are prefixed with [NESTED_MESSAGE_NAME_]ENUM_NAME_.
# - ENUM_FIELD_PREFIXES_EXCEPT_MESSAGE # Verifies that all enum fields are prefixed with ENUM_NAME_.
- ENUM_NAMES_CAMEL_CASE # Verifies that all enum names are CamelCase.
- ENUM_NAMES_CAPITALIZED # Verifies that all enum names are Capitalized.
# - ENUM_ZERO_VALUES_INVALID # Verifies that all enum zero value names are [NESTED_MESSAGE_NAME_]ENUM_NAME_INVALID.
# - ENUM_ZERO_VALUES_INVALID_EXCEPT_MESSAGE # Verifies that all enum zero value names are ENUM_NAME_INVALID.
- FIELDS_NOT_RESERVED # Verifies that no message or enum has a reserved field.
- FILE_HEADER # Verifies that the file header matches the expected file header if the file_header option is set in the configuration file.
- FILE_NAMES_LOWER_SNAKE_CASE # Verifies that the file name is lower_snake_case.proto.
# - FILE_OPTIONS_EQUAL_GO_PACKAGE_PB_SUFFIX # Verifies that the file option "go_package" is equal to $(basename PACKAGE)pb.
# - FILE_OPTIONS_EQUAL_GO_PACKAGE_V2_SUFFIX # Verifies that the file option "go_package" is equal to the last two values of the package separated by "."s, or just the package name if there are no "."s.
- FILE_OPTIONS_GO_PACKAGE_NOT_LONG_FORM # Verifies that the file option "go_package" is not of the form "go/import/path;package".
- FILE_OPTIONS_GO_PACKAGE_SAME_IN_DIR # Verifies that the file option "go_package" of all files in a directory are the same.
- FILE_OPTIONS_REQUIRE_GO_PACKAGE # Verifies that the file option "go_package" is set.
- GOGO_NOT_IMPORTED # Verifies that the "gogo.proto" file from gogo/protobuf is not imported.
- IMPORTS_NOT_PUBLIC # Verifies that there are no public imports.
- IMPORTS_NOT_WEAK # Verifies that there are no weak imports.
# - MESSAGES_HAVE_COMMENTS # Verifies that all non-extended messages have a comment of the form "// MessageName ...".
# - MESSAGES_HAVE_COMMENTS_EXCEPT_REQUEST_RESPONSE_TYPES # Verifies that all non-extended messages except for request and response types have a comment of the form "// MessageName ...".
# - MESSAGES_HAVE_SENTENCE_COMMENTS_EXCEPT_REQUEST_RESPONSE_TYPES # Verifies that all non-extended messages except for request and response types have a comment that contains at least one complete sentence.
- MESSAGES_NOT_EMPTY_EXCEPT_REQUEST_RESPONSE_TYPES # Verifies that all messages except for request and response types are not empty.
- MESSAGE_FIELDS_DURATION # Verifies that all non-map fields that contain "duration" in their name are google.protobuf.Durations.
# - MESSAGE_FIELDS_HAVE_COMMENTS # Verifies that all message fields have a comment of the form "// field_name ...".
# - MESSAGE_FIELDS_HAVE_SENTENCE_COMMENTS # Verifies that all message fields have a comment that contains at least one complete sentence.
- MESSAGE_FIELDS_NOT_FLOATS # Verifies that all message fields are not floats.
- MESSAGE_FIELDS_NO_JSON_NAME # Verifies that no message field has the "json_name" option set.
# - MESSAGE_FIELDS_TIME # Verifies that all non-map fields that contain "time" in their name are google.protobuf.Timestamps.
- MESSAGE_FIELD_NAMES_FILENAME # Verifies that all message field names do not contain "file_name" as "filename" should be used instead.
- MESSAGE_FIELD_NAMES_FILEPATH # Verifies that all message field names do not contain "file_path" as "filepath" should be used instead.
- MESSAGE_FIELD_NAMES_LOWERCASE # Verifies that all message field names are lowercase.
- MESSAGE_FIELD_NAMES_LOWER_SNAKE_CASE # Verifies that all message field names are lower_snake_case.
- MESSAGE_FIELD_NAMES_NO_DESCRIPTOR # Verifies that all message field names are not "descriptor", which results in a collision in Java-generated code.
- MESSAGE_NAMES_CAMEL_CASE # Verifies that all non-extended message names are CamelCase.
- MESSAGE_NAMES_CAPITALIZED # Verifies that all non-extended message names are Capitalized.
- NAMES_NO_COMMON # Verifies that no type name contains the word "common".
# - NAMES_NO_DATA # Verifies that no type name contains the word "data".
# - NAMES_NO_UUID # Verifies that no type name contains the word "uuid".
- ONEOF_NAMES_LOWER_SNAKE_CASE # Verifies that all oneof names are lower_snake_case.
- PACKAGES_SAME_IN_DIR # Verifies that the packages of all files in a directory are the same.
- PACKAGE_IS_DECLARED # Verifies that there is a package declaration.
- PACKAGE_LOWER_CASE # Verifies that the package name only contains characters in the range a-z0-9 and periods.
- PACKAGE_LOWER_SNAKE_CASE # Verifies that the package is lower_snake.case.
# - PACKAGE_MAJOR_BETA_VERSIONED # Verifies that the package is of the form "package.vMAJORVERSION" or "package.vMAJORVERSIONbetaBETAVERSION" with versions >=1.
- PACKAGE_NO_KEYWORDS # Verifies that no packages contain one of the keywords "internal,public,private,protected,std" as part of the name when split on '.'.
# - REQUEST_RESPONSE_NAMES_MATCH_RPC # Verifies that all request names are RpcNameRequest and all response names are RpcNameResponse.
- REQUEST_RESPONSE_TYPES_AFTER_SERVICE # Verifies that request and response types are defined after any services and the response type is defined after the request type.
# - REQUEST_RESPONSE_TYPES_IN_SAME_FILE # Verifies that all request and response types are in the same file as their corresponding service and are not nested messages.
# - REQUEST_RESPONSE_TYPES_ONLY_IN_FILE # Verifies that only request and response types are the only types in the same file as their corresponding service.
# - REQUEST_RESPONSE_TYPES_UNIQUE # Verifies that all request and response types are unique to each RPC.
# - RPCS_HAVE_COMMENTS # Verifies that all rpcs have a comment of the form "// RPCName ...".
# - RPCS_HAVE_SENTENCE_COMMENTS # Verifies that all rpcs have a comment that contains at least one complete sentence.
# - RPCS_NO_STREAMING # Verifies that all rpcs are unary.
- RPC_NAMES_CAMEL_CASE # Verifies that all RPC names are CamelCase.
- RPC_NAMES_CAPITALIZED # Verifies that all RPC names are Capitalized.
- RPC_OPTIONS_NO_GOOGLE_API_HTTP # Verifies that the RPC option "google.api.http" is not used.
# - SERVICES_HAVE_COMMENTS # Verifies that all services have a comment of the form "// ServiceName ...".
- SERVICES_HAVE_SENTENCE_COMMENTS # Verifies that all services have a comment that contains at least one complete sentence.
# - SERVICE_NAMES_API_SUFFIX # Verifies that all service names end with "API".
- SERVICE_NAMES_CAMEL_CASE # Verifies that all service names are CamelCase.
- SERVICE_NAMES_CAPITALIZED # Verifies that all service names are Capitalized.
# - SERVICE_NAMES_MATCH_FILE_NAME # Verifies that there is one service per file and the file name is service_name_lower_snake_case.proto.
- SERVICE_NAMES_NO_PLURALS # Verifies that all CamelCase service names do not contain plural components.
- SYNTAX_PROTO3 # Verifies that the syntax is proto3.
- WKT_DIRECTLY_IMPORTED # Verifies that the Well-Known Types are directly imported using "google/protobuf/" as the base of the import.
# - WKT_DURATION_SUFFIX # Verifies that all google.protobuf.Duration field names are "duration" or end in "_duration".
# - WKT_TIMESTAMP_SUFFIX # Verifies that all google.protobuf.Timestamp field names are "time" or end in "_time".
# The specific linters to remove.
# remove:
# - ENUM_NAMES_CAMEL_CASE
# The path to the file header or the file header content for all Protobuf files.
# If either path or content is set and the FILE_HEADER linter is turned on,
# files will be checked to begin with the given header, and format --fix
# will place this header before the syntax declaration. Note that
# format --fix will delete anything before the syntax declaration
# if this is set.
#
# Set path to use a file's contents for the header. Path must be relative.
# Set content to directly specify the header.
# **Both path and content cannot be set at the same time. They are only done
# so here for example purposes.**
#
# If is_commented is set, this file is assumed to already have comments
# and will be added directly. If is_commented is not set, "// " will be
# added before every line.
# file_header:
# path: path/to/protobuf_file_header.txt
# content: |
# //
# // Acme, Inc. (c) 2019
# //
# is_commented: true
# Override the default java_package file option prefix of "com".
# If this is set, this will affect lint, create, and format --fix to use.
# this prefix instead of "com".
# java_package_prefix: au.com
# Breaking change detector directives.
#break:
# Include beta packages in breaking change detection.
# Beta packages have the form "foo.bar.vMAJORbetaBETA" where MAJOR > 0 and BETA > 0.
# By default, beta packages are ignored.
#include_beta: true
# Allow stable packages to depend on beta packages.
# By default, the breaking change detector will error if a stable package
# depends on a breaking package.
# If include_beta is true, this is implicitly set.
#allow_beta_deps: true
# Code generation directives.
#generate:
# Options that will apply to all plugins of type go and gogo.
# go_options:
# The base import path. This should be the go path of the prototool.yaml file.
# This is required if you have any go plugins.
# import_path: uber/foo/bar.git/idl/uber
# Extra modifiers to include with Mfile=package.
# extra_modifiers:
# google/api/annotations.proto: google.golang.org/genproto/googleapis/api/annotations
# google/api/http.proto: google.golang.org/genproto/googleapis/api/annotations
# The list of plugins.
# plugins:
# The plugin name. This will go to protoc with --name_out, so it either needs
# to be a built-in name (like java), or a plugin name with a binary
# protoc-gen-name.
# - name: gogo
# The type, if any. Valid types are go, gogo.
# Use go if your plugin is a standard Golang plugin
# that uses github.com/golang/protobuf imports, use gogo
# if it uses github.com/gogo/protobuf imports. For protoc-gen-go
# use go, For protoc-gen-gogo, protoc-gen-gogoslick, etc, use gogo.
# type: gogo
# Extra flags to specify.
# The only flag you will generally set is plugins=grpc for Golang.
# The Mfile=package flags are automatically set.
# ** Otherwise, generally do not set this unless you know what you are doing. **
# flags: plugins=grpc
# The path to output generated files to.
# If the directory does not exist, it will be created when running generation.
# This needs to be a relative path.
# output: ../../.gen/proto/go
# Optional override for the plugin path. For example, if you set set path to
# /usr/local/bin/gogo_plugin", prototool will add the
# "--plugin=protoc-gen-gogo=/usr/local/bin/gogo_plugin" flag to protoc calls.
# If set to "gogo_plugin", prototool will search your path for "gogo_plugin",.
# and fail if "gogo_plugin" cannot be found.
# path: gogo_plugin
# - name: yarpc-go
# type: gogo
# output: ../../.gen/proto/go
# - name: grpc-gateway
# type: go
# output: ../../.gen/proto/go
# - name: java
# output: ../../.gen/proto/java
# Optional file suffix for plugins that output a single file as opposed
# to writing a set of files to a directory. This is only valid in two
# known cases:
# - For the java plugin, set this to "jar" to produce jars
# https://developers.google.com/protocol-buffers/docs/reference/java-generated#invocation
# - For the descriptor_set plugin, this is required as using descriptor_set
# requires a file to be given instead of a directory.
# file_suffix: jar
# descriptor_set is special, and uses the --descriptor_set_out flag on protoc.
# file_suffix is required, and the options include_imports and include_source_info
# can be optionally set to add the flags --include_imports and --include_source-info.
# The include_imports and include_source_info options are not valid for any
# other plugin name.
# - name: descriptor_set
# output: ../../.gen/proto/descriptor
# file_suffix: bin
# include_imports: true
# include_source_info: true