|
| 1 | +package godoclint |
| 2 | + |
| 3 | +import ( |
| 4 | + glcompose "github.com/godoc-lint/godoc-lint/pkg/compose" |
| 5 | + glconfig "github.com/godoc-lint/godoc-lint/pkg/config" |
| 6 | + |
| 7 | + "github.com/golangci/golangci-lint/v2/pkg/config" |
| 8 | + "github.com/golangci/golangci-lint/v2/pkg/goanalysis" |
| 9 | +) |
| 10 | + |
| 11 | +func New(settings *config.GodoclintSettings) *goanalysis.Linter { |
| 12 | + pcfg := glconfig.PlainConfig{ |
| 13 | + Include: settings.Include, |
| 14 | + Exclude: settings.Exclude, |
| 15 | + Enable: settings.Enable, |
| 16 | + Disable: settings.Disable, |
| 17 | + Options: &glconfig.PlainRuleOptions{ |
| 18 | + MaxLenLength: settings.Options.MaxLen.Length, |
| 19 | + MaxLenIncludeTests: settings.Options.MaxLen.IncludeTests, |
| 20 | + PkgDocStartWith: settings.Options.PkgDoc.StartWith, |
| 21 | + PkgDocIncludeTests: settings.Options.PkgDoc.IncludeTests, |
| 22 | + SinglePkgDocIncludeTests: settings.Options.SinglePkgDoc.IncludeTests, |
| 23 | + RequirePkgDocIncludeTests: settings.Options.RequirePkgDoc.IncludeTests, |
| 24 | + RequireDocIncludeTests: settings.Options.RequireDoc.IncludeTests, |
| 25 | + RequireDocIgnoreExported: settings.Options.RequireDoc.IgnoreExported, |
| 26 | + RequireDocIgnoreUnexported: settings.Options.RequireDoc.IgnoreUnexported, |
| 27 | + StartWithNamePattern: settings.Options.StartWithName.Pattern, |
| 28 | + StartWithNameIncludeTests: settings.Options.StartWithName.IncludeTests, |
| 29 | + StartWithNameIncludeUnexported: settings.Options.StartWithName.IncludeUnexported, |
| 30 | + NoUnusedLinkIncludeTests: settings.Options.NoUnusedLink.IncludeTests, |
| 31 | + }, |
| 32 | + } |
| 33 | + |
| 34 | + composition := glcompose.Compose(glcompose.CompositionConfig{ |
| 35 | + BaseDirPlainConfig: &pcfg, |
| 36 | + }) |
| 37 | + |
| 38 | + return goanalysis. |
| 39 | + NewLinterFromAnalyzer(composition.Analyzer.GetAnalyzer()). |
| 40 | + WithLoadMode(goanalysis.LoadModeTypesInfo) |
| 41 | +} |
0 commit comments