rules

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnumFieldNamesPrefixRule added in v0.31.0

type EnumFieldNamesPrefixRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

EnumFieldNamesPrefixRule verifies that enum field names are prefixed with its ENUM_NAME_UPPER_SNAKE_CASE. See https://developers.google.com/protocol-buffers/docs/style#enums.

func NewEnumFieldNamesPrefixRule added in v0.31.0

func NewEnumFieldNamesPrefixRule(
	severity rule.Severity,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) EnumFieldNamesPrefixRule

NewEnumFieldNamesPrefixRule creates a new EnumFieldNamesPrefixRule.

func (EnumFieldNamesPrefixRule) Apply added in v0.31.0

Apply applies the rule to the proto.

func (EnumFieldNamesPrefixRule) ID added in v0.31.0

ID returns the ID of this rule.

func (EnumFieldNamesPrefixRule) IsOfficial added in v0.31.0

func (r EnumFieldNamesPrefixRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (EnumFieldNamesPrefixRule) Purpose added in v0.31.0

func (r EnumFieldNamesPrefixRule) Purpose() string

Purpose returns the purpose of this rule.

type EnumFieldNamesUpperSnakeCaseRule

type EnumFieldNamesUpperSnakeCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

EnumFieldNamesUpperSnakeCaseRule verifies that all enum field names are CAPITALS_WITH_UNDERSCORES. See https://developers.google.com/protocol-buffers/docs/style#enums.

func NewEnumFieldNamesUpperSnakeCaseRule

func NewEnumFieldNamesUpperSnakeCaseRule(
	severity rule.Severity,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) EnumFieldNamesUpperSnakeCaseRule

NewEnumFieldNamesUpperSnakeCaseRule creates a new EnumFieldNamesUpperSnakeCaseRule.

func (EnumFieldNamesUpperSnakeCaseRule) Apply

Apply applies the rule to the proto.

func (EnumFieldNamesUpperSnakeCaseRule) ID

ID returns the ID of this rule.

func (EnumFieldNamesUpperSnakeCaseRule) IsOfficial added in v0.10.0

func (r EnumFieldNamesUpperSnakeCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (EnumFieldNamesUpperSnakeCaseRule) Purpose

Purpose returns the purpose of this rule.

type EnumFieldNamesZeroValueEndWithRule added in v0.10.0

type EnumFieldNamesZeroValueEndWithRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

EnumFieldNamesZeroValueEndWithRule verifies that the zero value enum should have the suffix (e.g. "UNSPECIFIED", "INVALID"). See https://developers.google.com/protocol-buffers/docs/style#enums.

func NewEnumFieldNamesZeroValueEndWithRule added in v0.10.0

func NewEnumFieldNamesZeroValueEndWithRule(
	severity rule.Severity,
	suffix string,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) EnumFieldNamesZeroValueEndWithRule

NewEnumFieldNamesZeroValueEndWithRule creates a new EnumFieldNamesZeroValueEndWithRule.

func (EnumFieldNamesZeroValueEndWithRule) Apply added in v0.10.0

Apply applies the rule to the proto.

func (EnumFieldNamesZeroValueEndWithRule) ID added in v0.10.0

ID returns the ID of this rule.

func (EnumFieldNamesZeroValueEndWithRule) IsOfficial added in v0.10.0

IsOfficial decides whether or not this rule belongs to the official guide.

func (EnumFieldNamesZeroValueEndWithRule) Purpose added in v0.10.0

Purpose returns the purpose of this rule.

type EnumFieldsHaveCommentRule added in v0.13.0

type EnumFieldsHaveCommentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

EnumFieldsHaveCommentRule verifies that all enumFields have a comment.

func NewEnumFieldsHaveCommentRule added in v0.13.0

func NewEnumFieldsHaveCommentRule(
	severity rule.Severity,
	shouldFollowGolangStyle bool,
) EnumFieldsHaveCommentRule

NewEnumFieldsHaveCommentRule creates a new EnumFieldsHaveCommentRule.

func (EnumFieldsHaveCommentRule) Apply added in v0.13.0

Apply applies the rule to the proto.

func (EnumFieldsHaveCommentRule) ID added in v0.13.0

ID returns the ID of this rule.

func (EnumFieldsHaveCommentRule) IsOfficial added in v0.13.0

func (r EnumFieldsHaveCommentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (EnumFieldsHaveCommentRule) Purpose added in v0.13.0

func (r EnumFieldsHaveCommentRule) Purpose() string

Purpose returns the purpose of this rule.

type EnumNamesUpperCamelCaseRule

type EnumNamesUpperCamelCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

EnumNamesUpperCamelCaseRule verifies that all enum names are CamelCase (with an initial capital). See https://developers.google.com/protocol-buffers/docs/style#enums.

func NewEnumNamesUpperCamelCaseRule

func NewEnumNamesUpperCamelCaseRule(
	severity rule.Severity,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) EnumNamesUpperCamelCaseRule

NewEnumNamesUpperCamelCaseRule creates a new EnumNamesUpperCamelCaseRule.

func (EnumNamesUpperCamelCaseRule) Apply

Apply applies the rule to the proto.

func (EnumNamesUpperCamelCaseRule) ID

ID returns the ID of this rule.

func (EnumNamesUpperCamelCaseRule) IsOfficial added in v0.10.0

func (r EnumNamesUpperCamelCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (EnumNamesUpperCamelCaseRule) Purpose

func (r EnumNamesUpperCamelCaseRule) Purpose() string

Purpose returns the purpose of this rule.

type EnumsHaveCommentRule added in v0.13.0

type EnumsHaveCommentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

EnumsHaveCommentRule verifies that all enums have a comment.

func NewEnumsHaveCommentRule added in v0.13.0

func NewEnumsHaveCommentRule(
	severity rule.Severity,
	shouldFollowGolangStyle bool,
) EnumsHaveCommentRule

NewEnumsHaveCommentRule creates a new EnumsHaveCommentRule.

func (EnumsHaveCommentRule) Apply added in v0.13.0

func (r EnumsHaveCommentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (EnumsHaveCommentRule) ID added in v0.13.0

ID returns the ID of this rule.

func (EnumsHaveCommentRule) IsOfficial added in v0.13.0

func (r EnumsHaveCommentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (EnumsHaveCommentRule) Purpose added in v0.13.0

func (r EnumsHaveCommentRule) Purpose() string

Purpose returns the purpose of this rule.

type FieldNamesExcludePrepositionsRule added in v0.10.0

type FieldNamesExcludePrepositionsRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

FieldNamesExcludePrepositionsRule verifies that all field names don't include prepositions (e.g. "for", "during", "at"). It is assumed that the field names are underscore_separated_names. See https://cloud.google.com/apis/design/naming_convention#field_names.

func NewFieldNamesExcludePrepositionsRule added in v0.10.0

func NewFieldNamesExcludePrepositionsRule(
	severity rule.Severity,
	prepositions []string,
	excludes []string,
) FieldNamesExcludePrepositionsRule

NewFieldNamesExcludePrepositionsRule creates a new FieldNamesExcludePrepositionsRule.

func (FieldNamesExcludePrepositionsRule) Apply added in v0.10.0

Apply applies the rule to the proto.

func (FieldNamesExcludePrepositionsRule) ID added in v0.10.0

ID returns the ID of this rule.

func (FieldNamesExcludePrepositionsRule) IsOfficial added in v0.10.0

func (r FieldNamesExcludePrepositionsRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (FieldNamesExcludePrepositionsRule) Purpose added in v0.10.0

Purpose returns the purpose of this rule.

type FieldNamesLowerSnakeCaseRule

type FieldNamesLowerSnakeCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

FieldNamesLowerSnakeCaseRule verifies that all field names are underscore_separated_names. See https://developers.google.com/protocol-buffers/docs/style#message-and-field-names.

func NewFieldNamesLowerSnakeCaseRule

func NewFieldNamesLowerSnakeCaseRule(
	severity rule.Severity,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) FieldNamesLowerSnakeCaseRule

NewFieldNamesLowerSnakeCaseRule creates a new FieldNamesLowerSnakeCaseRule.

func (FieldNamesLowerSnakeCaseRule) Apply

Apply applies the rule to the proto.

func (FieldNamesLowerSnakeCaseRule) ID

ID returns the ID of this rule.

func (FieldNamesLowerSnakeCaseRule) IsOfficial added in v0.10.0

func (r FieldNamesLowerSnakeCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (FieldNamesLowerSnakeCaseRule) Purpose

Purpose returns the purpose of this rule.

type FieldsHaveCommentRule added in v0.13.0

type FieldsHaveCommentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

FieldsHaveCommentRule verifies that all fields have a comment.

func NewFieldsHaveCommentRule added in v0.13.0

func NewFieldsHaveCommentRule(
	severity rule.Severity,
	shouldFollowGolangStyle bool,
) FieldsHaveCommentRule

NewFieldsHaveCommentRule creates a new FieldsHaveCommentRule.

func (FieldsHaveCommentRule) Apply added in v0.13.0

func (r FieldsHaveCommentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (FieldsHaveCommentRule) ID added in v0.13.0

ID returns the ID of this rule.

func (FieldsHaveCommentRule) IsOfficial added in v0.13.0

func (r FieldsHaveCommentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (FieldsHaveCommentRule) Purpose added in v0.13.0

func (r FieldsHaveCommentRule) Purpose() string

Purpose returns the purpose of this rule.

type FileHasCommentRule added in v0.34.0

type FileHasCommentRule struct {
	RuleWithSeverity
}

FileHasCommentRule verifies that a file starts with a doc comment.

func NewFileHasCommentRule added in v0.34.0

func NewFileHasCommentRule(severity rule.Severity) FileHasCommentRule

NewFileHasCommentRule creates a new FileHasCommentRule.

func (FileHasCommentRule) Apply added in v0.34.0

func (r FileHasCommentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (FileHasCommentRule) ID added in v0.34.0

func (r FileHasCommentRule) ID() string

ID returns the ID of this rule.

func (FileHasCommentRule) IsOfficial added in v0.34.0

func (r FileHasCommentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (FileHasCommentRule) Purpose added in v0.34.0

func (r FileHasCommentRule) Purpose() string

Purpose returns the purpose of this rule.

type FileNamesLowerSnakeCaseRule added in v0.10.0

type FileNamesLowerSnakeCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

FileNamesLowerSnakeCaseRule verifies that all file names are lower_snake_case.proto. See https://developers.google.com/protocol-buffers/docs/style#file-structure.

func NewFileNamesLowerSnakeCaseRule added in v0.10.0

func NewFileNamesLowerSnakeCaseRule(
	severity rule.Severity,
	excluded []string,
	fixMode bool,
) FileNamesLowerSnakeCaseRule

NewFileNamesLowerSnakeCaseRule creates a new FileNamesLowerSnakeCaseRule.

func (FileNamesLowerSnakeCaseRule) Apply added in v0.10.0

Apply applies the rule to the proto.

func (FileNamesLowerSnakeCaseRule) ID added in v0.10.0

ID returns the ID of this rule.

func (FileNamesLowerSnakeCaseRule) IsOfficial added in v0.10.0

func (r FileNamesLowerSnakeCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (FileNamesLowerSnakeCaseRule) Purpose added in v0.10.0

func (r FileNamesLowerSnakeCaseRule) Purpose() string

Purpose returns the purpose of this rule.

type ImportsSortedRule added in v0.11.0

type ImportsSortedRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

ImportsSortedRule enforces sorted imports.

func NewImportsSortedRule added in v0.11.0

func NewImportsSortedRule(
	severity rule.Severity,
	fixMode bool,
) ImportsSortedRule

NewImportsSortedRule creates a new ImportsSortedRule.

func (ImportsSortedRule) Apply added in v0.11.0

func (r ImportsSortedRule) Apply(
	proto *parser.Proto,
) ([]report.Failure, error)

Apply applies the rule to the proto.

func (ImportsSortedRule) ID added in v0.11.0

func (r ImportsSortedRule) ID() string

ID returns the ID of this rule.

func (ImportsSortedRule) IsOfficial added in v0.11.0

func (r ImportsSortedRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (ImportsSortedRule) Purpose added in v0.11.0

func (r ImportsSortedRule) Purpose() string

Purpose returns the purpose of this rule.

type IndentRule

type IndentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

IndentRule enforces a consistent indentation style.

func NewIndentRule

func NewIndentRule(
	severity rule.Severity,
	style string,
	notInsertNewline bool,
	fixMode bool,
) IndentRule

NewIndentRule creates a new IndentRule.

func (IndentRule) Apply

func (r IndentRule) Apply(
	proto *parser.Proto,
) ([]report.Failure, error)

Apply applies the rule to the proto.

func (IndentRule) ID

func (r IndentRule) ID() string

ID returns the ID of this rule.

func (IndentRule) IsOfficial added in v0.10.0

func (r IndentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (IndentRule) Purpose

func (r IndentRule) Purpose() string

Purpose returns the purpose of this rule.

type MaxLineLengthRule

type MaxLineLengthRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

MaxLineLengthRule enforces a maximum line length to increase code readability and maintainability. The length of a line is defined as the number of Unicode characters in the line.

func NewMaxLineLengthRule

func NewMaxLineLengthRule(
	severity rule.Severity,
	maxChars int,
	tabChars int,
) MaxLineLengthRule

NewMaxLineLengthRule creates a new MaxLineLengthRule.

func (MaxLineLengthRule) Apply

func (r MaxLineLengthRule) Apply(proto *parser.Proto) (
	failures []report.Failure,
	err error,
)

Apply applies the rule to the proto.

func (MaxLineLengthRule) ID

func (r MaxLineLengthRule) ID() string

ID returns the ID of this rule.

func (MaxLineLengthRule) IsOfficial added in v0.10.0

func (r MaxLineLengthRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (MaxLineLengthRule) Purpose

func (r MaxLineLengthRule) Purpose() string

Purpose returns the purpose of this rule.

type MessageNamesExcludePrepositionsRule added in v0.10.0

type MessageNamesExcludePrepositionsRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

MessageNamesExcludePrepositionsRule verifies that all message names don't include prepositions (e.g. "With", "For"). It is assumed that the message names are CamelCase (with an initial capital). See https://cloud.google.com/apis/design/naming_convention#message_names.

func NewMessageNamesExcludePrepositionsRule added in v0.10.0

func NewMessageNamesExcludePrepositionsRule(
	severity rule.Severity,
	prepositions []string,
	excludes []string,
) MessageNamesExcludePrepositionsRule

NewMessageNamesExcludePrepositionsRule creates a new MessageNamesExcludePrepositionsRule.

func (MessageNamesExcludePrepositionsRule) Apply added in v0.10.0

Apply applies the rule to the proto.

func (MessageNamesExcludePrepositionsRule) ID added in v0.10.0

ID returns the ID of this rule.

func (MessageNamesExcludePrepositionsRule) IsOfficial added in v0.10.0

IsOfficial decides whether or not this rule belongs to the official guide.

func (MessageNamesExcludePrepositionsRule) Purpose added in v0.10.0

Purpose returns the purpose of this rule.

type MessageNamesUpperCamelCaseRule

type MessageNamesUpperCamelCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

MessageNamesUpperCamelCaseRule verifies that all message names are CamelCase (with an initial capital). See https://developers.google.com/protocol-buffers/docs/style#message-and-field-names.

func NewMessageNamesUpperCamelCaseRule

func NewMessageNamesUpperCamelCaseRule(
	severity rule.Severity,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) MessageNamesUpperCamelCaseRule

NewMessageNamesUpperCamelCaseRule creates a new MessageNamesUpperCamelCaseRule.

func (MessageNamesUpperCamelCaseRule) Apply

Apply applies the rule to the proto.

func (MessageNamesUpperCamelCaseRule) ID

ID returns the ID of this rule.

func (MessageNamesUpperCamelCaseRule) IsOfficial added in v0.10.0

func (r MessageNamesUpperCamelCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (MessageNamesUpperCamelCaseRule) Purpose

Purpose returns the purpose of this rule.

type MessagesHaveCommentRule added in v0.13.0

type MessagesHaveCommentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

MessagesHaveCommentRule verifies that all messages have a comment.

func NewMessagesHaveCommentRule added in v0.13.0

func NewMessagesHaveCommentRule(
	severity rule.Severity,
	shouldFollowGolangStyle bool,
) MessagesHaveCommentRule

NewMessagesHaveCommentRule creates a new MessagesHaveCommentRule.

func (MessagesHaveCommentRule) Apply added in v0.13.0

func (r MessagesHaveCommentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (MessagesHaveCommentRule) ID added in v0.13.0

ID returns the ID of this rule.

func (MessagesHaveCommentRule) IsOfficial added in v0.13.0

func (r MessagesHaveCommentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (MessagesHaveCommentRule) Purpose added in v0.13.0

func (r MessagesHaveCommentRule) Purpose() string

Purpose returns the purpose of this rule.

type OrderRule added in v0.13.0

type OrderRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

OrderRule verifies that all files should be ordered in the following manner: 1. Syntax 2. Package 3. Imports (sorted) 4. File options 5. Everything else See https://developers.google.com/protocol-buffers/docs/style#file-structure.

func NewOrderRule added in v0.13.0

func NewOrderRule(
	severity rule.Severity,
	fixMode bool,
) OrderRule

NewOrderRule creates a new OrderRule.

func (OrderRule) Apply added in v0.13.0

func (r OrderRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (OrderRule) ID added in v0.13.0

func (r OrderRule) ID() string

ID returns the ID of this rule.

func (OrderRule) IsOfficial added in v0.13.0

func (r OrderRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (OrderRule) Purpose added in v0.13.0

func (r OrderRule) Purpose() string

Purpose returns the purpose of this rule.

type PackageNameLowerCaseRule added in v0.13.0

type PackageNameLowerCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

PackageNameLowerCaseRule verifies that the package name doesn't contain any uppercase letters. See https://developers.google.com/protocol-buffers/docs/style#packages.

func NewPackageNameLowerCaseRule added in v0.13.0

func NewPackageNameLowerCaseRule(
	severity rule.Severity,
	fixMode bool,
) PackageNameLowerCaseRule

NewPackageNameLowerCaseRule creates a new PackageNameLowerCaseRule.

func (PackageNameLowerCaseRule) Apply added in v0.13.0

Apply applies the rule to the proto.

func (PackageNameLowerCaseRule) ID added in v0.13.0

ID returns the ID of this rule.

func (PackageNameLowerCaseRule) IsOfficial added in v0.13.0

func (r PackageNameLowerCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (PackageNameLowerCaseRule) Purpose added in v0.13.0

func (r PackageNameLowerCaseRule) Purpose() string

Purpose returns the purpose of this rule.

type Proto3FieldsAvoidRequiredRule added in v0.24.0

type Proto3FieldsAvoidRequiredRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

Proto3FieldsAvoidRequiredRule verifies that all fields should avoid required for proto3. See https://developers.google.com/protocol-buffers/docs/style#things-to-avoid

func NewProto3FieldsAvoidRequiredRule added in v0.24.0

func NewProto3FieldsAvoidRequiredRule(
	severity rule.Severity,
	fixMode bool,
) Proto3FieldsAvoidRequiredRule

NewProto3FieldsAvoidRequiredRule creates a new Proto3FieldsAvoidRequiredRule.

func (Proto3FieldsAvoidRequiredRule) Apply added in v0.24.0

Apply applies the rule to the proto.

func (Proto3FieldsAvoidRequiredRule) ID added in v0.24.0

ID returns the ID of this rule.

func (Proto3FieldsAvoidRequiredRule) IsOfficial added in v0.24.0

func (r Proto3FieldsAvoidRequiredRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (Proto3FieldsAvoidRequiredRule) Purpose added in v0.24.0

Purpose returns the purpose of this rule.

type Proto3GroupsAvoidRule added in v0.24.0

type Proto3GroupsAvoidRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

Proto3GroupsAvoidRule verifies that all groups should be avoided for proto3. See https://developers.google.com/protocol-buffers/docs/style#things-to-avoid

func NewProto3GroupsAvoidRule added in v0.24.0

func NewProto3GroupsAvoidRule(
	severity rule.Severity,
	autoDisableType autodisable.PlacementType,
) Proto3GroupsAvoidRule

NewProto3GroupsAvoidRule creates a new Proto3GroupsAvoidRule.

func (Proto3GroupsAvoidRule) Apply added in v0.24.0

func (r Proto3GroupsAvoidRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (Proto3GroupsAvoidRule) ID added in v0.24.0

ID returns the ID of this rule.

func (Proto3GroupsAvoidRule) IsOfficial added in v0.24.0

func (r Proto3GroupsAvoidRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (Proto3GroupsAvoidRule) Purpose added in v0.24.0

func (r Proto3GroupsAvoidRule) Purpose() string

Purpose returns the purpose of this rule.

type QuoteConsistentRule added in v0.35.0

type QuoteConsistentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

QuoteConsistentRule verifies that the use of quote for strings is consistent.

func NewQuoteConsistentRule added in v0.35.0

func NewQuoteConsistentRule(
	severity rule.Severity,
	quote config.QuoteType,
	fixMode bool,
) QuoteConsistentRule

NewQuoteConsistentRule creates a new QuoteConsistentRule.

func (QuoteConsistentRule) Apply added in v0.35.0

func (r QuoteConsistentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (QuoteConsistentRule) ID added in v0.35.0

func (r QuoteConsistentRule) ID() string

ID returns the ID of this rule.

func (QuoteConsistentRule) IsOfficial added in v0.35.0

func (r QuoteConsistentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (QuoteConsistentRule) Purpose added in v0.35.0

func (r QuoteConsistentRule) Purpose() string

Purpose returns the purpose of this rule.

type RPCNamesCaseRule added in v0.33.0

type RPCNamesCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

RPCNamesCaseRule verifies that all rpc names conform to the specified convention.

func NewRPCNamesCaseRule added in v0.33.0

func NewRPCNamesCaseRule(
	severity rule.Severity,
	convention config.ConventionType,
) RPCNamesCaseRule

NewRPCNamesCaseRule creates a new RPCNamesCaseRule.

func (RPCNamesCaseRule) Apply added in v0.33.0

func (r RPCNamesCaseRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (RPCNamesCaseRule) ID added in v0.33.0

func (r RPCNamesCaseRule) ID() string

ID returns the ID of this rule.

func (RPCNamesCaseRule) IsOfficial added in v0.33.0

func (r RPCNamesCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (RPCNamesCaseRule) Purpose added in v0.33.0

func (r RPCNamesCaseRule) Purpose() string

Purpose returns the purpose of this rule.

type RPCNamesUpperCamelCaseRule

type RPCNamesUpperCamelCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

RPCNamesUpperCamelCaseRule verifies that all rpc names are CamelCase (with an initial capital). See https://developers.google.com/protocol-buffers/docs/style#services.

func NewRPCNamesUpperCamelCaseRule

func NewRPCNamesUpperCamelCaseRule(
	severity rule.Severity,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) RPCNamesUpperCamelCaseRule

NewRPCNamesUpperCamelCaseRule creates a new RPCNamesUpperCamelCaseRule.

func (RPCNamesUpperCamelCaseRule) Apply

Apply applies the rule to the proto.

func (RPCNamesUpperCamelCaseRule) ID

ID returns the ID of this rule.

func (RPCNamesUpperCamelCaseRule) IsOfficial added in v0.10.0

func (r RPCNamesUpperCamelCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (RPCNamesUpperCamelCaseRule) Purpose

func (r RPCNamesUpperCamelCaseRule) Purpose() string

Purpose returns the purpose of this rule.

type RPCsHaveCommentRule added in v0.13.0

type RPCsHaveCommentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

RPCsHaveCommentRule verifies that all rpcs have a comment.

func NewRPCsHaveCommentRule added in v0.13.0

func NewRPCsHaveCommentRule(
	severity rule.Severity,
	shouldFollowGolangStyle bool,
) RPCsHaveCommentRule

NewRPCsHaveCommentRule creates a new RPCsHaveCommentRule.

func (RPCsHaveCommentRule) Apply added in v0.13.0

func (r RPCsHaveCommentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (RPCsHaveCommentRule) ID added in v0.13.0

func (r RPCsHaveCommentRule) ID() string

ID returns the ID of this rule.

func (RPCsHaveCommentRule) IsOfficial added in v0.13.0

func (r RPCsHaveCommentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (RPCsHaveCommentRule) Purpose added in v0.13.0

func (r RPCsHaveCommentRule) Purpose() string

Purpose returns the purpose of this rule.

type RepeatedFieldNamesPluralizedRule added in v0.25.0

type RepeatedFieldNamesPluralizedRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

RepeatedFieldNamesPluralizedRule verifies that repeated field names are pluralized names. See https://developers.google.com/protocol-buffers/docs/style#repeated-fields.

func NewRepeatedFieldNamesPluralizedRule added in v0.25.0

func NewRepeatedFieldNamesPluralizedRule(
	severity rule.Severity,
	pluralRules map[string]string,
	singularRules map[string]string,
	uncountableRules []string,
	irregularRules map[string]string,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) RepeatedFieldNamesPluralizedRule

NewRepeatedFieldNamesPluralizedRule creates a new RepeatedFieldNamesPluralizedRule.

func (RepeatedFieldNamesPluralizedRule) Apply added in v0.25.0

Apply applies the rule to the proto.

func (RepeatedFieldNamesPluralizedRule) ID added in v0.25.0

ID returns the ID of this rule.

func (RepeatedFieldNamesPluralizedRule) IsOfficial added in v0.25.0

func (r RepeatedFieldNamesPluralizedRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (RepeatedFieldNamesPluralizedRule) Purpose added in v0.25.0

Purpose returns the purpose of this rule.

type RuleWithSeverity added in v0.45.0

type RuleWithSeverity struct {
	// contains filtered or unexported fields
}

RuleWithSeverity represents a rule with a configurable severity.

func NewRuleWithSeverity added in v0.45.0

func NewRuleWithSeverity(
	severity rule.Severity,
) RuleWithSeverity

NewRuleWithSeverity takes a severity and adds it to a new instance of RuleWithSeverity

func (RuleWithSeverity) Severity added in v0.45.0

func (r RuleWithSeverity) Severity() rule.Severity

Severity returns the configured severity.

type ServiceNamesEndWithRule added in v0.9.2

type ServiceNamesEndWithRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

ServiceNamesEndWithRule verifies that all service names end with the specified value.

func NewServiceNamesEndWithRule added in v0.9.2

func NewServiceNamesEndWithRule(
	severity rule.Severity,
	text string,
) ServiceNamesEndWithRule

NewServiceNamesEndWithRule creates a new ServiceNamesEndWithRule.

func (ServiceNamesEndWithRule) Apply added in v0.9.2

func (r ServiceNamesEndWithRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (ServiceNamesEndWithRule) ID added in v0.9.2

ID returns the ID of this rule.

func (ServiceNamesEndWithRule) IsOfficial added in v0.10.0

func (r ServiceNamesEndWithRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (ServiceNamesEndWithRule) Purpose added in v0.9.2

func (r ServiceNamesEndWithRule) Purpose() string

Purpose returns the purpose of this rule.

type ServiceNamesUpperCamelCaseRule

type ServiceNamesUpperCamelCaseRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

ServiceNamesUpperCamelCaseRule verifies that all service names are CamelCase (with an initial capital). See https://developers.google.com/protocol-buffers/docs/style#services.

func NewServiceNamesUpperCamelCaseRule

func NewServiceNamesUpperCamelCaseRule(
	severity rule.Severity,
	fixMode bool,
	autoDisableType autodisable.PlacementType,
) ServiceNamesUpperCamelCaseRule

NewServiceNamesUpperCamelCaseRule creates a new ServiceNamesUpperCamelCaseRule.

func (ServiceNamesUpperCamelCaseRule) Apply

Apply applies the rule to the proto.

func (ServiceNamesUpperCamelCaseRule) ID

ID returns the ID of this rule.

func (ServiceNamesUpperCamelCaseRule) IsOfficial added in v0.10.0

func (r ServiceNamesUpperCamelCaseRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (ServiceNamesUpperCamelCaseRule) Purpose

Purpose returns the purpose of this rule.

type ServicesHaveCommentRule added in v0.13.0

type ServicesHaveCommentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

ServicesHaveCommentRule verifies that all services have a comment.

func NewServicesHaveCommentRule added in v0.13.0

func NewServicesHaveCommentRule(
	severity rule.Severity,
	shouldFollowGolangStyle bool,
) ServicesHaveCommentRule

NewServicesHaveCommentRule creates a new ServicesHaveCommentRule.

func (ServicesHaveCommentRule) Apply added in v0.13.0

func (r ServicesHaveCommentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (ServicesHaveCommentRule) ID added in v0.13.0

ID returns the ID of this rule.

func (ServicesHaveCommentRule) IsOfficial added in v0.13.0

func (r ServicesHaveCommentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (ServicesHaveCommentRule) Purpose added in v0.13.0

func (r ServicesHaveCommentRule) Purpose() string

Purpose returns the purpose of this rule.

type SyntaxConsistentRule added in v0.17.0

type SyntaxConsistentRule struct {
	RuleWithSeverity
	// contains filtered or unexported fields
}

SyntaxConsistentRule verifies that syntax is a specified version.

func NewSyntaxConsistentRule added in v0.17.0

func NewSyntaxConsistentRule(
	severity rule.Severity,
	version string,
) SyntaxConsistentRule

NewSyntaxConsistentRule creates a new SyntaxConsistentRule.

func (SyntaxConsistentRule) Apply added in v0.17.0

func (r SyntaxConsistentRule) Apply(proto *parser.Proto) ([]report.Failure, error)

Apply applies the rule to the proto.

func (SyntaxConsistentRule) ID added in v0.17.0

ID returns the ID of this rule.

func (SyntaxConsistentRule) IsOfficial added in v0.17.0

func (r SyntaxConsistentRule) IsOfficial() bool

IsOfficial decides whether or not this rule belongs to the official guide.

func (SyntaxConsistentRule) Purpose added in v0.17.0

func (r SyntaxConsistentRule) Purpose() string

Purpose returns the purpose of this rule.

Jump to

Keyboard shortcuts

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