config

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConventionType added in v0.33.0

type ConventionType int

ConventionType is a type of name case convention.

const (
	ConventionLowerCamel ConventionType = iota + 1
	ConventionUpperSnake
	ConventionLowerSnake
)

ConventionType constants.

type Directories

type Directories struct {
	Exclude []string `yaml:"exclude"`
}

Directories represents the target directories.

type EnumFieldNamesZeroValueEndWithOption added in v0.10.0

type EnumFieldNamesZeroValueEndWithOption struct {
	Suffix string `yaml:"suffix"`
}

EnumFieldNamesZeroValueEndWithOption represents the option for the ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH rule.

type EnumFieldsHaveCommentOption added in v0.13.0

type EnumFieldsHaveCommentOption struct {
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style"`
}

EnumFieldsHaveCommentOption represents the option for the ENUM_FIELDS_HAVE_COMMENT rule.

type EnumsHaveCommentOption added in v0.13.0

type EnumsHaveCommentOption struct {
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style"`
}

EnumsHaveCommentOption represents the option for the ENUMS_HAVE_COMMENT rule.

type ExternalConfig

type ExternalConfig struct {
	SourcePath string
	Lint       Lint
}

ExternalConfig represents the external configuration.

func GetExternalConfig

func GetExternalConfig(
	filePath string,
	dirPath string,
) (*ExternalConfig, error)

GetExternalConfig provides the externalConfig.

func (ExternalConfig) ShouldSkipRule

func (c ExternalConfig) ShouldSkipRule(
	ruleID string,
	displayPath string,
	defaultRuleIDs []string,
) bool

ShouldSkipRule checks whether to skip applying the rule to the file.

type FieldNamesExcludePrepositionsOption added in v0.10.0

type FieldNamesExcludePrepositionsOption struct {
	Prepositions []string `yaml:"prepositions"`
	Excludes     []string `yaml:"excludes"`
}

FieldNamesExcludePrepositionsOption represents the option for the FIELD_NAMES_EXCLUDE_PREPOSITIONS rule.

type FieldsHaveCommentOption added in v0.13.0

type FieldsHaveCommentOption struct {
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style"`
}

FieldsHaveCommentOption represents the option for the FIELDS_HAVE_COMMENT rule.

type FileNamesLowerSnakeCaseOption added in v0.10.0

type FileNamesLowerSnakeCaseOption struct {
	Excludes []string `yaml:"excludes"`
}

FileNamesLowerSnakeCaseOption represents the option for the FILE_NAMES_LOWER_SNAKE_CASE rule.

type Files added in v0.12.0

type Files struct {
	Exclude []string `yaml:"exclude"`
}

Files represents the target files.

type Ignore

type Ignore struct {
	ID    string   `yaml:"id"`
	Files []string `yaml:"files"`
}

Ignore represents files ignoring the specific rule.

type Ignores

type Ignores []Ignore

Ignores represents list about files ignoring the specific rule.

type ImportsSortedOption added in v0.11.0

type ImportsSortedOption struct {
	// Deprecated: not used
	Newline string
}

ImportsSortedOption represents the option for the IMPORTS_SORTED rule.

func (*ImportsSortedOption) UnmarshalYAML added in v0.11.0

func (i *ImportsSortedOption) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.v2 Unmarshaler interface.

type IndentOption

type IndentOption struct {
	Style string
	// Deprecated: not used
	Newline          string
	NotInsertNewline bool
}

IndentOption represents the option for the INDENT rule.

func (*IndentOption) UnmarshalYAML

func (i *IndentOption) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.v2 Unmarshaler interface.

type Lint

type Lint struct {
	Ignores     Ignores
	Files       Files
	Directories Directories
	Rules       Rules
	RulesOption RulesOption `yaml:"rules_option"`
}

Lint represents the lint configuration.

type MaxLineLengthOption

type MaxLineLengthOption struct {
	MaxChars int `yaml:"max_chars"`
	TabChars int `yaml:"tab_chars"`
}

MaxLineLengthOption represents the option for the MAX_LINE_LENGTH rule.

type MessageNamesExcludePrepositionsOption added in v0.10.0

type MessageNamesExcludePrepositionsOption struct {
	Prepositions []string `yaml:"prepositions"`
	Excludes     []string `yaml:"excludes"`
}

MessageNamesExcludePrepositionsOption represents the option for the MESSAGE_NAMES_EXCLUDE_PREPOSITIONS rule.

type MessagesHaveCommentOption added in v0.13.0

type MessagesHaveCommentOption struct {
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style"`
}

MessagesHaveCommentOption represents the option for the MESSAGES_HAVE_COMMENT rule.

type QuoteConsistentOption added in v0.35.0

type QuoteConsistentOption struct {
	Quote QuoteType
}

QuoteConsistentOption represents the option for the QUOTE_CONSISTENT rule.

func (*QuoteConsistentOption) UnmarshalYAML added in v0.35.0

func (r *QuoteConsistentOption) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.v2 Unmarshaler interface.

type QuoteType added in v0.35.0

type QuoteType int

QuoteType is a type of quote for string.

const (
	DoubleQuote QuoteType = iota
	SingleQuote
)

QuoteType constants.

type RPCNamesCaseOption added in v0.33.0

type RPCNamesCaseOption struct {
	Convention ConventionType
}

RPCNamesCaseOption represents the option for the RPC_NAMES_CASE rule.

func (*RPCNamesCaseOption) UnmarshalYAML added in v0.33.0

func (r *RPCNamesCaseOption) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.v2 Unmarshaler interface.

type RPCsHaveCommentOption added in v0.13.0

type RPCsHaveCommentOption struct {
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style"`
}

RPCsHaveCommentOption represents the option for the RPCS_HAVE_COMMENT rule.

type RepeatedFieldNamesPluralizedOption added in v0.25.0

type RepeatedFieldNamesPluralizedOption struct {
	PluralRules      map[string]string `yaml:"plural_rules"`
	SingularRules    map[string]string `yaml:"singular_rules"`
	UncountableRules []string          `yaml:"uncountable_rules"`
	IrregularRules   map[string]string `yaml:"irregular_rules"`
}

RepeatedFieldNamesPluralizedOption represents the option for the REPEATED_FIELD_NAMES_PLURALIZED rule.

type Rules

type Rules struct {
	NoDefault  bool     `yaml:"no_default"`
	AllDefault bool     `yaml:"all_default"`
	Add        []string `yaml:"add"`
	Remove     []string `yaml:"remove"`
}

Rules represents the enabled rule set.

type RulesOption

type RulesOption struct {
	FileNamesLowerSnakeCase         FileNamesLowerSnakeCaseOption         `yaml:"file_names_lower_snake_case"`
	QuoteConsistentOption           QuoteConsistentOption                 `yaml:"quote_consistent"`
	ImportsSorted                   ImportsSortedOption                   `yaml:"imports_sorted"`
	MaxLineLength                   MaxLineLengthOption                   `yaml:"max_line_length"`
	Indent                          IndentOption                          `yaml:"indent"`
	EnumFieldNamesZeroValueEndWith  EnumFieldNamesZeroValueEndWithOption  `yaml:"enum_field_names_zero_value_end_with"`
	ServiceNamesEndWith             ServiceNamesEndWithOption             `yaml:"service_names_end_with"`
	FieldNamesExcludePrepositions   FieldNamesExcludePrepositionsOption   `yaml:"field_names_exclude_prepositions"`
	MessageNamesExcludePrepositions MessageNamesExcludePrepositionsOption `yaml:"message_names_exclude_prepositions"`
	RPCNamesCaseOption              RPCNamesCaseOption                    `yaml:"rpc_names_case"`
	MessagesHaveComment             MessagesHaveCommentOption             `yaml:"messages_have_comment"`
	ServicesHaveComment             ServicesHaveCommentOption             `yaml:"services_have_comment"`
	RPCsHaveComment                 RPCsHaveCommentOption                 `yaml:"rpcs_have_comment"`
	FieldsHaveComment               FieldsHaveCommentOption               `yaml:"fields_have_comment"`
	EnumsHaveComment                EnumsHaveCommentOption                `yaml:"enums_have_comment"`
	EnumFieldsHaveComment           EnumFieldsHaveCommentOption           `yaml:"enum_fields_have_comment"`
	SyntaxConsistent                SyntaxConsistentOption                `yaml:"syntax_consistent"`
	RepeatedFieldNamesPluralized    RepeatedFieldNamesPluralizedOption    `yaml:"repeated_field_names_pluralized"`
}

RulesOption represents the option for some rules.

type ServiceNamesEndWithOption added in v0.9.2

type ServiceNamesEndWithOption struct {
	Text string `yaml:"text"`
}

ServiceNamesEndWithOption represents the option for the SERVICE_NAMES_END_WITH rule.

type ServicesHaveCommentOption added in v0.13.0

type ServicesHaveCommentOption struct {
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style"`
}

ServicesHaveCommentOption represents the option for the SERVICES_HAVE_COMMENT rule.

type SyntaxConsistentOption added in v0.17.0

type SyntaxConsistentOption struct {
	Version string `yaml:"version"`
}

SyntaxConsistentOption represents the option for the SYNTAX_CONSISTENT rule.

Jump to

Keyboard shortcuts

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