-
Notifications
You must be signed in to change notification settings - Fork 275
feat: commit facts #58
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
Conversation
| } | ||
| new.numLinesDeleted = new.diffs.fold(0) { total, file -> | ||
| total + file.getAllDeleted().size | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you move this code? I find it reasonable to keep this code in CommitHasher, which is all about a commit analysis/processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's general commit stats that could be used in multiple places, e.g. in facthasher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the point
| } | ||
|
|
||
| // RepoTeamSize. | ||
| fsRepoTeamSize.add(email) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a funny to have teamSize as team email storage, fsRepoTeam would more reasonable name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'll make it simpler to calculate.
|
|
||
| // Commits. | ||
| val numCommits = fsCommitNum[email]!! + 1 | ||
| val numLinesCurrent = commit.numLinesAdded - commit.numLinesDeleted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this metric: if a user removes lines only, then it's average is negative? If the user always adds same amount of lines that he removes, then the average is 0?
Anyway at least it'd be good to comment a metric when it is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be sum of added and deleted.
| fsLineNum[email] = fsLineNum[email]!! + addedLines.size | ||
|
|
||
| fsLinesPerCommits[email]!![numCommits - 1] = | ||
| fsLinesPerCommits[email]!![numCommits - 1] + addedLines.size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need make !! twice, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smart cast didn't work for this case. += worked and it's not a problem anymore.
| /ultimate/ideaSDK | ||
| /ultimate/out | ||
| /ultimate/tmp | ||
| src/main/resources/data/models/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change seems unrelated, why it is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Models got deleted from resources, but we forgot to delete them from gitignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
| } | ||
| fsLineNum[email] = fsLineNum[email]!! + addedLines.size | ||
|
|
||
| fsLinesPerCommits[email]!![numCommits - 1] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+=
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
| fsCommitNum.put(author, 0) | ||
| fsLineLenAvg.put(author, 0.0) | ||
| fsLineNum.put(author, 0) | ||
| fsLinesPerCommits.put(author, Array(rehashes.size) {0}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that may be as large as half million items array, for example in case of gecko-dev repo. Are you sure about keeping all of this in the memory? Can you do the bin computations as addCommitsPerLinesFacts has on the go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I've add todo to future implementation.
| } | ||
| } | ||
|
|
||
| private fun calcIncAvg(prev: Double, element: Double, count: Long): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please give it a comment to make clear what the arguments are about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
| } | ||
|
|
||
| private fun calcIncAvg(prev: Double, element: Double, count: Long): | ||
| Double { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I find the style when arguments are on new lines more readable than putting a return type on a new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea, agree.
src/main/kotlin/app/FactCodes.kt
Outdated
| val COMMITS_NUM = 9 | ||
| // Used for number of commits per number of lines in a commit histogram. | ||
| // Key should be number of lines. Value number of commits. | ||
| val COMMITS_NUM_PER_LINE_NUM = 12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the name a bit confusing. Perhaps replacing 'per' to 'to' would make nicer? For example, COMMIT_COUNT_TO_LINE_COUNT. Also COMMITS -> COMMIT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMMIT_NUM_TO_LINE_NUM is shorter
| /ultimate/ideaSDK | ||
| /ultimate/out | ||
| /ultimate/tmp | ||
| src/main/resources/data/models/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
| } | ||
| new.numLinesDeleted = new.diffs.fold(0) { total, file -> | ||
| total + file.getAllDeleted().size | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the point
| } | ||
|
|
||
| /** | ||
| * Used for incremental calculation of average of sequence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe: Computes the average of a numerical sequence
src/main/kotlin/app/FactCodes.kt
Outdated
| val COMMITS_LINE_NUM_AVG = 8 | ||
| val COMMITS_NUM = 9 | ||
| // A map of line numbers to commits number. Used in a commit histogram. | ||
| val COMMITS_NUM_TO_LINE_NUM = 12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm sort of concerned that commits_num has the plural form, but line_num has the single form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix
src/main/kotlin/app/FactCodes.kt
Outdated
| val LINE_LONGEVITY = 3 | ||
| val LINE_LONGEVITY_REPO = 4 | ||
| val LINE_LEN_AVG = 10 | ||
| val LINE_NUM = 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be really nice to document all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, will do it
Add new facts calculation: