Skip to content

Commit

Permalink
contextcheck: remove disable-fact config
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvia7788 authored and ldez committed Aug 23, 2022
1 parent b6b99b5 commit 94a9c43
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 20 deletions.
7 changes: 0 additions & 7 deletions .golangci.reference.yml
Expand Up @@ -1854,11 +1854,6 @@ linters-settings:
# Default: true
strict-append: true

contextcheck:
# If you use contextcheck in docker ci, and feel a little bit slow, you can turn on this option.
# Default: false
disable-fact: true

# The custom section can be used to define linter plugins to be loaded at runtime.
# See README documentation for more info.
custom:
Expand Down Expand Up @@ -1979,7 +1974,6 @@ linters:
- whitespace
- wrapcheck
- wsl
- contextcheck

# Enable all available linters.
# Default: false
Expand Down Expand Up @@ -2084,7 +2078,6 @@ linters:
- whitespace
- wrapcheck
- wsl
- contextcheck

# Enable presets.
# https://golangci-lint.run/usage/linters
Expand Down
5 changes: 0 additions & 5 deletions pkg/config/linters_settings.go
Expand Up @@ -185,7 +185,6 @@ type LintersSettings struct {
Whitespace WhitespaceSettings
Wrapcheck WrapcheckSettings
WSL WSLSettings
ContextCheck ContextCheckSettings

Custom map[string]CustomLinterSettings
}
Expand Down Expand Up @@ -662,10 +661,6 @@ type WSLSettings struct {
ForceCaseTrailingWhitespaceLimit int `mapstructure:"force-case-trailing-whitespace"`
}

type ContextCheckSettings struct {
DisableFact bool `mapstructure:"disable-fact"`
}

// CustomLinterSettings encapsulates the meta-data of a private linter.
// For example, a private linter may be added to the golangci config file as shown below.
//
Expand Down
6 changes: 1 addition & 5 deletions pkg/golinters/contextcheck.go
Expand Up @@ -4,16 +4,12 @@ import (
"github.com/sylvia7788/contextcheck"
"golang.org/x/tools/go/analysis"

"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
"github.com/golangci/golangci-lint/pkg/lint/linter"
)

func NewContextCheck(settings *config.ContextCheckSettings) *goanalysis.Linter {
func NewContextCheck() *goanalysis.Linter {
conf := contextcheck.Configuration{}
if settings != nil {
conf.DisableFact = settings.DisableFact
}
analyzer := contextcheck.NewAnalyzer(conf)
return goanalysis.NewLinter(
"contextcheck",
Expand Down
4 changes: 1 addition & 3 deletions pkg/lint/lintersdb/manager.go
Expand Up @@ -171,7 +171,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
whitespaceCfg *config.WhitespaceSettings
wrapcheckCfg *config.WrapcheckSettings
wslCfg *config.WSLSettings
contextcheckCfg *config.ContextCheckSettings
)

if m.cfg != nil {
Expand Down Expand Up @@ -244,7 +243,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
whitespaceCfg = &m.cfg.LintersSettings.Whitespace
wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck
wslCfg = &m.cfg.LintersSettings.WSL
contextcheckCfg = &m.cfg.LintersSettings.ContextCheck

if govetCfg != nil {
govetCfg.Go = m.cfg.Run.Go
Expand Down Expand Up @@ -300,7 +298,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithPresets(linter.PresetStyle).
WithURL("https://github.com/sivchari/containedctx"),

linter.NewConfig(golinters.NewContextCheck(contextcheckCfg)).
linter.NewConfig(golinters.NewContextCheck()).
WithSince("v1.43.0").
WithPresets(linter.PresetBugs).
WithLoadForGoAnalysis().
Expand Down

0 comments on commit 94a9c43

Please sign in to comment.