-
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
Changes from all commits
c5c6027
ab40081
3d82b31
4ce2b5a
c618a17
23cc508
d8214dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,20 @@ | ||
| // Copyright 2017 Sourcerer Inc. All Rights Reserved. | ||
| // Author: Anatoly Kislov (anatoly@sourcerer.io) | ||
|
|
||
| package app | ||
|
|
||
| object FactCodes { | ||
| val COMMITS_DAY_WEEK = 1 | ||
| val COMMITS_DAY_TIME = 2 | ||
| val LINE_LONGEVITY = 3 | ||
| val LINE_LONGEVITY_REPO = 4 | ||
| val REPO_DATE_START = 5 | ||
| val REPO_DATE_END = 6 | ||
| val REPO_TEAM_SIZE = 7 | ||
| val COMMIT_DAY_WEEK = 1 // Day of week fun fact and graph. | ||
| val COMMIT_DAY_TIME = 2 // Day time fun fact. | ||
| val COMMIT_LINE_NUM_AVG = 8 // Average number of lines per commit fun fact. | ||
| val COMMIT_NUM = 9 // Used for averaging COMMIT_LINE_NUM_AVG between repos. | ||
| // A map of line numbers to commits number. Used in a commit histogram. | ||
| val COMMIT_NUM_TO_LINE_NUM = 12 | ||
| val LINE_LONGEVITY = 3 // Used for longevity graph. | ||
| val LINE_LONGEVITY_REPO = 4 // Used for longevity graph. | ||
| val LINE_LEN_AVG = 10 // Average length of line fun fact. | ||
| val LINE_NUM = 11 // Used for averaging LINE_LEN_AVG between repos. | ||
| val REPO_DATE_START = 5 // Repo summary info. Date of first contribution. | ||
| val REPO_DATE_END = 6 // Repo summary info. Date of last contribution. | ||
| val REPO_TEAM_SIZE = 7 // Repo summary info. Number of contributors. | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,15 @@ object CommitCrawler { | |
| } | ||
| new.diffs = getDiffFiles(git, new, old) | ||
| Logger.debug { "Diff: ${new.diffs.size} entries" } | ||
| // Count lines on all non-binary files. This is additional | ||
| // statistics to CommitStats because not all file extensions | ||
| // may be supported. | ||
| new.numLinesAdded = new.diffs.fold(0) { total, file -> | ||
| total + file.getAllAdded().size | ||
| } | ||
| new.numLinesDeleted = new.diffs.fold(0) { total, file -> | ||
| total + file.getAllDeleted().size | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see the point |
||
| new.repo = repo | ||
| new | ||
| } | ||
|
|
||
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