config

package
v0.0.0-...-27f9dfe Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package config manages the configuration of gomultilinter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetVerbose

func SetVerbose(verbose bool)

SetVerbose initializes the logger with the corresponding severity

Types

type Config

type Config struct {
	// Verbose output
	// only via cli flag
	Verbose bool

	// ForceUpdate enforces rebuild
	// of the linter plugins
	ForceUpdate bool `json:"force_update"`

	// OutputFormat go text/template which is used to print out issues
	// see internal/checker/issue/LinterIssue for available fields
	OutputFormat string `json:"output_format"`

	// MinSeverity for which issues should be printed
	MinSeverity *Severity `json:"min_severity"`

	// Exclude can exclude issues based on their message, name or category
	Exclude *ExcludeConfig `json:"exclude"`

	// LinterInstallDirectory is the dir to which the linter plugins get installed
	LinterInstallDirectory string `json:"linter_install_directory"`

	// Linter which should be used
	Linter []*LinterConfig `json:"linter"`
}

Config represents all possible configuration flags for gomultilinter see newDefaultConfig for default values

func ReadConfig

func ReadConfig(path string, verbose, forceUpdate bool) (*Config, error)

ReadConfig reads the config file at the specified path if the specified path is empty it searches from the current directory upwards in the fs for a file named .gomultilinter.yml verbose, and forceUpdate are cli flags which can be provided and override the flags from the configfile

type ExcludeConfig

type ExcludeConfig struct {
	// if true unnecessary nolint comment directives do not result in an issue
	UnnecessaryNoLintDirectives bool `json:"unnecessary_no_lint_directives"`

	// Tests if true test files are ignored
	Tests bool `json:"tests"`

	// File-/Packagenames which should be excluded
	Names MultiRegex `json:"names"`

	// Linter messages which should be excluded
	Messages MultiRegex `json:"messages"`

	// Linter cagtegories which should be excluded
	Categories MultiRegex `json:"categories"`
}

ExcludeConfig excludes Issues by matching corresponding regular expressions

type LinterConfig

type LinterConfig struct {
	// Package of the gomultilinter plugin
	Package string `json:"package"`

	// PluginPath is the path to the .so file of the gomultilinter plugin
	PluginPath string `json:"plugin_path"`

	// Config is the Configuration for the concrete linter
	Config json.RawMessage `json:"config"`
}

LinterConfig represents a Linter which should be used Package or PluginPath needs to be provided

type MultiRegex

type MultiRegex []*Regex

MultiRegex wraps multiple regular expressions

func (MultiRegex) MatchesAll

func (r MultiRegex) MatchesAll(input string) bool

MatchesAll returns true if all of the regexps matches the input

func (MultiRegex) MatchesAny

func (r MultiRegex) MatchesAny(input string) bool

MatchesAny returns true if any of the regexps matches the input

type Regex

type Regex struct {
	*regexp.Regexp
}

Regex is an JSON-Compatible wrapper for a compiled regular expression

func (*Regex) UnmarshalText

func (r *Regex) UnmarshalText(data []byte) error

UnmarshalText compiles the provided regex

type Severity

type Severity struct {
	api.Severity
}

Severity is an JSON-compatible severity

func (*Severity) UnmarshalText

func (s *Severity) UnmarshalText(data []byte) error

UnmarshalText parses the severity out of the provided text

Jump to

Keyboard shortcuts

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