github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/pkg/golinters/ifshort.go (about)

     1  package golinters
     2  
     3  import (
     4  	"github.com/esimonov/ifshort/pkg/analyzer"
     5  	"golang.org/x/tools/go/analysis"
     6  
     7  	"github.com/vanstinator/golangci-lint/pkg/config"
     8  	"github.com/vanstinator/golangci-lint/pkg/golinters/goanalysis"
     9  )
    10  
    11  func NewIfshort(settings *config.IfshortSettings) *goanalysis.Linter {
    12  	var cfg map[string]map[string]any
    13  	if settings != nil {
    14  		cfg = map[string]map[string]any{
    15  			analyzer.Analyzer.Name: {
    16  				"max-decl-lines": settings.MaxDeclLines,
    17  				"max-decl-chars": settings.MaxDeclChars,
    18  			},
    19  		}
    20  	}
    21  
    22  	a := analyzer.Analyzer
    23  
    24  	return goanalysis.NewLinter(
    25  		a.Name,
    26  		a.Doc,
    27  		[]*analysis.Analyzer{a},
    28  		cfg,
    29  	).WithLoadMode(goanalysis.LoadModeSyntax)
    30  }