Skip to content
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

Visualise software metrics #213

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

maxwai
Copy link

@maxwai maxwai commented Aug 12, 2024

This adds the extracted metrics from jenkinsci/coverage-model#119 to the web report.

Testing done

Tested with https://github.com/uhafner/warnings-ng-plugin-devenv

Adds a new Report named "Metrics"

image

image

The Metrics are show the same as Line Coverage

image

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@maxwai maxwai marked this pull request as draft August 12, 2024 13:55
@maxwai maxwai marked this pull request as ready for review August 26, 2024 10:03
@maxwai maxwai requested a review from uhafner August 26, 2024 10:03
@uhafner uhafner changed the title Added code to visualise metrics Visualise software metrics Sep 13, 2024
@uhafner uhafner added the feature New features label Sep 13, 2024
Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

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

Thanks! Looks already really good!

plugin/pom.xml Outdated Show resolved Hide resolved
else {
Coverage coverage = (Coverage) value.get();
return coverage.getCoveredPercentage().toDouble() / 100.0 * 100.0;
}
Copy link
Member

Choose a reason for hiding this comment

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

For now this is ok, but in the future it would make more sense to have a specific model for the metrics.

@@ -77,7 +77,7 @@ protected LinesChartModel createChartModel(final String configuration) {
var iterable = new BuildActionIterable<>(CoverageBuildAction.class, getLatestAction(),
selectByUrl(), CoverageBuildAction::getStatistics);

return new CoverageTrendChart().create(iterable, ChartModelConfiguration.fromJson(configuration));
return new CoverageTrendChart().create(iterable, ChartModelConfiguration.fromJson(configuration), false);
Copy link
Member

Choose a reason for hiding this comment

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

In the future it makes sense to have a specific trend chart in the job display for metrics as well.

Comment on lines +288 to +291
for (Metric metric: Metric.values()) {
if (text.contains(metric.toTagName())) {
return metric;
}
Copy link
Member

Choose a reason for hiding this comment

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

Should be a method in coverage-model.

Comment on lines +65 to +68
<div class="row">
<div class="col-12 py-3">
<bs:card title="${%Metrics trend}" fontAwesomeIcon="chart-line">
<div id="metrics-trend" class="graph-cursor-pointer overview-chart h-100"/>
Copy link
Member

Choose a reason for hiding this comment

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

We should only show metrics when we have more than one.

Wouldn't it make more sense if we create a new tab for the metrics, that shows only the metrics overview? Then we show both tabs if we have data for both, and only one tab if there is data from a single category?

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 58.67769% with 50 lines in your changes missing coverage. Please review.

Project coverage is 79.32%. Comparing base (8c7975f) to head (c5d1dc0).
Report is 327 commits behind head on main.

Files with missing lines Patch % Lines
...ins/coverage/metrics/charts/MetricsTrendChart.java 0.00% 18 Missing ⚠️
...ns/coverage/metrics/steps/CoverageBuildAction.java 6.66% 14 Missing ⚠️
...ugins/coverage/metrics/steps/CoverageRecorder.java 57.14% 3 Missing and 3 partials ⚠️
...gins/coverage/metrics/steps/CoverageViewModel.java 14.28% 6 Missing ⚠️
...ins/coverage/metrics/steps/CoverageTableModel.java 86.95% 3 Missing ⚠️
...coverage/metrics/charts/CoverageSeriesBuilder.java 90.90% 1 Missing and 1 partial ⚠️
...ns/plugins/coverage/metrics/charts/TrendChart.java 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #213      +/-   ##
============================================
- Coverage     81.90%   79.32%   -2.59%     
- Complexity      760      797      +37     
============================================
  Files            47       50       +3     
  Lines          2658     2858     +200     
  Branches        253      286      +33     
============================================
+ Hits           2177     2267      +90     
- Misses          400      513     +113     
+ Partials         81       78       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants