config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConfigName = ".protolinter.yaml"

DefaultConfigName - default configuration file name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// VerboseMode specifies whether to show verbose messages, such as when downloading dependencies.
	VerboseMode bool `mapstructure:"verbose_mode"`
	// OmitCoordinates specifies whether to omit source file coordinates from error messages.
	OmitCoordinates bool `mapstructure:"omit_coordinates"`
	// ExcludedChecks is a list of checks that should be excluded from analysis.
	ExcludedChecks []string `mapstructure:"excluded_checks"`
	// ExcludedDescriptors is a list of full protopaths that should be excluded from analysis.
	ExcludedDescriptors []string `mapstructure:"excluded_descriptors"`
	// contains filtered or unexported fields
}

Config represents the configuration read from the file.

func LoadConfig

func LoadConfig(filename string) (*Config, error)

LoadConfig loads the configuration from the specified file using Viper. If the filename is empty, it loads the default configuration file.

func (*Config) GetExcludedChecks

func (cfg *Config) GetExcludedChecks() []string

GetExcludedChecks returns the list of excluded checks from the Config struct. If the Config is nil or ExcludedChecks is not set, it returns an empty slice.

func (*Config) GetExcludedDescriptors

func (cfg *Config) GetExcludedDescriptors() []string

GetExcludedDescriptors returns the list of excluded descriptors from the Config struct. If the Config is nil or ExcludedDescriptors is not set, it returns an empty slice.

func (*Config) GetOmitCoordinates

func (cfg *Config) GetOmitCoordinates() bool

GetOmitCoordinates returns the value of OmitCoordinates from the Config struct. If the Config is nil or OmitCoordinates is not set, it returns false.

func (*Config) GetVerboseMode

func (cfg *Config) GetVerboseMode() bool

GetVerboseMode returns the value of VerboseMode from the Config struct. If the Config is nil or VerboseMode is not set, it returns false.

func (*Config) IsCheckExcluded

func (cfg *Config) IsCheckExcluded(name string) bool

IsCheckExcluded checks if a specific check is excluded based on the configuration.

Jump to

Keyboard shortcuts

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