Skip to content

Feat 102 include todo code comments in health metrics calculation#63

Merged
tshuck-beyond merged 10 commits intomainfrom
feat-102-include-todo-code-comments-in-health-metrics-calculation
Mar 7, 2025
Merged

Feat 102 include todo code comments in health metrics calculation#63
tshuck-beyond merged 10 commits intomainfrom
feat-102-include-todo-code-comments-in-health-metrics-calculation

Conversation

@tshuck-beyond
Copy link
Collaborator

@tshuck-beyond tshuck-beyond commented Mar 5, 2025

This work refactors percentile and health-score calculation, and adds a new health component to account for todos (the fewer the better!)

Specifically, it:

  • Removes the score_threshold configuration (and related code) in favor of a simplified approach via percent_of_max_threshold (renamed from the incomprehensible minimum_variance)
  • Pulls first-pass percentile metric calculation into a service class
  • Pulls health score calculation into a service class
  • Adds percentile metrics for todos
  • Adds health component for todos

Glue Dashboard:

CleanShot 2025-03-05 at 14 13 13

Local dev

CleanShot 2025-03-05 at 14 14 34

NOTE: This will require configuration updates to include config entries for the new component + renamed health attributes. We'll do this when we bump the featuremap version in glue and salesforce bedrock.

Copy link
Contributor

@DLavin23 DLavin23 left a comment

Choose a reason for hiding this comment

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

Left a small formatting comment, otherwise looks good. Love the service class refactor, especially for calculating health. Great work!

},
"overall": 89.75
"todo_count_component": {
"awardable_points": 15, "health_score": 9.75, // (100-35)/100 * 15 = 9.75
Copy link
Contributor

Choose a reason for hiding this comment

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

/nit put "health_score" on a new line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Certainly can; this is in-pattern with the other _components, but it does look a little weird.

Encapsulation: {feature.additional_metrics.health.encapsulation_component.health_score.toFixed(0)} / {feature.additional_metrics.health.encapsulation_component.awardable_points}
</li>
<li className="text-xs text-gray-500">
Todos: {feature.additional_metrics.health.todo_count_component.health_score.toFixed(0)} / {feature.additional_metrics.health.todo_count_component.awardable_points}
Copy link
Contributor

Choose a reason for hiding this comment

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

Kinda seemed like this was looking a little janky on slightly smaller screens. Not blocking, but it may be worth time-boxing a little design discovery session for like 15 min.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, let's do that outside of this work.

encapsulation_ratios = feature_metrics.map { |_k, m| m[FeatureMetricsCalculator::ENCAPSULATION_RATIO_METRIC] }.compact
feature_sizes = feature_metrics.map { |_k, m| m[FeatureMetricsCalculator::LINES_OF_CODE_METRIC] }.compact
test_coverage_ratios = feature_test_coverage.map { |_k, c| c[TestCoverageFile::COVERAGE_RATIO] }.compact
percentile_metrics = PercentileMetricsCalculator.new(metrics: feature_metrics, test_coverage: feature_test_coverage)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice refactor 👍

@tshuck-beyond tshuck-beyond merged commit 97dbcb5 into main Mar 7, 2025
9 checks passed
@tshuck-beyond tshuck-beyond deleted the feat-102-include-todo-code-comments-in-health-metrics-calculation branch March 7, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants