Skip to content

feat: add repository health score dashboard card#731

Open
jainiksha wants to merge 1 commit into
GitMetricsLab:mainfrom
jainiksha:feature/repository-health-score-dashboard
Open

feat: add repository health score dashboard card#731
jainiksha wants to merge 1 commit into
GitMetricsLab:mainfrom
jainiksha:feature/repository-health-score-dashboard

Conversation

@jainiksha

@jainiksha jainiksha commented Jun 8, 2026

Copy link
Copy Markdown

Related Issue


Description

Added a Repository Health Score card with status indicators and a progress bar to provide a quick overview of repository activity.


How Has This Been Tested?

  • Verified score calculation and display.
  • Checked status labels and progress bar rendering.

Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

  • New Features
    • Added a repository health score display to the dashboard with a visual progress indicator and qualitative status assessment. The feature provides at-a-glance insights into the overall quality and activity level of your repository, helping you quickly understand health status and prioritize maintenance efforts.

@netlify

netlify Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 76d404d
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a2684fa69b655000880611c
😎 Deploy Preview https://deploy-preview-731--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Dashboard component now computes a Repository Health Score from issue and pull request counts, derives a qualitative health status label using threshold ranges, and displays the score with a Material-UI LinearProgress bar in a new Paper section positioned before the existing charts.

Changes

Repository Health Score Feature

Layer / File(s) Summary
Health score metric computation
src/components/Dashboard.tsx
Adds LinearProgress import from Material-UI and introduces healthScore (clamped percentage derived from totalIssues + totalPrs) and healthStatus (qualitative label determined by score thresholds).
Health score visualization
src/components/Dashboard.tsx
Inserts a new Material-UI Paper section rendering the health score, status text, and a LinearProgress bar with conditional color selection (green for Excellent, orange for Good/Moderate, red for Poor).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • GitMetricsLab/github_tracker#255: Both PRs modify src/components/Dashboard.tsx—the retrieved PR creates the analytics dashboard with Pie/Bar charts and this PR extends that same component by adding a computed Repository Health Score section.
  • GitMetricsLab/github_tracker#591: Both PRs modify src/components/Dashboard.tsx and handle issue/PR metrics—one changes how Dashboard derives/counts those metrics and this PR adds a new Health Score based on those counts.

Suggested labels

type:feature, level:intermediate, quality:clean

Poem

🐰 A health score hops into view,
Progress bars in shades of green and blue,
From issues and PRs, a metric so true,
Repository wellness at a glance for you! 📊✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The implementation only partially addresses issue #719; it adds basic health score calculation and display but lacks the comprehensive metrics analysis and advanced features requested. The current implementation uses only totalIssues + totalPrs for scoring, but #719 requires analyzing commit frequency, issue resolution rate, PR merge rate, contributor activity, and update frequency. Add these missing metrics and implement trend indicators, customizable weightings, and additional visual representations as specified.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a repository health score dashboard card component.
Description check ✅ Passed The description includes all required sections from the template with relevant content for the new feature, though testing details are somewhat brief.
Out of Scope Changes check ✅ Passed All changes in Dashboard.tsx are directly related to implementing the repository health score feature requested in issue #719; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎉 Thank you @jainiksha for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/components/Dashboard.tsx (2)

138-145: ⚡ Quick win

Add accessibility attributes to the progress bar.

The LinearProgress component should include an aria-label or aria-labelledby attribute so screen readers can announce the current health score to users relying on assistive technology.

♿ Add aria-label for accessibility
 <LinearProgress
   variant="determinate"
   value={healthScore}
+  aria-label={`Repository health score: ${healthScore} out of 100`}
   sx={{
     height: 12,
     borderRadius: 5,
   }}
 />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Dashboard.tsx` around lines 138 - 145, The LinearProgress
usage in Dashboard should include an accessibility attribute so screen readers
can announce the health score; update the LinearProgress element (in the
Dashboard component where LinearProgress and value={healthScore} are used) to
add either aria-label or aria-labelledby that describes the control and
references the displayed health score (e.g., "Health score" or link to a nearby
label element), ensuring the attribute reflects the healthScore value for
assistive tech.

81-88: 💤 Low value

Eliminate duplicated threshold logic.

The threshold checks for healthScore (≥80, ≥60, ≥40) are duplicated in two places: once for computing healthStatus (lines 81-88) and again for selecting the color (lines 126-133). If thresholds change, you must update both locations.

♻️ Refactor to use a single threshold-to-style mapping
+const getHealthStyle = (score: number) => {
+  if (score >= 80) return { status: "Excellent", color: "success.main" };
+  if (score >= 60) return { status: "Good", color: "info.main" };
+  if (score >= 40) return { status: "Moderate", color: "warning.main" };
+  return { status: "Poor", color: "error.main" };
+};
+
+const { status: healthStatus, color: healthColor } = getHealthStyle(healthScore);
-const healthStatus =
-  healthScore >= 80
-    ? "Excellent"
-    : healthScore >= 60
-    ? "Good"
-    : healthScore >= 40
-    ? "Moderate"
-    : "Poor";

Then update the Typography component:

 <Typography
   variant="h6"
-  color={
-    healthScore >= 80
-      ? "success.main"
-      : healthScore >= 60
-      ? "info.main"
-      : healthScore >= 40
-      ? "warning.main"
-      : "error.main"
-  }
+  color={healthColor}
 >
   Status: {healthStatus}
 </Typography>

Also applies to: 126-133

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Dashboard.tsx` around lines 81 - 88, The duplicated threshold
logic for deriving textual status and color should be centralized: create a
shared helper (e.g., getHealthCategory or healthCategoryFromScore) that takes
healthScore and returns an object with the category string
("Excellent"/"Good"/"Moderate"/"Poor") and the associated color; replace the
inline ternary that sets healthStatus and the separate color-selection logic
used in the Typography component with calls to this helper so both the label and
color come from the same source of truth (update places referencing healthStatus
and the Typography color selection to use the helper's returned values).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Dashboard.tsx`:
- Around line 76-79: The current healthScore calculation using
totalContributions is misleading; replace it with a composite score computed
from ratios (not raw counts). Compute metrics like issueResolutionRate =
closedIssues / totalIssues, openIssueRatio = openIssues / totalIssues,
prMergeRate = mergedPrs / totalPrs, contributorActivity = recentContributorCount
/ totalContributors, and recencyScore from lastCommitDate; then weight and
combine these into a single healthScore (e.g., weighted sum normalized to 0–100)
and update the code that references healthScore and totalContributions so that
healthScore uses these new ratio variables instead of
Math.round((totalContributions / 50) * 100). Ensure you handle divide-by-zero
(fallbacks when totalIssues or totalPrs are 0) and update any UI labels that
describe the metric.

---

Nitpick comments:
In `@src/components/Dashboard.tsx`:
- Around line 138-145: The LinearProgress usage in Dashboard should include an
accessibility attribute so screen readers can announce the health score; update
the LinearProgress element (in the Dashboard component where LinearProgress and
value={healthScore} are used) to add either aria-label or aria-labelledby that
describes the control and references the displayed health score (e.g., "Health
score" or link to a nearby label element), ensuring the attribute reflects the
healthScore value for assistive tech.
- Around line 81-88: The duplicated threshold logic for deriving textual status
and color should be centralized: create a shared helper (e.g., getHealthCategory
or healthCategoryFromScore) that takes healthScore and returns an object with
the category string ("Excellent"/"Good"/"Moderate"/"Poor") and the associated
color; replace the inline ternary that sets healthStatus and the separate
color-selection logic used in the Typography component with calls to this helper
so both the label and color come from the same source of truth (update places
referencing healthStatus and the Typography color selection to use the helper's
returned values).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f53814f2-5f98-4a07-aa5d-71c608cc9fbc

📥 Commits

Reviewing files that changed from the base of the PR and between 53f820b and 76d404d.

📒 Files selected for processing (1)
  • src/components/Dashboard.tsx

Comment on lines +76 to +79
const healthScore = Math.min(
100,
Math.round((totalContributions / 50) * 100)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

The algorithm does not measure actual repository health.

The current implementation uses raw totals (totalIssues + totalPrs) regardless of state, which produces misleading results. A repository with 1000 open, unresolved issues would score "Excellent" (100/100), but that indicates poor health, not good health. Additionally, cumulative totals from the GitHub search API don't reflect current activity or maintenance quality.

Issue #719 requires analyzing:

  • Issue resolution rate (closed/total)
  • Pull request merge rate
  • Open vs closed issues ratio
  • Contributor activity trends
  • Repository update frequency

Consider refactoring to compute ratios and rates instead of raw counts. For example:

  • issueResolutionRate = closedIssues / totalIssues
  • openIssueRatio = openIssues / totalIssues
  • Weight and combine these metrics into a composite score
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Dashboard.tsx` around lines 76 - 79, The current healthScore
calculation using totalContributions is misleading; replace it with a composite
score computed from ratios (not raw counts). Compute metrics like
issueResolutionRate = closedIssues / totalIssues, openIssueRatio = openIssues /
totalIssues, prMergeRate = mergedPrs / totalPrs, contributorActivity =
recentContributorCount / totalContributors, and recencyScore from
lastCommitDate; then weight and combine these into a single healthScore (e.g.,
weighted sum normalized to 0–100) and update the code that references
healthScore and totalContributions so that healthScore uses these new ratio
variables instead of Math.round((totalContributions / 50) * 100). Ensure you
handle divide-by-zero (fallbacks when totalIssues or totalPrs are 0) and update
any UI labels that describe the metric.

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.

🚀 Feature: Repository Health Score Dashboard

1 participant