rules

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnumFieldNamesUpperSnakeCaseRule

type EnumFieldNamesUpperSnakeCaseRule struct{}

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() 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 {
	// 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(
	suffix string,
) 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 EnumNamesUpperCamelCaseRule

type EnumNamesUpperCamelCaseRule struct{}

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() 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 FieldNamesExcludePrepositionsRule added in v0.10.0

type FieldNamesExcludePrepositionsRule struct {
	// 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(
	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{}

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() 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 FileNamesLowerSnakeCaseRule added in v0.10.0

type FileNamesLowerSnakeCaseRule struct {
	// 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(
	excluded []string,
) 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 {
	// contains filtered or unexported fields
}

ImportsSortedRule enforces sorted imports.

func NewImportsSortedRule added in v0.11.0

func NewImportsSortedRule(
	newline string,
	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 {
	// contains filtered or unexported fields
}

IndentRule enforces a consistent indentation style.

func NewIndentRule

func NewIndentRule(
	style string,
	newline string,
	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 {
	// 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(
	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 {
	// 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(
	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{}

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() 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 RPCNamesUpperCamelCaseRule

type RPCNamesUpperCamelCaseRule struct{}

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() 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 ServiceNamesEndWithRule added in v0.9.2

type ServiceNamesEndWithRule struct {
	// 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(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{}

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() 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.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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