Skip to content

Commit

Permalink
1. Update version after type fixes
Browse files Browse the repository at this point in the history
2. Added tests in subdir
  • Loading branch information
maranqz committed Nov 15, 2023
1 parent 70cd3e5 commit bf7fb06
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/golinters/gofactorylint.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import (
)

func NewGoFactoryLint(settings *config.GoFactoryLintSettings) *goanalysis.Linter {
a := factory.NewAnalyzer()
analyzer := factory.NewAnalyzer()

cfg := make(map[string]map[string]any)
if settings != nil {
cfg[a.Name] = map[string]any{}
cfg[analyzer.Name] = map[string]any{}

if len(settings.BlockedPkgs) > 0 {
cfg[a.Name]["blockedPkgs"] = settings.BlockedPkgs
cfg[a.Name]["onlyBlockedPkgs"] = settings.OnlyBlockedPkgs
cfg[analyzer.Name]["blockedPkgs"] = settings.BlockedPkgs
cfg[analyzer.Name]["onlyBlockedPkgs"] = settings.OnlyBlockedPkgs
}
}

return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
analyzer.Name,
analyzer.Doc,
[]*analysis.Analyzer{analyzer},
cfg,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
1 change: 1 addition & 0 deletions pkg/lint/lintersdb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
linter.NewConfig(golinters.NewGoFactoryLint(goFactoryCfg)).
WithSince("next_version").
WithPresets(linter.PresetStyle).
WithLoadForGoAnalysis().
WithURL("https://github.com/maranqz/go-factory-lint"),

linter.NewConfig(golinters.NewGofmt(gofmtCfg)).
Expand Down
1 change: 1 addition & 0 deletions test/linters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestSourcesFromTestdataSubDir(t *testing.T) {
"ginkgolinter",
"zerologlint",
"protogetter",
"gofactory",
}

for _, dir := range subDirs {
Expand Down
2 changes: 2 additions & 0 deletions test/testdata/gofactory/app.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//golangcitest:args -Egofactory

package gofactory

import "github.com/golangci/golangci-lint/test/testdata/gofactory/nested"
Expand Down

0 comments on commit bf7fb06

Please sign in to comment.