buflintconfig

package
v1.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesForConfig

func BytesForConfig(config *Config) ([]byte, error)

BytesForConfig takes a *Config and returns the deterministic []byte representation. We use an unexported intermediary JSON form and sort all fields to ensure that the bytes associated with the *Config are deterministic.

func PrintFileAnnotations

func PrintFileAnnotations(
	writer io.Writer,
	fileAnnotations []bufanalysis.FileAnnotation,
	formatString string,
) error

PrintFileAnnotations prints the FileAnnotations to the Writer.

Also accepts config-ignore-yaml.

func ProtoForConfig

func ProtoForConfig(config *Config) *lintv1.Config

ProtoForConfig takes a *Config and returns the proto representation.

Types

type Config

type Config struct {
	// Use is a list of rule and/or category IDs that are included in the lint check.
	Use []string
	// Except is a list of the rule and/or category IDs that are excluded from the lint check.
	Except []string
	// IgnoreRootPaths is a list of paths of directories and/or files that should be ignored by the lint check.
	// All paths are relative to the root of the module.
	IgnoreRootPaths []string
	// IgnoreIDOrCategoryToRootPaths is a map of rule and/or category IDs to directory and/or file paths to exclude from the
	// lint check.
	IgnoreIDOrCategoryToRootPaths map[string][]string
	// EnumZeroValueSuffix controls the behavior of the ENUM_ZERO_VALUE lint rule ID. By default, this rule
	// verifies that the zero value of all enums ends in _UNSPECIFIED. This config allows the user to override
	// this value with the given string.
	EnumZeroValueSuffix string
	// RPCAllowSameRequestResponse allows the same message type for both the request and response of an RPC.
	RPCAllowSameRequestResponse bool
	// RPCAllowGoogleProtobufEmptyRequests allows the RPC requests to use the google.protobuf.Empty message.
	RPCAllowGoogleProtobufEmptyRequests bool
	// RPCAllowGoogleProtobufEmptyResponse allows the RPC responses to use the google.protobuf.Empty message.
	RPCAllowGoogleProtobufEmptyResponses bool
	// ServiceSuffix applies to the SERVICE_SUFFIX rule ID. By default, the rule verifies that all service names
	// end with the suffix Service. This allows users to override the value with the given string.
	ServiceSuffix string
	// AllowCommentIgnores turns on comment-driven ignores.
	AllowCommentIgnores bool
	// Version represents the version of the lint rule and category IDs that should be used with this config.
	Version string
}

Config is the lint check config.

func ConfigForProto

func ConfigForProto(protoConfig *lintv1.Config) *Config

ConfigForProto returns the Config given the proto.

func NewConfigV1

func NewConfigV1(externalConfig ExternalConfigV1) *Config

NewConfigV1 returns a new Config.

func NewConfigV1Beta1

func NewConfigV1Beta1(externalConfig ExternalConfigV1Beta1) *Config

NewConfigV1Beta1 returns a new Config.

type ExternalConfigV1

type ExternalConfigV1 struct {
	Use    []string `json:"use,omitempty" yaml:"use,omitempty"`
	Except []string `json:"except,omitempty" yaml:"except,omitempty"`
	// IgnoreRootPaths
	Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"`
	// IgnoreIDOrCategoryToRootPaths
	IgnoreOnly                           map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"`
	EnumZeroValueSuffix                  string              `json:"enum_zero_value_suffix,omitempty" yaml:"enum_zero_value_suffix,omitempty"`
	RPCAllowSameRequestResponse          bool                `json:"rpc_allow_same_request_response,omitempty" yaml:"rpc_allow_same_request_response,omitempty"`
	RPCAllowGoogleProtobufEmptyRequests  bool                `json:"rpc_allow_google_protobuf_empty_requests,omitempty" yaml:"rpc_allow_google_protobuf_empty_requests,omitempty"`
	RPCAllowGoogleProtobufEmptyResponses bool                `json:"rpc_allow_google_protobuf_empty_responses,omitempty" yaml:"rpc_allow_google_protobuf_empty_responses,omitempty"`
	ServiceSuffix                        string              `json:"service_suffix,omitempty" yaml:"service_suffix,omitempty"`
	AllowCommentIgnores                  bool                `json:"allow_comment_ignores,omitempty" yaml:"allow_comment_ignores,omitempty"`
}

ExternalConfigV1 is an external config.

func ExternalConfigV1ForConfig

func ExternalConfigV1ForConfig(config *Config) ExternalConfigV1

ExternalConfigV1ForConfig takes a *Config and returns the v1 externalconfig representation.

type ExternalConfigV1Beta1

type ExternalConfigV1Beta1 struct {
	Use    []string `json:"use,omitempty" yaml:"use,omitempty"`
	Except []string `json:"except,omitempty" yaml:"except,omitempty"`
	// IgnoreRootPaths
	Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"`
	// IgnoreIDOrCategoryToRootPaths
	IgnoreOnly                           map[string][]string `json:"ignore_only,omitempty" yaml:"ignore_only,omitempty"`
	EnumZeroValueSuffix                  string              `json:"enum_zero_value_suffix,omitempty" yaml:"enum_zero_value_suffix,omitempty"`
	RPCAllowSameRequestResponse          bool                `json:"rpc_allow_same_request_response,omitempty" yaml:"rpc_allow_same_request_response,omitempty"`
	RPCAllowGoogleProtobufEmptyRequests  bool                `json:"rpc_allow_google_protobuf_empty_requests,omitempty" yaml:"rpc_allow_google_protobuf_empty_requests,omitempty"`
	RPCAllowGoogleProtobufEmptyResponses bool                `json:"rpc_allow_google_protobuf_empty_responses,omitempty" yaml:"rpc_allow_google_protobuf_empty_responses,omitempty"`
	ServiceSuffix                        string              `json:"service_suffix,omitempty" yaml:"service_suffix,omitempty"`
	AllowCommentIgnores                  bool                `json:"allow_comment_ignores,omitempty" yaml:"allow_comment_ignores,omitempty"`
}

ExternalConfigV1Beta1 is an external config.

func ExternalConfigV1Beta1ForConfig

func ExternalConfigV1Beta1ForConfig(config *Config) ExternalConfigV1Beta1

ExternalConfigV1Beta1ForConfig takes a *Config and returns the v1beta1 externalconfig representation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL