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

Refactor Git source to use SourceUnits #2058

Closed
wants to merge 2 commits into from
Closed

Refactor Git source to use SourceUnits #2058

wants to merge 2 commits into from

Conversation

mcastorina
Copy link
Collaborator

Description:

This led to a lot of changes to replace code that expects a channel with
a ChunkReporter. Luckily, a reporter can have the same functionality as
a channel, so this commit also adds a ChanReporter to maintain
functionality for the other codepaths.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

This led to a lot of changes to replace code that expects a channel with
a ChunkReporter. Luckily, a reporter can have the same functionality as
a channel, so this commit also adds a ChanReporter to maintain
functionality for the other codepaths.
@mcastorina mcastorina requested review from a team as code owners October 30, 2023 17:07
Copy link
Collaborator

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

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

ok i'm seeing three parts of this pr, tell me if i've got this right:

  • reorganizing the git source
  • modifying every source except the git source to use a new channel-wrapping reporter
  • modifying the git source to use the new units system

if i do have that right, can i talk you into breaking this into two or even three prs?

  1. reorganize the git source
  2. create and use ChanReporter everywhere
  3. modify the git source to use units

or

  1. create and use ChanReporter everywhere
  2. reorganize the git source and modify it to use units

@@ -37,7 +37,7 @@ type Handler interface {
// packages them in the provided chunk skeleton, and sends them to chunksChan.
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment needs an update

}
if err := s.scanRepo(ctx, repoURI, reporter); err != nil {
ctx.Logger().Info("error scanning repository", "repo", repoURI, "error", err)
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this necessary or is it just here for symmetry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not necessary - it's similar to the return I did at the end of a function. No functional difference, but marginally better if we add code after it.

@mcastorina
Copy link
Collaborator Author

ok i'm seeing three parts of this pr, tell me if i've got this right:

  • reorganizing the git source
  • modifying every source except the git source to use a new channel-wrapping reporter
  • modifying the git source to use the new units system

For the most part, yes, but the git source is also using the channel wrapping reporter in the Chunks method.

if i do have that right, can i talk you into breaking this into two or even three prs?

  1. reorganize the git source
  2. create and use ChanReporter everywhere
  3. modify the git source to use units

or

  1. create and use ChanReporter everywhere
  2. reorganize the git source and modify it to use units

Yeah, good idea. The latter two PR approach makes more sense to me, so I'll go with that.

@mcastorina
Copy link
Collaborator Author

The changes in this PR have been split up into #2082 and #2083

@mcastorina mcastorina closed this Nov 1, 2023
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