config

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: 10 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 CustomizableSeverityOption added in v0.45.0

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

CustomizableSeverityOption represents an option where the severity of a rule can be configured via yaml.

func (CustomizableSeverityOption) Severity added in v0.45.0

Severity returns the configured severity. If no severity is set, the default severity will be ERROR

type Directories

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

Directories represents the target directories.

type EnumFieldNamesZeroValueEndWithOption added in v0.10.0

type EnumFieldNamesZeroValueEndWithOption struct {
	CustomizableSeverityOption
	Suffix string `yaml:"suffix" json:"suffix" toml:"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 {
	CustomizableSeverityOption
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style" json:"should_follow_golang_style" toml:"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 {
	CustomizableSeverityOption
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style" json:"should_follow_golang_style" toml:"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 {
	CustomizableSeverityOption
	Prepositions []string `yaml:"prepositions" json:"prepositions" toml:"prepositions"`
	Excludes     []string `yaml:"excludes" json:"excludes" toml:"excludes"`
}

FieldNamesExcludePrepositionsOption represents the option for the FIELD_NAMES_EXCLUDE_PREPOSITIONS rule.

type FieldsHaveCommentOption added in v0.13.0

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

FieldsHaveCommentOption represents the option for the FIELDS_HAVE_COMMENT rule.

type FileNamesLowerSnakeCaseOption added in v0.10.0

type FileNamesLowerSnakeCaseOption struct {
	CustomizableSeverityOption
	Excludes []string `yaml:"excludes" json:"excludes" toml:"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" json:"exclude" toml:"exclude"`
}

Files represents the target files.

type Ignore

type Ignore struct {
	ID    string   `yaml:"id" json:"id" toml:"id"`
	Files []string `yaml:"files" json:"files" toml:"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 {
	CustomizableSeverityOption
	// Deprecated: not used
	Newline string
}

ImportsSortedOption represents the option for the IMPORTS_SORTED rule.

func (*ImportsSortedOption) UnmarshalTOML added in v0.49.0

func (i *ImportsSortedOption) UnmarshalTOML(data interface{}) error

UnmarshalTOML implements toml Unmarshaler interface.

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 {
	CustomizableSeverityOption
	Style string
	// Deprecated: not used
	Newline          string
	NotInsertNewline bool
}

IndentOption represents the option for the INDENT rule.

func (*IndentOption) UnmarshalTOML added in v0.49.0

func (i *IndentOption) UnmarshalTOML(data interface{}) error

UnmarshalTOML implements toml Unmarshaler interface.

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" json:"rules_option" toml:"rules_option"`
}

Lint represents the lint configuration.

type MaxLineLengthOption

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

MaxLineLengthOption represents the option for the MAX_LINE_LENGTH rule.

type MessageNamesExcludePrepositionsOption added in v0.10.0

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

MessageNamesExcludePrepositionsOption represents the option for the MESSAGE_NAMES_EXCLUDE_PREPOSITIONS rule.

type MessagesHaveCommentOption added in v0.13.0

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

MessagesHaveCommentOption represents the option for the MESSAGES_HAVE_COMMENT rule.

type QuoteConsistentOption added in v0.35.0

type QuoteConsistentOption struct {
	CustomizableSeverityOption
	Quote QuoteType
}

QuoteConsistentOption represents the option for the QUOTE_CONSISTENT rule.

func (*QuoteConsistentOption) UnmarshalToml added in v0.49.0

func (r *QuoteConsistentOption) UnmarshalToml(data interface{}) error

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 {
	CustomizableSeverityOption
	Convention ConventionType
}

RPCNamesCaseOption represents the option for the RPC_NAMES_CASE rule.

func (*RPCNamesCaseOption) UnmarshalTOML added in v0.49.0

func (r *RPCNamesCaseOption) UnmarshalTOML(data interface{}) error

UnmarshalTOML implements toml Unmarshaler interface.

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 {
	CustomizableSeverityOption
	ShouldFollowGolangStyle bool `yaml:"should_follow_golang_style" json:"should_follow_golang_style" toml:"should_follow_golang_style"`
}

RPCsHaveCommentOption represents the option for the RPCS_HAVE_COMMENT rule.

type RepeatedFieldNamesPluralizedOption added in v0.25.0

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

RepeatedFieldNamesPluralizedOption represents the option for the REPEATED_FIELD_NAMES_PLURALIZED rule.

type Rules

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

Rules represents the enabled rule set.

type RulesOption

type RulesOption struct {
	FileNamesLowerSnakeCase         FileNamesLowerSnakeCaseOption         `yaml:"file_names_lower_snake_case" json:"file_names_lower_snake_case" toml:"file_names_lower_snake_case"`
	QuoteConsistentOption           QuoteConsistentOption                 `yaml:"quote_consistent" json:"quote_consistent" toml:"quote_consistent"`
	ImportsSorted                   ImportsSortedOption                   `yaml:"imports_sorted" json:"imports_sorted" toml:"imports_sorted"`
	MaxLineLength                   MaxLineLengthOption                   `yaml:"max_line_length" json:"max_line_length" toml:"max_line_length"`
	Indent                          IndentOption                          `yaml:"indent" json:"indent" toml:"indent"`
	EnumFieldNamesZeroValueEndWith  EnumFieldNamesZeroValueEndWithOption  `` /* 131-byte string literal not displayed */
	ServiceNamesEndWith             ServiceNamesEndWithOption             `yaml:"service_names_end_with" json:"service_names_end_with" toml:"service_names_end_with"`
	FieldNamesExcludePrepositions   FieldNamesExcludePrepositionsOption   `yaml:"field_names_exclude_prepositions" json:"field_names_exclude_prepositions" toml:"field_names_exclude_prepositions"`
	MessageNamesExcludePrepositions MessageNamesExcludePrepositionsOption `yaml:"message_names_exclude_prepositions" json:"message_names_exclude_prepositions" toml:"message_names_exclude_prepositions"`
	RPCNamesCaseOption              RPCNamesCaseOption                    `yaml:"rpc_names_case" json:"rpc_names_case" toml:"rpc_names_case"`
	MessagesHaveComment             MessagesHaveCommentOption             `yaml:"messages_have_comment" json:"messages_have_comment" toml:"messages_have_comment"`
	ServicesHaveComment             ServicesHaveCommentOption             `yaml:"services_have_comment" json:"services_have_comment" toml:"services_have_comment"`
	RPCsHaveComment                 RPCsHaveCommentOption                 `yaml:"rpcs_have_comment" json:"rpcs_have_comment" toml:"rpcs_have_comment"`
	FieldsHaveComment               FieldsHaveCommentOption               `yaml:"fields_have_comment" json:"fields_have_comment" toml:"fields_have_comment"`
	EnumsHaveComment                EnumsHaveCommentOption                `yaml:"enums_have_comment" json:"enums_have_comment" toml:"enums_have_comment"`
	EnumFieldsHaveComment           EnumFieldsHaveCommentOption           `yaml:"enum_fields_have_comment" json:"enum_fields_have_comment" toml:"enum_fields_have_comment"`
	SyntaxConsistent                SyntaxConsistentOption                `yaml:"syntax_consistent" json:"syntax_consistent" toml:"syntax_consistent"`
	RepeatedFieldNamesPluralized    RepeatedFieldNamesPluralizedOption    `yaml:"repeated_field_names_pluralized" json:"repeated_field_names_pluralized" toml:"repeated_field_names_pluralized"`
	EnumFieldNamesPrefix            CustomizableSeverityOption            `yaml:"enum_field_names_prefix" json:"enum_field_names_prefix" toml:"enum_field_names_prefix"`
	EnumFieldNamesUpperSnakeCase    CustomizableSeverityOption            `yaml:"enum_field_names_upper_snake_case" json:"enum_field_names_upper_snake_case" toml:"enum_field_names_upper_snake_case"`
	EnumNamesUpperCamelCase         CustomizableSeverityOption            `yaml:"enum_names_upper_camel_case" json:"enum_names_upper_camel_case" toml:"enum_names_upper_camel_case"`
	FieldNamesLowerSnakeCase        CustomizableSeverityOption            `yaml:"field_names_lower_snake_case" json:"field_names_lower_snake_case" toml:"field_names_lower_snake_case"`
	FileHasComment                  CustomizableSeverityOption            `yaml:"file_has_comment" json:"file_has_comment" toml:"file_has_comment"`
	MessageNamesUpperCamelCase      CustomizableSeverityOption            `yaml:"message_names_upper_camel_case" json:"message_names_upper_camel_case" toml:"message_names_upper_camel_case"`
	Order                           CustomizableSeverityOption            `yaml:"order" json:"order" toml:"order"`
	PackageNameLowerCase            CustomizableSeverityOption            `yaml:"package_name_lower_case" json:"package_name_lower_case" toml:"package_name_lower_case"`
	Proto3FieldsAvoidRequired       CustomizableSeverityOption            `yaml:"proto3_fields_avoid_required" json:"proto3_fields_avoid_required" toml:"proto3_fields_avoid_required"`
	Proto3GroupsAvoid               CustomizableSeverityOption            `yaml:"proto3_groups_avoid" json:"proto3_groups_avoid" toml:"proto3_groups_avoid"`
	RPCNamesUpperCamelCase          CustomizableSeverityOption            `yaml:"rpc_names_upper_camel_case" json:"rpc_names_upper_camel_case" toml:"rpc_names_upper_camel_case"`
	ServiceNamesUpperCamelCase      CustomizableSeverityOption            `yaml:"service_names_upper_caml_case" json:"service_names_upper_caml_case" toml:"service_names_upper_caml_case"`
}

RulesOption represents the option for some rules.

type ServiceNamesEndWithOption added in v0.9.2

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

ServiceNamesEndWithOption represents the option for the SERVICE_NAMES_END_WITH rule.

type ServicesHaveCommentOption added in v0.13.0

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

ServicesHaveCommentOption represents the option for the SERVICES_HAVE_COMMENT rule.

type SyntaxConsistentOption added in v0.17.0

type SyntaxConsistentOption struct {
	CustomizableSeverityOption
	Version string `yaml:"version" json:"version" toml:"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