Skip to content

Commit e24f69c

Browse files
committed
chore: copy v1 configuration structures
The structures are altered to use pointer on builtin types. The field version is added to detect already migrated file.
1 parent 973f628 commit e24f69c

File tree

8 files changed

+1022
-0
lines changed

8 files changed

+1022
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package one
2+
3+
type BaseRule struct {
4+
Linters []string `mapstructure:"linters"`
5+
Path *string `mapstructure:"path"`
6+
PathExcept *string `mapstructure:"path-except"`
7+
Text *string `mapstructure:"text"`
8+
Source *string `mapstructure:"source"`
9+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package one
2+
3+
type Config struct {
4+
cfgDir string // Path to the directory containing golangci-lint config file.
5+
6+
Version string `mapstructure:"version"` // From v2, to be able to detect already migrated config file.
7+
8+
Run Run `mapstructure:"run"`
9+
10+
Output Output `mapstructure:"output"`
11+
12+
LintersSettings LintersSettings `mapstructure:"linters-settings"`
13+
Linters Linters `mapstructure:"linters"`
14+
Issues Issues `mapstructure:"issues"`
15+
Severity Severity `mapstructure:"severity"`
16+
}
17+
18+
func NewConfig() *Config {
19+
return &Config{}
20+
}
21+
22+
// SetConfigDir sets the path to directory that contains golangci-lint config file.
23+
func (c *Config) SetConfigDir(dir string) {
24+
c.cfgDir = dir
25+
}
26+
27+
func (*Config) IsInternalTest() bool {
28+
return false
29+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package one
2+
3+
type Issues struct {
4+
IncludeDefaultExcludes []string `mapstructure:"include"`
5+
ExcludeCaseSensitive *bool `mapstructure:"exclude-case-sensitive"`
6+
ExcludePatterns []string `mapstructure:"exclude"`
7+
ExcludeRules []ExcludeRule `mapstructure:"exclude-rules"`
8+
UseDefaultExcludes *bool `mapstructure:"exclude-use-default"`
9+
10+
ExcludeGenerated *string `mapstructure:"exclude-generated"`
11+
12+
ExcludeFiles []string `mapstructure:"exclude-files"`
13+
ExcludeDirs []string `mapstructure:"exclude-dirs"`
14+
15+
UseDefaultExcludeDirs *bool `mapstructure:"exclude-dirs-use-default"`
16+
17+
MaxIssuesPerLinter *int `mapstructure:"max-issues-per-linter"`
18+
MaxSameIssues *int `mapstructure:"max-same-issues"`
19+
UniqByLine *bool `mapstructure:"uniq-by-line"`
20+
21+
DiffFromRevision *string `mapstructure:"new-from-rev"`
22+
DiffFromMergeBase *string `mapstructure:"new-from-merge-base"`
23+
DiffPatchFilePath *string `mapstructure:"new-from-patch"`
24+
WholeFiles *bool `mapstructure:"whole-files"`
25+
Diff *bool `mapstructure:"new"`
26+
27+
NeedFix *bool `mapstructure:"fix"`
28+
}
29+
30+
type ExcludeRule struct {
31+
BaseRule `mapstructure:",squash"`
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package one
2+
3+
type Linters struct {
4+
Enable []string `mapstructure:"enable"`
5+
Disable []string `mapstructure:"disable"`
6+
EnableAll *bool `mapstructure:"enable-all"`
7+
DisableAll *bool `mapstructure:"disable-all"`
8+
Fast *bool `mapstructure:"fast"`
9+
10+
Presets []string `mapstructure:"presets"`
11+
}

0 commit comments

Comments
 (0)