golangci-lint/pkg/golinters/tagliatelle.go
dependabot[bot] f29069723b
build(deps): bump github.com/ldez/tagliatelle from 0.3.1 to 0.4.0 (#3483)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2023-01-15 12:35:04 +00:00

36 lines
714 B
Go

package golinters
import (
"github.com/ldez/tagliatelle"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewTagliatelle(settings *config.TagliatelleSettings) *goanalysis.Linter {
cfg := tagliatelle.Config{
Rules: map[string]string{
"json": "camel",
"yaml": "camel",
"header": "header",
},
}
if settings != nil {
for k, v := range settings.Case.Rules {
cfg.Rules[k] = v
}
cfg.UseFieldName = settings.Case.UseFieldName
}
a := tagliatelle.New(cfg)
return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeSyntax)
}