-
Notifications
You must be signed in to change notification settings - Fork 67
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
chore(server): refactoring analyzer files to comply with resources standard #2810
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import ( | |
|
||
"github.com/kubeshop/tracetest/server/analytics" | ||
"github.com/kubeshop/tracetest/server/linter" | ||
linterResource "github.com/kubeshop/tracetest/server/linter/resource" | ||
analyzerResource "github.com/kubeshop/tracetest/server/linter/analyzer" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! I'll update it. |
||
"github.com/kubeshop/tracetest/server/model" | ||
"github.com/kubeshop/tracetest/server/model/events" | ||
"github.com/kubeshop/tracetest/server/subscription" | ||
|
@@ -32,18 +32,18 @@ type LinterRunner interface { | |
WorkerPool | ||
} | ||
|
||
type LinterResourceGetter interface { | ||
GetDefault(ctx context.Context) linterResource.Linter | ||
type AnalyzerGetter interface { | ||
GetDefault(ctx context.Context) analyzerResource.Linter | ||
} | ||
|
||
type defaultlinterRunner struct { | ||
updater RunUpdater | ||
inputChannel chan LinterRequest | ||
exitChannel chan bool | ||
subscriptionManager *subscription.Manager | ||
eventEmitter EventEmitter | ||
linterResourceGetter LinterResourceGetter | ||
assertionRunner AssertionRunner | ||
updater RunUpdater | ||
inputChannel chan LinterRequest | ||
exitChannel chan bool | ||
subscriptionManager *subscription.Manager | ||
eventEmitter EventEmitter | ||
analyzerGetter AnalyzerGetter | ||
assertionRunner AssertionRunner | ||
} | ||
|
||
var _ WorkerPool = &defaultlinterRunner{} | ||
|
@@ -54,15 +54,15 @@ func NewlinterRunner( | |
subscriptionManager *subscription.Manager, | ||
eventEmitter EventEmitter, | ||
assertionRunner AssertionRunner, | ||
linterResourceGetter LinterResourceGetter, | ||
analyzerGetter AnalyzerGetter, | ||
) LinterRunner { | ||
return &defaultlinterRunner{ | ||
updater: updater, | ||
inputChannel: make(chan LinterRequest, 1), | ||
subscriptionManager: subscriptionManager, | ||
eventEmitter: eventEmitter, | ||
assertionRunner: assertionRunner, | ||
linterResourceGetter: linterResourceGetter, | ||
updater: updater, | ||
inputChannel: make(chan LinterRequest, 1), | ||
subscriptionManager: subscriptionManager, | ||
eventEmitter: eventEmitter, | ||
assertionRunner: assertionRunner, | ||
analyzerGetter: analyzerGetter, | ||
} | ||
} | ||
|
||
|
@@ -99,8 +99,8 @@ func (e *defaultlinterRunner) startWorker() { | |
|
||
func (e *defaultlinterRunner) onRequest(request LinterRequest) { | ||
ctx := request.Context() | ||
lintResource := e.linterResourceGetter.GetDefault(ctx) | ||
linter := linter.Newlinter(lintResource, linter.AvailablePlugins...) | ||
lintResource := e.analyzerGetter.GetDefault(ctx) | ||
linter := linter.NewLinter(lintResource, linter.AvailablePlugins...) | ||
|
||
shouldSkip, reason := linter.ShouldSkip() | ||
if shouldSkip { | ||
|
@@ -153,7 +153,7 @@ func (e *defaultlinterRunner) onFinish(ctx context.Context, request LinterReques | |
e.assertionRunner.RunAssertions(ctx, assertionRequest) | ||
} | ||
|
||
func (e *defaultlinterRunner) onRun(ctx context.Context, request LinterRequest, linter linter.Linter, linterResource linterResource.Linter) (model.Run, error) { | ||
func (e *defaultlinterRunner) onRun(ctx context.Context, request LinterRequest, linter linter.Linter, analyzerResource analyzerResource.Linter) (model.Run, error) { | ||
run := request.Run | ||
log.Printf("[linterRunner] Test %s Run %d: Starting\n", request.Test.ID, request.Run.ID) | ||
|
||
|
@@ -167,7 +167,7 @@ func (e *defaultlinterRunner) onRun(ctx context.Context, request LinterRequest, | |
return e.onError(ctx, request, run, err) | ||
} | ||
|
||
result.MinimumScore = linterResource.MinimumScore | ||
result.MinimumScore = analyzerResource.MinimumScore | ||
run = run.SuccessfulLinterExecution(result) | ||
err = e.updater.Update(ctx, run) | ||
if err != nil { | ||
|
14 changes: 13 additions & 1 deletion
14
server/linter/resource/model.go → server/linter/analyzer/analyzer_entities.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
server/linter/resource/manager.go → ...er/linter/analyzer/analyzer_repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package linter_resource | ||
package analyzer | ||
|
||
import ( | ||
"context" | ||
|
18 changes: 9 additions & 9 deletions
18
server/linter/resource/manager_test.go → ...nter/analyzer/analyzer_repository_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
server/linter/resource/main_test.go → server/linter/analyzer/main_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package linter_resource_test | ||
package analyzer_test | ||
|
||
import ( | ||
"os" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to use the alias if the alias has the same name as the package. You can remove them all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Also updating it.