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

summary.json: move sinceDate and untilDate become direct element #607 #615

Merged
merged 27 commits into from Apr 16, 2019

Conversation

emer7
Copy link
Contributor

@emer7 emer7 commented Mar 20, 2019

Fix #607

summary.json has multiple identical sinceDate and untilDate
in each repo that is analyzed, hence redundant.

This is caused by sinceDate and untilDate being instance variable
of repoConfig

Let's rectify this problem by moving sinceDate and untilDate
out of repoConfig into summaryReportJson

This PR will affect PR #596 and PR #539

@emer7 emer7 requested a review from a team March 20, 2019 12:33
@emer7
Copy link
Contributor Author

emer7 commented Mar 20, 2019

@reposense/stage1-reviewers Ready for review!

Copy link
Contributor

@chel-seyy chel-seyy left a comment

Choose a reason for hiding this comment

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

The rest looks good to me

@@ -38,8 +43,8 @@
}

/**
* Parses the {@code gitLogResult} into a list of {@code CommitInfo} and returns it.
*/
* Parses the {@code gitLogResult} into a list of {@code CommitInfo} and returns it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Spaces are missing here.

@emer7 emer7 requested a review from a team March 20, 2019 18:06
@emer7
Copy link
Contributor Author

emer7 commented Mar 20, 2019

@reposense/stage2-reviewers ready for review

@emer7 emer7 closed this Mar 20, 2019
@emer7 emer7 reopened this Mar 20, 2019
Copy link
Contributor

@yamidark yamidark left a comment

Choose a reason for hiding this comment

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

Changes requested

@yamidark
Copy link
Contributor

I believe the frontend portion also needs to be edited to take the sinceDate and untilDate correctly from summary.json.

@emer7
Copy link
Contributor Author

emer7 commented Mar 23, 2019

I believe the frontend portion also needs to be edited to take the sinceDate and untilDate correctly from summary.json.

No need because sinceDate and untilDate is not used so far (it is used in my other 2 PR)

@emer7 emer7 requested a review from a team March 23, 2019 17:40
@emer7
Copy link
Contributor Author

emer7 commented Mar 24, 2019

@reposense/stage2-reviewers ready for review

Copy link
Contributor

@yamidark yamidark left a comment

Choose a reason for hiding this comment

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

1 nit, rest LGTM

InputStream is = RepoSense.class.getResourceAsStream(TEMPLATE_FILE);
FileUtil.copyTemplate(is, outputPath);

cloneAndAnalyzeRepos(configs, outputPath);

FileUtil.writeJsonFile(new SummaryReportJson(configs, generationDate), getSummaryResultPath(outputPath));
FileUtil.writeJsonFile(new SummaryReportJson(
configs, generationDate, sinceDate, untilDate),
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be put together on the line above right (without passing the 120 characters limit)?

@emer7 emer7 requested a review from a team March 24, 2019 14:37
@emer7
Copy link
Contributor Author

emer7 commented Mar 24, 2019

@reposense/stage2-reviewers fixed last nit spotted by Jun An

@yamidark yamidark changed the title Move sinceDate and untilDate in summary.json to be direct element of summary.json #607 summary.json: move sinceDate and untilDate become direct element #607 Mar 25, 2019
@eugenepeh
Copy link
Member

@eugenepeh can I know what is netlify arguments?

Its just a plain gradlew run

Because running
--since 01/03/2018 --until 15/04/2018 --config ./src/systemtest/resources on master branch
will yield the same result with running
--since 01/03/2018 --until 15/04/2018 --config ./src/systemtest/resources on 607-move-date branch
and running
--config ./src/systemtest/resources on 607-move-date branch (no date)

What config are you using and which repo is showing difference? Need to be more specific.
Are you running Delta alone? What are the files showing difference?

@emer7
Copy link
Contributor Author

emer7 commented Apr 4, 2019

What config are you using and which repo is showing difference? Need to be more specific.

I am using the config in src/systemtest/resources/repo-config.csv and src/systemtest/resources/author-config.csv
The repo that is showing difference is testrepo-Delta

Are you running Delta alone?

The repo-config has other repo beside Delta, but the repo that is showing difference is Delta given the date range of 01/03/2018 until 15/04/2018.

Why I am using that date? Because if we do not supply any date argument when running RepoSense, it will automatically analyze the repo, and by debuggin the app, the date range that I get for testrepo-Delta is 01/03/2018 until 15/04/2018. This is also why commits.json of running RepoSense without date arguments is the similar with running Reposense with date range (the only difference is the authorFinalContributionMap).

What are the files showing difference?

It is the same file you pointed out.
src/test/java/seedu/address/logic/parser/AddressBookParserTest.java

@eugenepeh

@eugenepeh
Copy link
Member

@emer7

The questions I asked above is things that you should include and investigate when reporting a bug / error.

Main problem is still that the new changes doesn't seems to be correct. If you think that there is an underlying problem, you will need to investigate and report it as an issue.

@emer7
Copy link
Contributor Author

emer7 commented Apr 8, 2019

@eugenepeh
This is what I get after investigating:

Running RepoSense without any date argument, upon reaching

// CommitInfoExtractor.java#extractCommitInfos:33
String gitLogResult = GitLog.get(config, author);

It will get the git log, but it seems to get it on arbitrary date range. In the case of testrepo-delta, it gets all the commits from 01/03/2018 to 15/04/2018.
But when it reaches CommitInfoExtractor.java#extractFileInfos, it will get all the file info regardless of date range if it is not provided.

This behavior is what causing running
--config ./src/systemtest/resources --since 01/03/2018 --until 15/04/2018 on master branch
and
--config ./src/systemtest/resources on master branch
to have almost the same commits.json but different authorship.json I believe.
Almost the same as in the commits list are the same in commits.json, but there is slight difference in contribution, etc. (will investigate further).

So is this an intended design or a bug?

@eugenepeh
Copy link
Member

But when it reaches CommitInfoExtractor.java#extractFileInfos, it will get all the file info regardless of date range if it is not provided.

It is meant to retrieve all the affected files in the given date range.

So is this an intended design or a bug?

If this only cause an issue when a date range is issued, then most likely it is a bug.

Almost the same as in the commits list are the same in commits.json, but there is slight difference in contribution, etc. (will investigate further).

Yes, please do investigate further. It will help you understand the back end architecture better if you haven't already.

@emer7 emer7 requested a review from a team April 10, 2019 14:04
@emer7
Copy link
Contributor Author

emer7 commented Apr 10, 2019

@eugenepeh fixed and worked already. No bug

Copy link
Member

@eugenepeh eugenepeh left a comment

Choose a reason for hiding this comment

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

👍 minor nits

@@ -227,4 +238,16 @@ private static String getIndividualAuthorshipPath(String repoReportDirectory) {
private static String getIndividualCommitsPath(String repoReportDirectory) {
return repoReportDirectory + "/commits.json";
}

public static void setEarliestSinceDate(Date newEarliestSinceDate) {
if (earliestSinceDate == null || earliestSinceDate.after(newEarliestSinceDate)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think normally when people look for the earliest date/object, they usually compare who comes before, instead of after, in multiple comparison context. To standardize with that convention, let's change it to use before instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eugenepeh done

@emer7 emer7 requested a review from a team April 11, 2019 06:05
@yamidark yamidark requested a review from eugenepeh April 11, 2019 06:40
@yamidark
Copy link
Contributor

@emer7 Do resolve the conflicts

@emer7
Copy link
Contributor Author

emer7 commented Apr 12, 2019

@yamidark resolved

@emer7 emer7 requested a review from a team April 14, 2019 07:39
@yamidark
Copy link
Contributor

Slight nits to proposed message:

summary.json has multiple identical sinceDate and untilDate
in each repo that is analyzed, which is redundant.

This is caused by sinceDate and untilDate being instance variable
of RepoConfiguration.

Let's rectify this problem by moving sinceDate and untilDate
out of RepoConfiguration into SummaryReportJson.

@yamidark yamidark merged commit 8f385ab into reposense:master Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

summary.json: move sinceDate and untilDate become direct element
5 participants