diff --git a/analyzer.go b/analyzer.go index 04c079b..edff57a 100644 --- a/analyzer.go +++ b/analyzer.go @@ -6,11 +6,22 @@ import ( "golang.org/x/tools/go/analysis" - "github.com/nunnatsa/ginkgolinter/internal/types" "github.com/nunnatsa/ginkgolinter/linter" + "github.com/nunnatsa/ginkgolinter/types" "github.com/nunnatsa/ginkgolinter/version" ) +// NewAnalyzerWithConfig returns an Analyzer. +func NewAnalyzerWithConfig(config *types.Config) *analysis.Analyzer { + theLinter := linter.NewGinkgoLinter(config) + + return &analysis.Analyzer{ + Name: "ginkgolinter", + Doc: fmt.Sprintf(doc, version.Version()), + Run: theLinter.Run, + } +} + // NewAnalyzer returns an Analyzer - the package interface with nogo func NewAnalyzer() *analysis.Analyzer { config := &types.Config{ @@ -23,12 +34,7 @@ func NewAnalyzer() *analysis.Analyzer { ForceExpectTo: false, } - theLinter := linter.NewGinkgoLinter(config) - a := &analysis.Analyzer{ - Name: "ginkgolinter", - Doc: fmt.Sprintf(doc, version.Version()), - Run: theLinter.Run, - } + a := NewAnalyzerWithConfig(config) var ignored bool a.Flags.Init("ginkgolinter", flag.ExitOnError) diff --git a/linter/ginkgo_linter.go b/linter/ginkgo_linter.go index c49cc41..b158c3a 100644 --- a/linter/ginkgo_linter.go +++ b/linter/ginkgo_linter.go @@ -19,7 +19,7 @@ import ( "github.com/nunnatsa/ginkgolinter/internal/intervals" "github.com/nunnatsa/ginkgolinter/internal/reports" "github.com/nunnatsa/ginkgolinter/internal/reverseassertion" - "github.com/nunnatsa/ginkgolinter/internal/types" + "github.com/nunnatsa/ginkgolinter/types" ) // The ginkgolinter enforces standards of using ginkgo and gomega. diff --git a/internal/types/boolean.go b/types/boolean.go similarity index 100% rename from internal/types/boolean.go rename to types/boolean.go diff --git a/internal/types/boolean_test.go b/types/boolean_test.go similarity index 100% rename from internal/types/boolean_test.go rename to types/boolean_test.go diff --git a/internal/types/config.go b/types/config.go similarity index 100% rename from internal/types/config.go rename to types/config.go diff --git a/internal/types/config_test.go b/types/config_test.go similarity index 100% rename from internal/types/config_test.go rename to types/config_test.go