Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a constructor with configuration structure #143

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion linter/ginkgo_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.