MCPcopy Index your code
hub / github.com/google/go-github / New

Function New

tools/structfield/structfield.go:47–79  ·  view source on GitHub ↗

New returns an analysis.Analyzer to use with golangci-lint.

(cfg any)

Source from the content-addressed store, hash-verified

45
46// New returns an analysis.Analyzer to use with golangci-lint.
47func New(cfg any) (register.LinterPlugin, error) {
48 allowedTagNames := map[string]bool{}
49 allowedTagTypes := map[string]bool{}
50
51 if cfg != nil {
52 if settingsMap, ok := cfg.(map[string]any); ok {
53 if exceptionsRaw, ok := settingsMap["allowed-tag-names"]; ok {
54 if exceptionsList, ok := exceptionsRaw.([]any); ok {
55 for _, item := range exceptionsList {
56 if exception, ok := item.(string); ok {
57 allowedTagNames[exception] = true
58 }
59 }
60 }
61 }
62
63 if exceptionsRaw, ok := settingsMap["allowed-tag-types"]; ok {
64 if exceptionsList, ok := exceptionsRaw.([]any); ok {
65 for _, item := range exceptionsList {
66 if exception, ok := item.(string); ok {
67 allowedTagTypes[exception] = true
68 }
69 }
70 }
71 }
72 }
73 }
74
75 return &StructFieldPlugin{
76 allowedTagNames: allowedTagNames,
77 allowedTagTypes: allowedTagTypes,
78 }, nil
79}
80
81// BuildAnalyzers builds the analyzers for the StructFieldPlugin.
82func (f *StructFieldPlugin) BuildAnalyzers() ([]*analysis.Analyzer, error) {

Callers 2

analyzeRepoFunction · 0.92
TestRunFunction · 0.70

Calls

no outgoing calls

Tested by 1

TestRunFunction · 0.56