Skip to content

Commit

Permalink
Add all configs, structs and entries that the linter needs
Browse files Browse the repository at this point in the history
  • Loading branch information
javorszky committed Feb 18, 2023
1 parent 0cc445b commit 56919e3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .golangci.reference.yml
Expand Up @@ -2072,6 +2072,7 @@ linters:
- predeclared
- promlinter
- reassign
- responsewriterlint
- revive
- rowserrcheck
- scopelint
Expand Down
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -48,6 +48,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.6.0
github.com/hexops/gotextdiff v1.0.3
github.com/javorszky/go-responsewriter-lint v0.1.2
github.com/jgautheron/goconst v1.5.1
github.com/jingyugao/rowserrcheck v1.1.1
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions pkg/golinters/responsewriterlint.go
@@ -0,0 +1,19 @@
package golinters

import (
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
"github.com/javorszky/go-responsewriter-lint/pkg/analyzer"
"golang.org/x/tools/go/analysis"
)

func NewResponseWriterLint(_ *config.ReassignSettings) *goanalysis.Linter {
a := analyzer.New()

return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
6 changes: 6 additions & 0 deletions pkg/lint/lintersdb/manager.go
Expand Up @@ -722,6 +722,12 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithLoadForGoAnalysis().
WithURL("https://github.com/curioswitch/go-reassign"),

linter.NewConfig(golinters.NewResponseWriterLint(nil)).
WithSince("1.52.0").
WithPresets(linter.PresetBugs).
ConsiderSlow().
WithURL("https://github.com/javorszky/go-responsewriter-lint"),

linter.NewConfig(golinters.NewRevive(reviveCfg)).
WithSince("v1.37.0").
WithPresets(linter.PresetStyle, linter.PresetMetaLinter).
Expand Down

0 comments on commit 56919e3

Please sign in to comment.