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

Javadoc2 #72

Merged
merged 6 commits into from
Sep 29, 2017
Merged

Javadoc2 #72

merged 6 commits into from
Sep 29, 2017

Conversation

davisjam
Copy link
Contributor

@davisjam davisjam commented Sep 28, 2017

Towards #70.

644d577 and edac36f clarify the API for a CommitVisitor:

  1. If RepositoryMining.withThreads is being used, then process() must be thread-safe.
  2. Multiple CommitVisitors may be operating concurrently on this SCMRepository.
  3. A CommitVisitor will only visit commits from one SCMRepository at a time.

RepoVisitor (formerly CommitVisitorIterator) now enforces this rule.

I don't think "Iterator" was really the right metaphor for what this class did.

1. Rename class and methods to match the new metaphor.
2. Javadoc for this class

Update affected classes with method calls and the change in type.
Add promises to the programmer about how a CommitVisitor will be used.
- RepoDriller: Javadoc and move some logs around
- Study: Javadoc
- RepoDrillerException: Javadoc
Copy link
Owner

@mauricioaniche mauricioaniche left a comment

Choose a reason for hiding this comment

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

Thanks for the documentation! And thanks for the refactoring of the CommitVisitorIterator; RepoVisitor is way better!

This PR looks good to me.

I responded to some of your TODOs here. As soon as we decide what to do with them, I'll merge this one.

Also, I suppose the tests are passing, right? I'll configure travis to run the tests for PRs too, so that we see it on Github!

* Close all of the PersistenceMechanism's associated with visitors.
*/
void closeAllPersistence() {
/* TODO: This API doesn't make sense to me. Why are the persistence mechanisms closed by this class?
Copy link
Owner

Choose a reason for hiding this comment

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

Where would you close them? Would you leave for the client to close them?

The problem is that, then, the user can't write a beautiful fluent instantiation of the repo:

new RepositoryMining().
...
.process(visitor, new CSVFile(...))

The user would have to store new CSVFile() in a variable, and then, close it.

In addition, I'd not expect the program to do anything else after repodriller is done. So, I guess I implemented it as a 'courtesy' to the user.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that the inline PersistenceMechanism instantiation is lovely, and that if code is written in the functional style then RepositoryMining must close up the PersistenceMechanism's it's been given.

On the other hand, there's a mismatch between where the PM is created (client level) and where it is closed (framework level), which is surprising.

How about we overload RepositoryMining.process with a "close the PM for me" flag, and have the current 2-arg version always close the PM?

Copy link
Owner

Choose a reason for hiding this comment

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

Let's open an issue to discuss about that (#77), so that I can move on with this PR

try {
log.info("-> Processing " + commit.getHash() + " with " + visitor.name());
visitor.process(currentRepo, commit, writer);
} catch (CSVFileFormatException e) {
Copy link
Owner

Choose a reason for hiding this comment

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

not sure why this exception is here... This deserves an issue: #74

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we should define what the behavior is if a CommitVisitor throws an exception.

Options:

  1. We could remove the visitor from the RepoVisitor.
  2. We can mask the exception.
  3. We can throw.

Copy link
Owner

Choose a reason for hiding this comment

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

I believe the behavior is already correct there. If an exception happens, repodriller logs it, and moves forward. It could maybe notify the study or the visitors about the error.

But this particular CSVFileFormat, not sure what it does there. I think it halts the problem as soon as it notices that the output is not being saved. It makes sense to completely stop the execution. But we should make it more general, so that this behaviour is the same through all the persistence mechanisms! This should be in #74

* @param inherit True for inherit, else false.
* @return this, for chaining
*/
public SimpleCommandExecutor inheritEnv(boolean inherit) {
Copy link
Owner

Choose a reason for hiding this comment

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

do we have a need for this feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current implementation does this implicitly when no environment variables are specified (it returns null when the list is empty). I thought it would be nice to make that behavior explicit.

Copy link
Owner

Choose a reason for hiding this comment

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

Good idea, thanks!

@mauricioaniche
Copy link
Owner

Ok, just noticed the 'check' next to the commits! Tests are passing!! 👍

Copy link
Owner

@mauricioaniche mauricioaniche left a comment

Choose a reason for hiding this comment

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

LGTM!

@mauricioaniche mauricioaniche merged commit 02c8e9e into mauricioaniche:master Sep 29, 2017
@mauricioaniche
Copy link
Owner

Was just going to release 1.3.1 due to a bug fixed by @ishepard, and maven compiler started to complain about Javadoc. At first, I tried to fix the warnings, but then I gave up, and disabled the Javadoc strict mode (that comes with Java 8).

See 89c0438 and 8848b11.

We should decide whether we want it to be strict!

@davisjam
Copy link
Contributor Author

davisjam commented Oct 1, 2017

Great, sorry for the issues. I'll double-check for that next time.

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.

2 participants