Documentation ¶
Index ¶
- func BuildError(pos meta.Position, sourceName string, err error) error
- func Rules(cfg Config) map[string]lint.Rule
- type CommentEnum
- type CommentEnumValue
- type CommentField
- type CommentMessage
- type CommentOneOf
- type CommentRPC
- type CommentService
- type Config
- type DirectorySamePackage
- type EnumFirstValueZero
- type EnumNoAllowAlias
- type EnumPascalCase
- type EnumValuePrefix
- type EnumValueUpperSnakeCase
- type EnumZeroValueSuffix
- type Error
- type FieldLowerSnakeCase
- type FileLowerSnakeCase
- type ImportNoPublic
- type ImportNoWeak
- type ImportUsed
- type MessagePascalCase
- type OneofLowerSnakeCase
- type PackageDefined
- type PackageDirectoryMatch
- type PackageLowerSnakeCase
- type PackageNoImportCycle
- type PackageSameCSharpNamespace
- type PackageSameDirectory
- type PackageSameGoPackage
- type PackageSameJavaMultipleFiles
- type PackageSameJavaPackage
- type PackageSamePHPNamespace
- type PackageSameRubyPackage
- type PackageSameSwiftPrefix
- type PackageVersionSuffix
- type ProtoValidate
- type RPCNoClientStreaming
- type RPCNoServerStreaming
- type RPCRequestResponseUnique
- type RPCRequestStandardName
- type RPCResponseStandardName
- type RpcPascalCase
- type ServicePascalCase
- type ServiceSuffix
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildError ¶
BuildError creates an Error.
Types ¶
type CommentEnum ¶
type CommentEnum struct{}
CommentEnum this rule checks that enums have non-empty comments.
type CommentEnumValue ¶
type CommentEnumValue struct{}
CommentEnumValue this rule checks that enum values have non-empty comments.
type CommentField ¶
type CommentField struct{}
CommentField this rule checks that fields have non-empty comments.
type CommentMessage ¶
type CommentMessage struct{}
CommentMessage this rule checks that messages have non-empty comments.
type CommentOneOf ¶
type CommentOneOf struct{}
CommentOneOf this rule checks that oneofs have non-empty comments.
type CommentRPC ¶
type CommentRPC struct{}
CommentRPC this rule checks that RPCs have non-empty comments.
type CommentService ¶
type CommentService struct{}
CommentService this rule checks that services have non-empty comments.
type Config ¶
type Config struct { PackageDirectoryMatchRoot string EnumZeroValueSuffixPrefix string ServiceSuffixSuffix string }
Config is the configuration for the rules.
type DirectorySamePackage ¶
type DirectorySamePackage struct {
// contains filtered or unexported fields
}
DirectorySamePackage this rule checks that all files in a given directory are in the same package.
type EnumFirstValueZero ¶
type EnumFirstValueZero struct{}
EnumFirstValueZero this rule enforces that the first enum value is the zero value, which is a proto3 requirement on build, but isn't required in proto2 on build. The rule enforces that the requirement is also followed in proto2.
type EnumNoAllowAlias ¶
type EnumNoAllowAlias struct{}
EnumNoAllowAlias this rule checks that enums are PascalCase.
type EnumPascalCase ¶
type EnumPascalCase struct{}
EnumPascalCase this rule checks that enums are PascalCase.
type EnumValuePrefix ¶
type EnumValuePrefix struct { }
EnumValuePrefix this rule requires that all enum value names are prefixed with the enum name.
type EnumValueUpperSnakeCase ¶
type EnumValueUpperSnakeCase struct{}
EnumValueUpperSnakeCase this rule checks that enum values are UPPER_SNAKE_CASE.
type EnumZeroValueSuffix ¶
type EnumZeroValueSuffix struct {
Suffix string `json:"suffix" yaml:"suffix" ENV:"ENUM_ZERO_VALUE_SUFFIX"`
}
EnumZeroValueSuffix this rule requires that all enum values have a zero value with a defined suffix. By default, it verifies that the zero value of all enums ends in _UNSPECIFIED, but the suffix is configurable.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is an error with meta information.
type FieldLowerSnakeCase ¶
type FieldLowerSnakeCase struct{}
FieldLowerSnakeCase this rule checks that field names are lower_snake_case.
type FileLowerSnakeCase ¶
type FileLowerSnakeCase struct { }
FileLowerSnakeCase this rule says that all .proto files must be named as lower_snake_case.proto. This is the widely accepted standard.
type ImportNoPublic ¶
type ImportNoPublic struct{}
ImportNoPublic this rule outlaws declaring imports as public. If you didn't know that was possible, forget what you just learned in this sentence.
type ImportNoWeak ¶
type ImportNoWeak struct{}
ImportNoWeak similar to the IMPORT_NO_PUBLIC rule, this rule outlaws declaring imports as weak. If you didn't know that was possible, forget what you just learned in this sentence.
type ImportUsed ¶
type ImportUsed struct{}
ImportUsed this rule checks that all the imports declared across your Protobuf files are actually used.
type MessagePascalCase ¶
type MessagePascalCase struct{}
MessagePascalCase this rule checks that messages are PascalCase.
type OneofLowerSnakeCase ¶
type OneofLowerSnakeCase struct{}
OneofLowerSnakeCase this rule checks that oneof names are lower_snake_case.
type PackageDefined ¶
type PackageDefined struct{}
PackageDefined this rule checks that all files have a package declaration.
type PackageDirectoryMatch ¶
type PackageDirectoryMatch struct {
Root string `json:"root" yaml:"root" env:"PACKAGE_DIRECTORY_MATCH_ROOT"`
}
PackageDirectoryMatch is a rule for checking consistency of directory and package names.
type PackageLowerSnakeCase ¶
type PackageLowerSnakeCase struct{}
PackageLowerSnakeCase his rule checks that packages are lower_snake_case.
type PackageNoImportCycle ¶
type PackageNoImportCycle struct {
// contains filtered or unexported fields
}
PackageNoImportCycle this is an extra uncategorized rule that detects package import cycles. The Protobuf compiler outlaws circular file imports, but it's still possible to introduce package cycles, such as these:
type PackageSameCSharpNamespace ¶ added in v0.1.5
type PackageSameCSharpNamespace struct {
// contains filtered or unexported fields
}
PackageSameCSharpNamespace checks that all files with a given package have the same value for the csharp_namespace option.
type PackageSameDirectory ¶
type PackageSameDirectory struct {
// contains filtered or unexported fields
}
PackageSameDirectory this rule checks that all files with a given package are in the same directory.
type PackageSameGoPackage ¶ added in v0.1.5
type PackageSameGoPackage struct {
// contains filtered or unexported fields
}
PackageSameGoPackage checks that all files with a given package have the same value for the go_package option.
type PackageSameJavaMultipleFiles ¶ added in v0.1.5
type PackageSameJavaMultipleFiles struct {
// contains filtered or unexported fields
}
PackageSameJavaMultipleFiles checks that all files with a given package have the same value for the java_multiple_files option.
type PackageSameJavaPackage ¶ added in v0.1.5
type PackageSameJavaPackage struct {
// contains filtered or unexported fields
}
PackageSameJavaPackage checks that all files with a given package have the same value for the java_package option.
type PackageSamePHPNamespace ¶ added in v0.1.5
type PackageSamePHPNamespace struct {
// contains filtered or unexported fields
}
PackageSamePHPNamespace checks that all files with a given package have the same value for the php_namespace option.
type PackageSameRubyPackage ¶ added in v0.1.5
type PackageSameRubyPackage struct {
// contains filtered or unexported fields
}
PackageSameRubyPackage checks that all files with a given package have the same value for the ruby_package option.
type PackageSameSwiftPrefix ¶ added in v0.1.5
type PackageSameSwiftPrefix struct {
// contains filtered or unexported fields
}
PackageSameSwiftPrefix checks that all files with a given package have the same value for the swift_prefix option.
type PackageVersionSuffix ¶
type PackageVersionSuffix struct{}
PackageVersionSuffix this rule enforces that the last component of a package must be a version of the form v\d+, v\d+test.*, v\d+(alpha|beta)\d*, or v\d+p\d+(alpha|beta)\d*, where numbers are >=1.
type ProtoValidate ¶
type ProtoValidate struct{}
ProtoValidate this rule requires that all protovalidate constraints specified are valid.
type RPCNoClientStreaming ¶
type RPCNoClientStreaming struct { }
RPCNoClientStreaming this rule checks that RPCs aren't client streaming.
type RPCNoServerStreaming ¶
type RPCNoServerStreaming struct { }
RPCNoServerStreaming this rule checks that RPCs aren't server streaming.
type RPCRequestResponseUnique ¶
type RPCRequestResponseUnique struct { }
RPCRequestResponseUnique checks that RPCs request and response types are only used in one RPC.
type RPCRequestStandardName ¶
type RPCRequestStandardName struct { }
RPCRequestStandardName checks that RPC request type names are RPCNameRequest or ServiceNameRPCNameRequest.
type RPCResponseStandardName ¶
type RPCResponseStandardName struct { }
RPCResponseStandardName checks that RPC response type names are RPCNameResponse or ServiceNameRPCNameResponse.
type RpcPascalCase ¶
type RpcPascalCase struct{}
RpcPascalCase this rule checks that RPCs are PascalCase.
type ServicePascalCase ¶
type ServicePascalCase struct{}
ServicePascalCase this rule checks that services are PascalCase.
type ServiceSuffix ¶
type ServiceSuffix struct {
Suffix string
}
ServiceSuffix this rule enforces that all services are suffixed with Service.
Source Files ¶
- builder.go
- comment_enum.go
- comment_enum_value.go
- comment_field_message.go
- comment_message.go
- comment_one_of.go
- comment_rpc.go
- comment_service.go
- directory_same_package.go
- enum_first_value_zero.go
- enum_no_allow_alias.go
- enum_pascal_case.go
- enum_value_prefix.go
- enum_value_upper_snake_case.go
- enum_zero_value_suffix.go
- error.go
- file_lower_snake_case.go
- import_no_public.go
- import_no_weak.go
- import_used.go
- message_field_lower_snake_case.go
- message_pascal_case.go
- oneof_lower_snake_case.go
- package_defined.go
- package_directory_match.go
- package_lower_snake_case.go
- package_no_import_cycle.go
- package_same_csharp_namespace.go
- package_same_directory.go
- package_same_go_package.go
- package_same_java_multiple_files.go
- package_same_java_package.go
- package_same_php_namespace.go
- package_same_ruby_package.go
- package_same_swift_prefix.go
- package_version_suffix.go
- protovalidate.go
- rpc_no_client_streaming.go
- rpc_no_server_streaming.go
- rpc_pascal_case.go
- rpc_request_response_unique.go
- rpc_request_standard_name.go
- rpc_response_standard_name.go
- service_pascal_case.go
- service_suffix.go