mirror of
https://github.com/lukaszraczylo/git-velocity.git
synced 2026-06-08 22:59:30 +00:00
Fixes calculations (#2)
Git Level (per commit):
- Track unique file paths in FilesModified slice
- FilesChanged = count of unique files in THIS commit
Aggregator Level (per contributor):
- Collect all file paths from all commits into a SET
- FilesChanged = size of the unique file set
Result:
- Contributor.FilesChanged = count of UNIQUE files they touched
- Repository contributor = unique files in THAT repo only
This commit is contained in:
@@ -4,25 +4,34 @@ import "time"
|
||||
|
||||
// Commit represents a Git commit
|
||||
type Commit struct {
|
||||
SHA string `json:"sha"`
|
||||
Message string `json:"message"`
|
||||
Author Author `json:"author"`
|
||||
Committer Author `json:"committer"`
|
||||
Date time.Time `json:"date"`
|
||||
Additions int `json:"additions"`
|
||||
Deletions int `json:"deletions"`
|
||||
FilesChanged int `json:"files_changed"`
|
||||
Repository string `json:"repository"` // owner/repo format
|
||||
URL string `json:"url"`
|
||||
SHA string `json:"sha"`
|
||||
Message string `json:"message"`
|
||||
Author Author `json:"author"`
|
||||
Committer Author `json:"committer"`
|
||||
Date time.Time `json:"date"`
|
||||
Additions int `json:"additions"`
|
||||
Deletions int `json:"deletions"`
|
||||
FilesChanged int `json:"files_changed"`
|
||||
FilesModified []string `json:"files_modified,omitempty"` // List of file paths modified in this commit
|
||||
Repository string `json:"repository"` // owner/repo format
|
||||
URL string `json:"url"`
|
||||
|
||||
// Meaningful line counts (excludes comments and whitespace)
|
||||
MeaningfulAdditions int `json:"meaningful_additions"`
|
||||
MeaningfulDeletions int `json:"meaningful_deletions"`
|
||||
|
||||
// Comment line counts
|
||||
// Comment line counts (all types of comments)
|
||||
CommentAdditions int `json:"comment_additions"`
|
||||
CommentDeletions int `json:"comment_deletions"`
|
||||
|
||||
// Documentation comment counts (JSDoc, Rust doc comments, docstrings, etc.)
|
||||
DocCommentAdditions int `json:"doc_comment_additions"`
|
||||
DocCommentDeletions int `json:"doc_comment_deletions"`
|
||||
|
||||
// Commented-out code counts (code that was commented rather than deleted)
|
||||
CommentedCodeAdditions int `json:"commented_code_additions"`
|
||||
CommentedCodeDeletions int `json:"commented_code_deletions"`
|
||||
|
||||
// Derived fields
|
||||
HasTests bool `json:"has_tests"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user