golangci-lint/pkg/config/config.go

109 lines
1.9 KiB
Go
Raw Normal View History

package config
2018-05-06 19:08:34 +03:00
import (
"time"
)
2018-05-06 09:41:48 +03:00
2018-05-05 09:24:37 +03:00
type OutFormat string
const (
OutFormatJSON = "json"
OutFormatLineNumber = "line-number"
OutFormatColoredLineNumber = "colored-line-number"
)
var OutFormats = []string{OutFormatColoredLineNumber, OutFormatLineNumber, OutFormatJSON}
var DefaultExcludePatterns = []string{
"should have comment",
"comment on exported method",
"G104", // disable what errcheck does: it reports on Close etc
"G204", // Subprocess launching should be audited: too lot false positives
"G304", // Potential file inclusion via variable: `src, err := ioutil.ReadFile(filename)`
}
2018-05-06 13:41:42 +03:00
2018-05-05 09:24:37 +03:00
type Common struct {
2018-05-05 19:43:18 +03:00
IsVerbose bool
CPUProfilePath string
2018-05-06 12:08:57 +03:00
Concurrency int
2018-05-05 09:24:37 +03:00
}
type Run struct { // nolint:maligned
2018-05-06 19:08:34 +03:00
Args []string
2018-05-05 19:43:18 +03:00
BuildTags []string
2018-05-08 11:54:30 +03:00
OutFormat string
PrintIssuedLine bool
2018-05-05 11:08:14 +03:00
ExitCodeIfIssuesFound int
2018-05-05 19:43:18 +03:00
Errcheck struct {
CheckClose bool
CheckTypeAssertions bool
CheckAssignToBlank bool
}
2018-05-05 22:22:21 +03:00
Govet struct {
CheckShadowing bool
}
2018-05-06 07:20:12 +03:00
Golint struct {
MinConfidence float64
}
2018-05-06 09:41:48 +03:00
Gofmt struct {
Simplify bool
}
2018-05-06 15:24:45 +03:00
Gocyclo struct {
MinComplexity int
}
2018-05-06 20:28:59 +03:00
Varcheck struct {
CheckExportedFields bool
}
Structcheck struct {
CheckExportedFields bool
}
2018-05-06 21:08:53 +03:00
Maligned struct {
SuggestNewOrder bool
}
2018-05-06 22:58:04 +03:00
Megacheck struct {
EnableStaticcheck bool
EnableUnused bool
EnableGosimple bool
}
2018-05-07 09:09:10 +03:00
Dupl struct {
Threshold int
}
2018-05-07 12:43:52 +03:00
Goconst struct {
MinStringLen int
MinOccurrencesCount int
}
EnabledLinters []string
DisabledLinters []string
EnableAllLinters bool
DisableAllLinters bool
2018-05-06 13:41:42 +03:00
ExcludePatterns []string
UseDefaultExcludes bool
2018-05-06 19:08:34 +03:00
Deadline time.Duration
MaxIssuesPerLinter int
2018-05-08 09:55:38 +03:00
DiffFromRevision string
DiffPatchFilePath string
Diff bool
2018-05-05 09:24:37 +03:00
}
type Config struct {
2018-05-05 09:24:37 +03:00
Common Common
Run Run
}
func NewDefault() *Config {
return &Config{
Run: Run{
OutFormat: OutFormatColoredLineNumber,
},
}
}