fix: correct contribution metrics — remove double-counting and improve clarity#4936
fix: correct contribution metrics — remove double-counting and improve clarity#4936marcusquinn merged 2 commits intomainfrom
Conversation
…e clarity - Remove --all from git log to count only default-branch commits, fixing ~12% inflation from squash-merged PR commits being counted twice (once as branch originals, once as the squash-merge on main) - Rename 'Contributions' sections to 'Commits' for accuracy - Rename 'Contributor output' to 'GitHub activity' and move to top of dashboard (most meaningful metric: issues, PRs, merges, comments) - Clarify column headers: 'Direct' → 'Direct Pushes', 'PR Merges' → 'PRs Merged' - Reorder dashboard: GitHub activity → AI sessions → Commits (most to least meaningful)
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the accuracy and readability of contribution metrics by refining how git commits are counted and presented. It addresses an issue where squash-merged pull requests were double-counted, and improves the user interface by renaming and reordering dashboard sections and clarifying report column headers, ensuring that contribution data is both precise and easily understandable. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated contributor commit counting to use the repository's default branch (avoiding --all) and revised related labels and help text; remapped dashboard sections to swap which markdown sources render per-repo vs. cross-repo commit/activity displays. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sun Mar 15 17:25:43 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses the double-counting of commits by removing the --all flag from git log commands, ensuring that only commits on the default branch are considered. The renaming of dashboard sections and table headers also significantly improves clarity. I have a couple of suggestions to make the script more robust by explicitly determining the default branch name instead of relying on the script's execution context.
| local git_data | ||
| # shellcheck disable=SC2086 | ||
| git_data=$(git -C "$repo_path" log --all --format='%ae|%ce|%aI' $since_arg) || git_data="" | ||
| git_data=$(git -C "$repo_path" log --format='%ae|%ce|%aI' $since_arg) || git_data="" |
There was a problem hiding this comment.
To make this script more robust, it's better to explicitly specify the default branch for git log instead of relying on the script being run from a checkout of the default branch. You can determine the default branch name dynamically.
| local git_data | |
| # shellcheck disable=SC2086 | |
| git_data=$(git -C "$repo_path" log --all --format='%ae|%ce|%aI' $since_arg) || git_data="" | |
| git_data=$(git -C "$repo_path" log --format='%ae|%ce|%aI' $since_arg) || git_data="" | |
| local git_data default_branch | |
| default_branch=$(git -C "$repo_path" symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@') | |
| # shellcheck disable=SC2086 | |
| git_data=$(git -C "$repo_path" log "$default_branch" --format='%ae|%ce|%aI' $since_arg) || git_data="" |
There was a problem hiding this comment.
Addressed in 269a152 — added _resolve_default_branch() helper that tries origin/HEAD, then main/master, then HEAD as fallback. Applied to all three git log call sites.
| local git_data | ||
| git_data=$(git -C "$repo_path" log --all --format='%ae|%ce|%aI' --since='1.year.ago') || git_data="" | ||
| git_data=$(git -C "$repo_path" log --format='%ae|%ce|%aI' --since='1.year.ago') || git_data="" |
There was a problem hiding this comment.
Similarly here, explicitly specifying the default branch will make the script more robust and not dependent on the current checkout state.
| local git_data | |
| git_data=$(git -C "$repo_path" log --all --format='%ae|%ce|%aI' --since='1.year.ago') || git_data="" | |
| git_data=$(git -C "$repo_path" log --format='%ae|%ce|%aI' --since='1.year.ago') || git_data="" | |
| local git_data default_branch | |
| default_branch=$(git -C "$repo_path" symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@') | |
| git_data=$(git -C "$repo_path" log "$default_branch" --format='%ae|%ce|%aI' --since='1.year.ago') || git_data="" |
Address Gemini review feedback — git log without --all and without an explicit branch name walks the current branch, which is wrong when called from a worktree on a feature branch. Add _resolve_default_branch() helper that tries origin/HEAD, then main/master, then HEAD as fallback. Apply to all three git log call sites.
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sun Mar 15 17:31:52 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
--allfromgit logincontributor-activity-helper.sh. With--all, squash-merged PR commits were counted twice — once as the original branch commits and once as the squash-merge on main. This inflated totals by ~12% (e.g., marcusquinn: 3,757 → 3,339 actual).Verification
Tested
contributor-activity-helper.sh summaryoutput — numbers now matchgit log(no--all) exactly. ShellCheck passes clean on both modified files.Closes #4433
Summary by CodeRabbit