Documentation
¶
Overview ¶
Package config provides functionality for loading and working with the configuration settings.
Index ¶
- Constants
- func MarshalConfig(v *Config) (string, error)
- type Config
- func (cfg *Config) GetExcludedChecks() []string
- func (cfg *Config) GetExcludedDescriptors() []string
- func (cfg *Config) GetGitHubURL() string
- func (cfg *Config) GetModuleName() string
- func (cfg *Config) GetPrintAllDescriptors() bool
- func (cfg *Config) GetVerboseMode() bool
- func (cfg *Config) IsCheckExcluded(name string) bool
Constants ¶
const (
// DefaultConfigName - default configuration file name.
DefaultConfigName = ".protolinter.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func MarshalConfig ¶ added in v1.1.6
MarshalConfig converts the given Config struct to its YAML representation.
Types ¶
type Config ¶
type Config struct {
// VerboseMode specifies whether to show verbose messages, such as when downloading dependencies.
VerboseMode bool `mapstructure:"verbose_mode" yaml:"verbose_mode"`
// ExcludedChecks is a list of checks that should be excluded from analysis.
ExcludedChecks []string `mapstructure:"excluded_checks" yaml:"excluded_checks"`
// ExcludedDescriptors is a list of full protopaths that should be excluded from analysis.
ExcludedDescriptors []string `mapstructure:"excluded_descriptors" yaml:"excluded_descriptors"`
// contains filtered or unexported fields
}
Config represents the configuration read from the file.
func LoadConfig ¶
LoadConfig loads the configuration from the specified file using Viper. If the filename is empty, it loads the default configuration file.
func (*Config) GetExcludedChecks ¶
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 ¶
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) GetGitHubURL ¶ added in v1.1.6
GetGitHubURL returns the custom file repository URL set in the configuration. If the Config is nil or GitHubURL is not set, it returns an empty string.
func (*Config) GetModuleName ¶ added in v1.1.6
GetModuleName returns the module name extracted from the go.mod file. If the Config is nil, it returns an empty string.
func (*Config) GetPrintAllDescriptors ¶ added in v1.1.6
GetPrintAllDescriptors returns the value of printAllDescriptors from the Config struct. If the Config is nil, it returns false.
func (*Config) GetVerboseMode ¶
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 ¶
IsCheckExcluded checks if a specific check is excluded based on the configuration.