github.com/nozzle/golangci-lint@v1.49.0-nz3/pkg/config/linters_settings.go (about)

     1  package config
     2  
     3  import (
     4  	"runtime"
     5  
     6  	"github.com/pkg/errors"
     7  )
     8  
     9  var defaultLintersSettings = LintersSettings{
    10  	Asasalint: AsasalintSettings{
    11  		UseBuiltinExclusions: true,
    12  	},
    13  	Decorder: DecorderSettings{
    14  		DecOrder:                  []string{"type", "const", "var", "func"},
    15  		DisableDecNumCheck:        true,
    16  		DisableDecOrderCheck:      true,
    17  		DisableInitFuncFirstCheck: true,
    18  	},
    19  	Dogsled: DogsledSettings{
    20  		MaxBlankIdentifiers: 2,
    21  	},
    22  	ErrorLint: ErrorLintSettings{
    23  		Errorf:     true,
    24  		Asserts:    true,
    25  		Comparison: true,
    26  	},
    27  	Exhaustive: ExhaustiveSettings{
    28  		Check:                      []string{"switch"},
    29  		CheckGenerated:             false,
    30  		DefaultSignifiesExhaustive: false,
    31  		IgnoreEnumMembers:          "",
    32  		PackageScopeOnly:           false,
    33  		ExplicitExhaustiveMap:      false,
    34  		ExplicitExhaustiveSwitch:   false,
    35  	},
    36  	Forbidigo: ForbidigoSettings{
    37  		ExcludeGodocExamples: true,
    38  	},
    39  	Gci: GciSettings{
    40  		Sections:      []string{"standard", "default"},
    41  		SkipGenerated: true,
    42  	},
    43  	Gocognit: GocognitSettings{
    44  		MinComplexity: 30,
    45  	},
    46  	Gocritic: GoCriticSettings{
    47  		SettingsPerCheck: map[string]GoCriticCheckSettings{},
    48  	},
    49  	Godox: GodoxSettings{
    50  		Keywords: []string{},
    51  	},
    52  	Godot: GodotSettings{
    53  		Scope:  "declarations",
    54  		Period: true,
    55  	},
    56  	Gofumpt: GofumptSettings{
    57  		LangVersion: "",
    58  		ModulePath:  "",
    59  		ExtraRules:  false,
    60  	},
    61  	Gosec: GoSecSettings{
    62  		Concurrency: runtime.NumCPU(),
    63  	},
    64  	Ifshort: IfshortSettings{
    65  		MaxDeclLines: 1,
    66  		MaxDeclChars: 30,
    67  	},
    68  	InterfaceBloat: InterfaceBloatSettings{
    69  		Max: 10,
    70  	},
    71  	Lll: LllSettings{
    72  		LineLength: 120,
    73  		TabWidth:   1,
    74  	},
    75  	LoggerCheck: LoggerCheckSettings{
    76  		Kitlog:           true,
    77  		Klog:             true,
    78  		Logr:             true,
    79  		Zap:              true,
    80  		RequireStringKey: false,
    81  		NoPrintfLike:     false,
    82  		Rules:            nil,
    83  	},
    84  	MaintIdx: MaintIdxSettings{
    85  		Under: 20,
    86  	},
    87  	Nakedret: NakedretSettings{
    88  		MaxFuncLines: 30,
    89  	},
    90  	Nestif: NestifSettings{
    91  		MinComplexity: 5,
    92  	},
    93  	NoLintLint: NoLintLintSettings{
    94  		RequireExplanation: false,
    95  		RequireSpecific:    false,
    96  		AllowUnused:        false,
    97  	},
    98  	Prealloc: PreallocSettings{
    99  		Simple:     true,
   100  		RangeLoops: true,
   101  		ForLoops:   false,
   102  	},
   103  	Predeclared: PredeclaredSettings{
   104  		Ignore:    "",
   105  		Qualified: false,
   106  	},
   107  	Testpackage: TestpackageSettings{
   108  		SkipRegexp:    `(export|internal)_test\.go`,
   109  		AllowPackages: []string{"main"},
   110  	},
   111  	Unparam: UnparamSettings{
   112  		Algo: "cha",
   113  	},
   114  	Varnamelen: VarnamelenSettings{
   115  		MaxDistance:   5,
   116  		MinNameLength: 3,
   117  	},
   118  	WSL: WSLSettings{
   119  		StrictAppend:                     true,
   120  		AllowAssignAndCallCuddle:         true,
   121  		AllowAssignAndAnythingCuddle:     false,
   122  		AllowMultiLineAssignCuddle:       true,
   123  		ForceCaseTrailingWhitespaceLimit: 0,
   124  		AllowTrailingComment:             false,
   125  		AllowSeparatedLeadingComment:     false,
   126  		AllowCuddleDeclaration:           false,
   127  		AllowCuddleWithCalls:             []string{"Lock", "RLock"},
   128  		AllowCuddleWithRHS:               []string{"Unlock", "RUnlock"},
   129  		ForceCuddleErrCheckAndAssign:     false,
   130  		ErrorVariableNames:               []string{"err"},
   131  		ForceExclusiveShortDeclarations:  false,
   132  	},
   133  }
   134  
   135  type LintersSettings struct {
   136  	Asasalint        AsasalintSettings
   137  	BiDiChk          BiDiChkSettings
   138  	Cyclop           Cyclop
   139  	Decorder         DecorderSettings
   140  	Depguard         DepGuardSettings
   141  	Dogsled          DogsledSettings
   142  	Dupl             DuplSettings
   143  	DupWord          DupWordSettings
   144  	Errcheck         ErrcheckSettings
   145  	ErrChkJSON       ErrChkJSONSettings
   146  	ErrorLint        ErrorLintSettings
   147  	Exhaustive       ExhaustiveSettings
   148  	ExhaustiveStruct ExhaustiveStructSettings
   149  	Exhaustruct      ExhaustructSettings
   150  	Forbidigo        ForbidigoSettings
   151  	Funlen           FunlenSettings
   152  	Gci              GciSettings
   153  	Gocognit         GocognitSettings
   154  	Goconst          GoConstSettings
   155  	Gocritic         GoCriticSettings
   156  	Gocyclo          GoCycloSettings
   157  	Godot            GodotSettings
   158  	Godox            GodoxSettings
   159  	Gofmt            GoFmtSettings
   160  	Gofumpt          GofumptSettings
   161  	Goheader         GoHeaderSettings
   162  	Goimports        GoImportsSettings
   163  	Golint           GoLintSettings
   164  	Gomnd            GoMndSettings
   165  	GoModDirectives  GoModDirectivesSettings
   166  	Gomodguard       GoModGuardSettings
   167  	Gosec            GoSecSettings
   168  	Gosimple         StaticCheckSettings
   169  	Govet            GovetSettings
   170  	Grouper          GrouperSettings
   171  	Ifshort          IfshortSettings
   172  	ImportAs         ImportAsSettings
   173  	InterfaceBloat   InterfaceBloatSettings
   174  	Ireturn          IreturnSettings
   175  	Lll              LllSettings
   176  	LoggerCheck      LoggerCheckSettings
   177  	MaintIdx         MaintIdxSettings
   178  	Makezero         MakezeroSettings
   179  	Maligned         MalignedSettings
   180  	Misspell         MisspellSettings
   181  	Nakedret         NakedretSettings
   182  	Nestif           NestifSettings
   183  	NilNil           NilNilSettings
   184  	Nlreturn         NlreturnSettings
   185  	NoLintLint       NoLintLintSettings
   186  	NoNamedReturns   NoNamedReturnsSettings
   187  	ParallelTest     ParallelTestSettings
   188  	Prealloc         PreallocSettings
   189  	Predeclared      PredeclaredSettings
   190  	Promlinter       PromlinterSettings
   191  	Reassign         ReassignSettings
   192  	Revive           ReviveSettings
   193  	RowsErrCheck     RowsErrCheckSettings
   194  	Staticcheck      StaticCheckSettings
   195  	Structcheck      StructCheckSettings
   196  	Stylecheck       StaticCheckSettings
   197  	Tagliatelle      TagliatelleSettings
   198  	Tenv             TenvSettings
   199  	Testpackage      TestpackageSettings
   200  	Thelper          ThelperSettings
   201  	Unparam          UnparamSettings
   202  	Unused           StaticCheckSettings
   203  	UseStdlibVars    UseStdlibVarsSettings
   204  	Varcheck         VarCheckSettings
   205  	Varnamelen       VarnamelenSettings
   206  	Whitespace       WhitespaceSettings
   207  	Wrapcheck        WrapcheckSettings
   208  	WSL              WSLSettings
   209  
   210  	Custom map[string]CustomLinterSettings
   211  }
   212  
   213  type AsasalintSettings struct {
   214  	Exclude              []string `mapstructure:"exclude"`
   215  	UseBuiltinExclusions bool     `mapstructure:"use-builtin-exclusions"`
   216  	IgnoreTest           bool     `mapstructure:"ignore-test"`
   217  }
   218  
   219  type BiDiChkSettings struct {
   220  	LeftToRightEmbedding     bool `mapstructure:"left-to-right-embedding"`
   221  	RightToLeftEmbedding     bool `mapstructure:"right-to-left-embedding"`
   222  	PopDirectionalFormatting bool `mapstructure:"pop-directional-formatting"`
   223  	LeftToRightOverride      bool `mapstructure:"left-to-right-override"`
   224  	RightToLeftOverride      bool `mapstructure:"right-to-left-override"`
   225  	LeftToRightIsolate       bool `mapstructure:"left-to-right-isolate"`
   226  	RightToLeftIsolate       bool `mapstructure:"right-to-left-isolate"`
   227  	FirstStrongIsolate       bool `mapstructure:"first-strong-isolate"`
   228  	PopDirectionalIsolate    bool `mapstructure:"pop-directional-isolate"`
   229  }
   230  
   231  type Cyclop struct {
   232  	MaxComplexity  int     `mapstructure:"max-complexity"`
   233  	PackageAverage float64 `mapstructure:"package-average"`
   234  	SkipTests      bool    `mapstructure:"skip-tests"`
   235  }
   236  
   237  type DepGuardSettings struct {
   238  	ListType                 string `mapstructure:"list-type"`
   239  	Packages                 []string
   240  	IncludeGoRoot            bool               `mapstructure:"include-go-root"`
   241  	PackagesWithErrorMessage map[string]string  `mapstructure:"packages-with-error-message"`
   242  	IgnoreFileRules          []string           `mapstructure:"ignore-file-rules"`
   243  	AdditionalGuards         []DepGuardSettings `mapstructure:"additional-guards"`
   244  }
   245  
   246  type DecorderSettings struct {
   247  	DecOrder                  []string `mapstructure:"dec-order"`
   248  	DisableDecNumCheck        bool     `mapstructure:"disable-dec-num-check"`
   249  	DisableDecOrderCheck      bool     `mapstructure:"disable-dec-order-check"`
   250  	DisableInitFuncFirstCheck bool     `mapstructure:"disable-init-func-first-check"`
   251  }
   252  
   253  type DogsledSettings struct {
   254  	MaxBlankIdentifiers int `mapstructure:"max-blank-identifiers"`
   255  }
   256  
   257  type DuplSettings struct {
   258  	Threshold int
   259  }
   260  
   261  type DupWordSettings struct {
   262  	Keywords []string `mapstructure:"keywords"`
   263  }
   264  
   265  type ErrcheckSettings struct {
   266  	DisableDefaultExclusions bool     `mapstructure:"disable-default-exclusions"`
   267  	CheckTypeAssertions      bool     `mapstructure:"check-type-assertions"`
   268  	CheckAssignToBlank       bool     `mapstructure:"check-blank"`
   269  	Ignore                   string   `mapstructure:"ignore"`
   270  	ExcludeFunctions         []string `mapstructure:"exclude-functions"`
   271  
   272  	// Deprecated: use ExcludeFunctions instead
   273  	Exclude string `mapstructure:"exclude"`
   274  }
   275  
   276  type ErrChkJSONSettings struct {
   277  	CheckErrorFreeEncoding bool `mapstructure:"check-error-free-encoding"`
   278  	ReportNoExported       bool `mapstructure:"report-no-exported"`
   279  }
   280  
   281  type ErrorLintSettings struct {
   282  	Errorf     bool `mapstructure:"errorf"`
   283  	Asserts    bool `mapstructure:"asserts"`
   284  	Comparison bool `mapstructure:"comparison"`
   285  }
   286  
   287  type ExhaustiveSettings struct {
   288  	Check                      []string `mapstructure:"check"`
   289  	CheckGenerated             bool     `mapstructure:"check-generated"`
   290  	DefaultSignifiesExhaustive bool     `mapstructure:"default-signifies-exhaustive"`
   291  	IgnoreEnumMembers          string   `mapstructure:"ignore-enum-members"`
   292  	PackageScopeOnly           bool     `mapstructure:"package-scope-only"`
   293  	ExplicitExhaustiveMap      bool     `mapstructure:"explicit-exhaustive-map"`
   294  	ExplicitExhaustiveSwitch   bool     `mapstructure:"explicit-exhaustive-switch"`
   295  }
   296  
   297  type ExhaustiveStructSettings struct {
   298  	StructPatterns []string `mapstructure:"struct-patterns"`
   299  }
   300  
   301  type ExhaustructSettings struct {
   302  	Include []string `mapstructure:"include"`
   303  	Exclude []string `mapstructure:"exclude"`
   304  }
   305  
   306  type ForbidigoSettings struct {
   307  	Forbid               []string `mapstructure:"forbid"`
   308  	ExcludeGodocExamples bool     `mapstructure:"exclude-godoc-examples"`
   309  }
   310  
   311  type FunlenSettings struct {
   312  	Lines      int
   313  	Statements int
   314  }
   315  
   316  type GciSettings struct {
   317  	LocalPrefixes string   `mapstructure:"local-prefixes"` // Deprecated
   318  	Sections      []string `mapstructure:"sections"`
   319  	SkipGenerated bool     `mapstructure:"skip-generated"`
   320  	CustomOrder   bool     `mapstructure:"custom-order"`
   321  }
   322  
   323  type GocognitSettings struct {
   324  	MinComplexity int `mapstructure:"min-complexity"`
   325  }
   326  
   327  type GoConstSettings struct {
   328  	IgnoreTests         bool `mapstructure:"ignore-tests"`
   329  	MatchWithConstants  bool `mapstructure:"match-constant"`
   330  	MinStringLen        int  `mapstructure:"min-len"`
   331  	MinOccurrencesCount int  `mapstructure:"min-occurrences"`
   332  	ParseNumbers        bool `mapstructure:"numbers"`
   333  	NumberMin           int  `mapstructure:"min"`
   334  	NumberMax           int  `mapstructure:"max"`
   335  	IgnoreCalls         bool `mapstructure:"ignore-calls"`
   336  }
   337  
   338  type GoCriticSettings struct {
   339  	EnabledChecks    []string                         `mapstructure:"enabled-checks"`
   340  	DisabledChecks   []string                         `mapstructure:"disabled-checks"`
   341  	EnabledTags      []string                         `mapstructure:"enabled-tags"`
   342  	DisabledTags     []string                         `mapstructure:"disabled-tags"`
   343  	SettingsPerCheck map[string]GoCriticCheckSettings `mapstructure:"settings"`
   344  }
   345  
   346  type GoCriticCheckSettings map[string]interface{}
   347  
   348  type GoCycloSettings struct {
   349  	MinComplexity int `mapstructure:"min-complexity"`
   350  }
   351  
   352  type GodotSettings struct {
   353  	Scope   string   `mapstructure:"scope"`
   354  	Exclude []string `mapstructure:"exclude"`
   355  	Capital bool     `mapstructure:"capital"`
   356  	Period  bool     `mapstructure:"period"`
   357  
   358  	// Deprecated: use `Scope` instead
   359  	CheckAll bool `mapstructure:"check-all"`
   360  }
   361  
   362  type GodoxSettings struct {
   363  	Keywords []string
   364  }
   365  
   366  type GoFmtSettings struct {
   367  	Simplify     bool
   368  	RewriteRules []GoFmtRewriteRule `mapstructure:"rewrite-rules"`
   369  }
   370  
   371  type GoFmtRewriteRule struct {
   372  	Pattern     string
   373  	Replacement string
   374  }
   375  
   376  type GofumptSettings struct {
   377  	ModulePath string `mapstructure:"module-path"`
   378  	ExtraRules bool   `mapstructure:"extra-rules"`
   379  
   380  	// Deprecated: use the global `run.go` instead.
   381  	LangVersion string `mapstructure:"lang-version"`
   382  }
   383  
   384  type GoHeaderSettings struct {
   385  	Values       map[string]map[string]string `mapstructure:"values"`
   386  	Template     string                       `mapstructure:"template"`
   387  	TemplatePath string                       `mapstructure:"template-path"`
   388  }
   389  
   390  type GoImportsSettings struct {
   391  	LocalPrefixes string `mapstructure:"local-prefixes"`
   392  }
   393  
   394  type GoLintSettings struct {
   395  	MinConfidence float64 `mapstructure:"min-confidence"`
   396  }
   397  
   398  type GoMndSettings struct {
   399  	Settings         map[string]map[string]interface{} // Deprecated
   400  	Checks           []string                          `mapstructure:"checks"`
   401  	IgnoredNumbers   []string                          `mapstructure:"ignored-numbers"`
   402  	IgnoredFiles     []string                          `mapstructure:"ignored-files"`
   403  	IgnoredFunctions []string                          `mapstructure:"ignored-functions"`
   404  }
   405  
   406  type GoModDirectivesSettings struct {
   407  	ReplaceAllowList          []string `mapstructure:"replace-allow-list"`
   408  	ReplaceLocal              bool     `mapstructure:"replace-local"`
   409  	ExcludeForbidden          bool     `mapstructure:"exclude-forbidden"`
   410  	RetractAllowNoExplanation bool     `mapstructure:"retract-allow-no-explanation"`
   411  }
   412  
   413  type GoModGuardSettings struct {
   414  	Allowed struct {
   415  		Modules []string `mapstructure:"modules"`
   416  		Domains []string `mapstructure:"domains"`
   417  	} `mapstructure:"allowed"`
   418  	Blocked struct {
   419  		Modules []map[string]struct {
   420  			Recommendations []string `mapstructure:"recommendations"`
   421  			Reason          string   `mapstructure:"reason"`
   422  		} `mapstructure:"modules"`
   423  		Versions []map[string]struct {
   424  			Version string `mapstructure:"version"`
   425  			Reason  string `mapstructure:"reason"`
   426  		} `mapstructure:"versions"`
   427  		LocalReplaceDirectives bool `mapstructure:"local_replace_directives"`
   428  	} `mapstructure:"blocked"`
   429  }
   430  
   431  type GoSecSettings struct {
   432  	Includes         []string               `mapstructure:"includes"`
   433  	Excludes         []string               `mapstructure:"excludes"`
   434  	Severity         string                 `mapstructure:"severity"`
   435  	Confidence       string                 `mapstructure:"confidence"`
   436  	ExcludeGenerated bool                   `mapstructure:"exclude-generated"`
   437  	Config           map[string]interface{} `mapstructure:"config"`
   438  	Concurrency      int                    `mapstructure:"concurrency"`
   439  }
   440  
   441  type GovetSettings struct {
   442  	Go             string `mapstructure:"-"`
   443  	CheckShadowing bool   `mapstructure:"check-shadowing"`
   444  	Settings       map[string]map[string]interface{}
   445  
   446  	Enable     []string
   447  	Disable    []string
   448  	EnableAll  bool `mapstructure:"enable-all"`
   449  	DisableAll bool `mapstructure:"disable-all"`
   450  }
   451  
   452  func (cfg *GovetSettings) Validate() error {
   453  	if cfg.EnableAll && cfg.DisableAll {
   454  		return errors.New("enable-all and disable-all can't be combined")
   455  	}
   456  	if cfg.EnableAll && len(cfg.Enable) != 0 {
   457  		return errors.New("enable-all and enable can't be combined")
   458  	}
   459  	if cfg.DisableAll && len(cfg.Disable) != 0 {
   460  		return errors.New("disable-all and disable can't be combined")
   461  	}
   462  	return nil
   463  }
   464  
   465  type GrouperSettings struct {
   466  	ConstRequireSingleConst   bool `mapstructure:"const-require-single-const"`
   467  	ConstRequireGrouping      bool `mapstructure:"const-require-grouping"`
   468  	ImportRequireSingleImport bool `mapstructure:"import-require-single-import"`
   469  	ImportRequireGrouping     bool `mapstructure:"import-require-grouping"`
   470  	TypeRequireSingleType     bool `mapstructure:"type-require-single-type"`
   471  	TypeRequireGrouping       bool `mapstructure:"type-require-grouping"`
   472  	VarRequireSingleVar       bool `mapstructure:"var-require-single-var"`
   473  	VarRequireGrouping        bool `mapstructure:"var-require-grouping"`
   474  }
   475  
   476  type IfshortSettings struct {
   477  	MaxDeclLines int `mapstructure:"max-decl-lines"`
   478  	MaxDeclChars int `mapstructure:"max-decl-chars"`
   479  }
   480  
   481  type ImportAsSettings struct {
   482  	Alias          []ImportAsAlias
   483  	NoUnaliased    bool `mapstructure:"no-unaliased"`
   484  	NoExtraAliases bool `mapstructure:"no-extra-aliases"`
   485  }
   486  
   487  type ImportAsAlias struct {
   488  	Pkg   string
   489  	Alias string
   490  }
   491  
   492  type InterfaceBloatSettings struct {
   493  	Max int `mapstructure:"max"`
   494  }
   495  
   496  type IreturnSettings struct {
   497  	Allow  []string `mapstructure:"allow"`
   498  	Reject []string `mapstructure:"reject"`
   499  }
   500  
   501  type LllSettings struct {
   502  	LineLength int `mapstructure:"line-length"`
   503  	TabWidth   int `mapstructure:"tab-width"`
   504  }
   505  
   506  type LoggerCheckSettings struct {
   507  	Kitlog           bool     `mapstructure:"kitlog"`
   508  	Klog             bool     `mapstructure:"klog"`
   509  	Logr             bool     `mapstructure:"logr"`
   510  	Zap              bool     `mapstructure:"zap"`
   511  	RequireStringKey bool     `mapstructure:"require-string-key"`
   512  	NoPrintfLike     bool     `mapstructure:"no-printf-like"`
   513  	Rules            []string `mapstructure:"rules"`
   514  }
   515  
   516  type MaintIdxSettings struct {
   517  	Under int `mapstructure:"under"`
   518  }
   519  
   520  type MakezeroSettings struct {
   521  	Always bool
   522  }
   523  
   524  type MalignedSettings struct {
   525  	SuggestNewOrder bool `mapstructure:"suggest-new"`
   526  }
   527  
   528  type MisspellSettings struct {
   529  	Locale      string
   530  	IgnoreWords []string `mapstructure:"ignore-words"`
   531  }
   532  
   533  type NakedretSettings struct {
   534  	MaxFuncLines int `mapstructure:"max-func-lines"`
   535  }
   536  
   537  type NestifSettings struct {
   538  	MinComplexity int `mapstructure:"min-complexity"`
   539  }
   540  
   541  type NilNilSettings struct {
   542  	CheckedTypes []string `mapstructure:"checked-types"`
   543  }
   544  
   545  type NlreturnSettings struct {
   546  	BlockSize int `mapstructure:"block-size"`
   547  }
   548  
   549  type NoLintLintSettings struct {
   550  	RequireExplanation bool     `mapstructure:"require-explanation"`
   551  	RequireSpecific    bool     `mapstructure:"require-specific"`
   552  	AllowNoExplanation []string `mapstructure:"allow-no-explanation"`
   553  	AllowUnused        bool     `mapstructure:"allow-unused"`
   554  }
   555  
   556  type NoNamedReturnsSettings struct {
   557  	ReportErrorInDefer bool `mapstructure:"report-error-in-defer"`
   558  }
   559  type ParallelTestSettings struct {
   560  	IgnoreMissing bool `mapstructure:"ignore-missing"`
   561  }
   562  
   563  type PreallocSettings struct {
   564  	Simple     bool
   565  	RangeLoops bool `mapstructure:"range-loops"`
   566  	ForLoops   bool `mapstructure:"for-loops"`
   567  }
   568  
   569  type PredeclaredSettings struct {
   570  	Ignore    string `mapstructure:"ignore"`
   571  	Qualified bool   `mapstructure:"q"`
   572  }
   573  
   574  type PromlinterSettings struct {
   575  	Strict          bool     `mapstructure:"strict"`
   576  	DisabledLinters []string `mapstructure:"disabled-linters"`
   577  }
   578  
   579  type ReassignSettings struct {
   580  	Patterns []string `mapstructure:"patterns"`
   581  }
   582  
   583  type ReviveSettings struct {
   584  	MaxOpenFiles          int  `mapstructure:"max-open-files"`
   585  	IgnoreGeneratedHeader bool `mapstructure:"ignore-generated-header"`
   586  	Confidence            float64
   587  	Severity              string
   588  	EnableAllRules        bool `mapstructure:"enable-all-rules"`
   589  	Rules                 []struct {
   590  		Name      string
   591  		Arguments []interface{}
   592  		Severity  string
   593  		Disabled  bool
   594  	}
   595  	ErrorCode   int `mapstructure:"error-code"`
   596  	WarningCode int `mapstructure:"warning-code"`
   597  	Directives  []struct {
   598  		Name     string
   599  		Severity string
   600  	}
   601  }
   602  
   603  type RowsErrCheckSettings struct {
   604  	Packages []string
   605  }
   606  
   607  type StaticCheckSettings struct {
   608  	// Deprecated: use the global `run.go` instead.
   609  	GoVersion string `mapstructure:"go"`
   610  
   611  	Checks                  []string `mapstructure:"checks"`
   612  	Initialisms             []string `mapstructure:"initialisms"`                // only for stylecheck
   613  	DotImportWhitelist      []string `mapstructure:"dot-import-whitelist"`       // only for stylecheck
   614  	HTTPStatusCodeWhitelist []string `mapstructure:"http-status-code-whitelist"` // only for stylecheck
   615  }
   616  
   617  func (s *StaticCheckSettings) HasConfiguration() bool {
   618  	return len(s.Initialisms) > 0 || len(s.HTTPStatusCodeWhitelist) > 0 || len(s.DotImportWhitelist) > 0 || len(s.Checks) > 0
   619  }
   620  
   621  type StructCheckSettings struct {
   622  	CheckExportedFields bool `mapstructure:"exported-fields"`
   623  }
   624  
   625  type TagliatelleSettings struct {
   626  	Case struct {
   627  		Rules        map[string]string
   628  		UseFieldName bool `mapstructure:"use-field-name"`
   629  	}
   630  }
   631  
   632  type TestpackageSettings struct {
   633  	SkipRegexp    string   `mapstructure:"skip-regexp"`
   634  	AllowPackages []string `mapstructure:"allow-packages"`
   635  }
   636  
   637  type ThelperSettings struct {
   638  	Test      ThelperOptions `mapstructure:"test"`
   639  	Fuzz      ThelperOptions `mapstructure:"fuzz"`
   640  	Benchmark ThelperOptions `mapstructure:"benchmark"`
   641  	TB        ThelperOptions `mapstructure:"tb"`
   642  }
   643  
   644  type ThelperOptions struct {
   645  	First *bool `mapstructure:"first"`
   646  	Name  *bool `mapstructure:"name"`
   647  	Begin *bool `mapstructure:"begin"`
   648  }
   649  
   650  type TenvSettings struct {
   651  	All bool `mapstructure:"all"`
   652  }
   653  
   654  type UseStdlibVarsSettings struct {
   655  	HTTPMethod             bool `mapstructure:"http-method"`
   656  	HTTPStatusCode         bool `mapstructure:"http-status-code"`
   657  	TimeWeekday            bool `mapstructure:"time-weekday"`
   658  	TimeMonth              bool `mapstructure:"time-month"`
   659  	TimeLayout             bool `mapstructure:"time-layout"`
   660  	CryptoHash             bool `mapstructure:"crypto-hash"`
   661  	DefaultRPCPathFlag     bool `mapstructure:"default-rpc-path"`
   662  	OSDevNullFlag          bool `mapstructure:"os-dev-null-flag"`
   663  	SQLIsolationLevelFlag  bool `mapstructure:"sql-isolation-level-flag"`
   664  	TLSSignatureSchemeFlag bool `mapstructure:"tls-signature-scheme-flag"`
   665  	ConstantKind           bool `mapstructure:"constant-kind"`
   666  }
   667  
   668  type UnparamSettings struct {
   669  	CheckExported bool `mapstructure:"check-exported"`
   670  	Algo          string
   671  }
   672  
   673  type VarCheckSettings struct {
   674  	CheckExportedFields bool `mapstructure:"exported-fields"`
   675  }
   676  
   677  type VarnamelenSettings struct {
   678  	MaxDistance        int      `mapstructure:"max-distance"`
   679  	MinNameLength      int      `mapstructure:"min-name-length"`
   680  	CheckReceiver      bool     `mapstructure:"check-receiver"`
   681  	CheckReturn        bool     `mapstructure:"check-return"`
   682  	CheckTypeParam     bool     `mapstructure:"check-type-param"`
   683  	IgnoreNames        []string `mapstructure:"ignore-names"`
   684  	IgnoreTypeAssertOk bool     `mapstructure:"ignore-type-assert-ok"`
   685  	IgnoreMapIndexOk   bool     `mapstructure:"ignore-map-index-ok"`
   686  	IgnoreChanRecvOk   bool     `mapstructure:"ignore-chan-recv-ok"`
   687  	IgnoreDecls        []string `mapstructure:"ignore-decls"`
   688  }
   689  
   690  type WhitespaceSettings struct {
   691  	MultiIf   bool `mapstructure:"multi-if"`
   692  	MultiFunc bool `mapstructure:"multi-func"`
   693  }
   694  
   695  type WrapcheckSettings struct {
   696  	// TODO(ldez): v2 the options must be renamed to use hyphen.
   697  	IgnoreSigs             []string `mapstructure:"ignoreSigs"`
   698  	IgnoreSigRegexps       []string `mapstructure:"ignoreSigRegexps"`
   699  	IgnorePackageGlobs     []string `mapstructure:"ignorePackageGlobs"`
   700  	IgnoreInterfaceRegexps []string `mapstructure:"ignoreInterfaceRegexps"`
   701  }
   702  
   703  type WSLSettings struct {
   704  	StrictAppend                     bool     `mapstructure:"strict-append"`
   705  	AllowAssignAndCallCuddle         bool     `mapstructure:"allow-assign-and-call"`
   706  	AllowAssignAndAnythingCuddle     bool     `mapstructure:"allow-assign-and-anything"`
   707  	AllowMultiLineAssignCuddle       bool     `mapstructure:"allow-multiline-assign"`
   708  	ForceCaseTrailingWhitespaceLimit int      `mapstructure:"force-case-trailing-whitespace"`
   709  	AllowTrailingComment             bool     `mapstructure:"allow-trailing-comment"`
   710  	AllowSeparatedLeadingComment     bool     `mapstructure:"allow-separated-leading-comment"`
   711  	AllowCuddleDeclaration           bool     `mapstructure:"allow-cuddle-declarations"`
   712  	AllowCuddleWithCalls             []string `mapstructure:"allow-cuddle-with-calls"`
   713  	AllowCuddleWithRHS               []string `mapstructure:"allow-cuddle-with-rhs"`
   714  	ForceCuddleErrCheckAndAssign     bool     `mapstructure:"enforce-err-cuddling"`
   715  	ErrorVariableNames               []string `mapstructure:"error-variable-names"`
   716  	ForceExclusiveShortDeclarations  bool     `mapstructure:"force-short-decl-cuddling"`
   717  }
   718  
   719  // CustomLinterSettings encapsulates the meta-data of a private linter.
   720  // For example, a private linter may be added to the golangci config file as shown below.
   721  //
   722  //	linters-settings:
   723  //	 custom:
   724  //	   example:
   725  //	     path: /example.so
   726  //	     description: The description of the linter
   727  //	     original-url: github.com/golangci/example-linter
   728  type CustomLinterSettings struct {
   729  	// Path to a plugin *.so file that implements the private linter.
   730  	Path string
   731  	// Description describes the purpose of the private linter.
   732  	Description string
   733  	// The URL containing the source code for the private linter.
   734  	OriginalURL string `mapstructure:"original-url"`
   735  }