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

[Thog-371] Utilize config struct for engine scans #700

Merged
merged 14 commits into from
Aug 10, 2022

Conversation

ahrav
Copy link
Collaborator

@ahrav ahrav commented Aug 9, 2022

  • Define a config struct within sources that encompasses all the configurations used for all the engine scanning integrations.
  • Construct each config within main for each source using functional args.
  • Pass the config as the second argument to each of the engine scan methods.
  • Update all the tests.

@ahrav ahrav requested review from a team as code owners August 9, 2022 20:10
pkg/sources/sources.go Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@ahrav ahrav requested review from a team August 10, 2022 00:10
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
if err != nil {
return errors.WrapPrefix(err, "unable to resolve head ref", 0)
} else {
headRef = head.String()
headCommit, _ = repo.CommitObject(plumbing.NewHash(baseRef))
c.HeadRef = head.String()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: Since c is a pointer, this line will actually change the value for the caller, which may be unexpected or not desired. Not a huge concern because I don't think we use the config again after running the scan, but I thought I'd at least mention it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea i did realize that, but figured that it was okay since as you mentioned we only use the cfg in the switch.

pkg/engine/git.go Show resolved Hide resolved
pkg/sources/sources.go Show resolved Hide resolved
@ahrav ahrav merged commit dcc102a into main Aug 10, 2022
@ahrav ahrav deleted the THOG-371-engine-scan-config-struct branch August 10, 2022 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants