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

RepositoryIterator and ReferenceIterator implementations #20

Merged
merged 1 commit into from
Sep 6, 2017

Conversation

ajnavarro
Copy link
Contributor

@ajnavarro ajnavarro commented Sep 4, 2017

Using a base abstract class RootedRepoIterator, we add two implementations, one of them to iterate repository metadata (repository id, urls, is fork) and references metadata (repository_id, name, hash).

With this RootedRepoIterator we should be able to implement CommitIterator and BlobIterator too.

Filter logic must be implemented before start with BlobIterator.

  • Split test logic into Traits to be able to use them in all the Specs.
  • Added a BaseRootedRepoIterator trait with a helper to test iterators more easly.

@ajnavarro
Copy link
Contributor Author

Merge #19 first.

@codecov
Copy link

codecov bot commented Sep 4, 2017

Codecov Report

Merging #20 into master will decrease coverage by 1.82%.
The diff coverage is 78%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #20      +/-   ##
============================================
- Coverage     88.46%   86.63%   -1.83%     
- Complexity       11       25      +14     
============================================
  Files             6       10       +4     
  Lines           182      232      +50     
  Branches         17       23       +6     
============================================
+ Hits            161      201      +40     
- Misses           14       19       +5     
- Partials          7       12       +5
Impacted Files Coverage Δ Complexity Δ
...tech/sourced/api/iterator/RootedRepoIterator.scala 50% <50%> (ø) 6 <6> (?)
...in/scala/tech/sourced/api/util/GitUrlsParser.scala 88.88% <88.88%> (ø) 0 <0> (?)
...tech/sourced/api/iterator/RepositoryIterator.scala 90.9% <90.9%> (ø) 3 <3> (?)
.../tech/sourced/api/iterator/ReferenceIterator.scala 92.85% <92.85%> (ø) 4 <4> (?)
...tech/sourced/api/provider/RepositoryProvider.scala 81.81% <0%> (+2.27%) 4% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 990ae19...53ced47. Read the comment docs.

} catch {
case _: URISyntaxException => None
}
}).distinct.min
Copy link
Contributor

Choose a reason for hiding this comment

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

Is min used because of something specific or just to get one of the results?

Copy link
Contributor Author

@ajnavarro ajnavarro Sep 4, 2017

Choose a reason for hiding this comment

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

min === sorted.head

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, that's what I meant, do we need them sorted or do we just want the first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we want the first after sort them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed IRL: sorted is needed, lgtm then

Copy link
Contributor

Choose a reason for hiding this comment

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

I must admit that it's not clear to me either, why sorting is needed.
Could be a good idea to document that

}

object RepositoryProvider {
var provider: RepositoryProvider = _
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is a singleton, what about moving everything to the RepositoryProvider object instead of having the class and manually manage the singleton?

Also, if you do RepositoryProvider("foo") and then RepositoryProvider("bar") what you get is a repository provider with "foo" as localPath, which is a bit misleading.

Copy link
Contributor Author

@ajnavarro ajnavarro Sep 4, 2017

Choose a reason for hiding this comment

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

This code is from another PR. Can you comment this there?: #19

Copy link
Contributor

Choose a reason for hiding this comment

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

object SivaRDDProvider {
var provider: SivaRDDProvider = _

def apply(sc: SparkContext): SivaRDDProvider = {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as with RepositoryProvider

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is from another PR. Can you comment this there?: #19

Copy link
Contributor

Choose a reason for hiding this comment

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

This was referenced Sep 4, 2017
@bzz bzz self-requested a review September 6, 2017 07:59
Copy link
Contributor

@bzz bzz left a comment

Choose a reason for hiding this comment

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

Having all changes from a different PRs together make review harder

@ajnavarro
Copy link
Contributor Author

Having all changes from a different PRs together make review harder

Yes, sorry about that, but at this early stage on the project, is really difficult split functionality and go forward without depending of another in-process functionalities.

Using a base abstract class RootedRepoIterator, we add two implementations, one of them to iterate repository metadata (repository id, urls, is fork) and references metadata (repository_id, name, hash).

With this RootedRepoIterator we should be able to implement CommitIterator and BlobIterator too.

Filter logic must be implemented before start with BlobIterator.

- Split test logic into Traits to be able to use them in all the Specs.
- Added a BaseRootedRepoIterator trait with a helper to test iterators more easly.
@ajnavarro ajnavarro merged commit 5a0bf4a into src-d:master Sep 6, 2017
@ajnavarro ajnavarro deleted the feature/repository-iterator branch September 6, 2017 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants