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

Add coverage metrics from VectorCAST #153

Merged
merged 44 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bc397c6
VectorCAST Updates
TimSVector May 3, 2024
52752c9
Updates for VectorCAST extended code coverage
TimSVector May 7, 2024
925d06b
README updates
TimSVector May 7, 2024
d66e031
clean up
TimSVector May 7, 2024
58927a6
Updates for POM.xml
TimSVector May 17, 2024
7ed3f4f
Updates for coding standards
TimSVector May 20, 2024
efd0813
Updates for coding standards
TimSVector May 20, 2024
9132317
update to fix error
TimSVector May 20, 2024
8a250a5
Updates for GodClass and CyclomaticComplexity
TimSVector May 20, 2024
001c60e
Updates per maintainer
TimSVector May 30, 2024
c073db7
Update for compilation error
TimSVector May 30, 2024
6a1bdf3
Refactoring CoverageSourcePrinter
TimSVector May 30, 2024
86fb993
Updates for coding standards
TimSVector May 31, 2024
125fa2b
fixing serialVersionUID issue
TimSVector May 31, 2024
5d7b6da
updates for coding standards
TimSVector May 31, 2024
9ec24f6
fixing comment errors
TimSVector May 31, 2024
f88da58
JavaDoc update
TimSVector May 31, 2024
80de144
javadoc updates
TimSVector May 31, 2024
59ad32a
Updates to fix method/function coverage
TimSVector Jun 10, 2024
85b5eee
Updates for coding standards
TimSVector Jun 10, 2024
e593276
Trial update for using VectorCAST Source Painter
TimSVector Jun 11, 2024
f3aefe7
Update for testing
TimSVector Jun 11, 2024
1c43685
Merge remote-tracking branch 'origin/main' into vc_coverage
uhafner Jun 18, 2024
a7b144f
Push to removed Method coverage from unwanted coverage modes
TimSVector Jun 18, 2024
d83d934
Merge branch 'vc_coverage' of https://github.com/TimSVector/coverage-…
TimSVector Jun 18, 2024
7550cb9
Updated for PMD warning
TimSVector Jun 18, 2024
1ae6671
Fix test: method coverage is not in the table model anymore.
uhafner Jun 19, 2024
a33e467
Fix test: new exception message.
uhafner Jun 19, 2024
04180a7
Updates for testing vectorcast metrics with VectorCastCoverageChecksP…
TimSVector Jun 20, 2024
c2b21dc
Merge branch 'vc_coverage' of https://github.com/TimSVector/coverage-…
TimSVector Jun 20, 2024
aff8bf9
Update for PMD and CheckStyle warnings
TimSVector Jun 20, 2024
53a4a52
Remove unused method coverage
uhafner Jun 21, 2024
105ab43
Remove whitespace
uhafner Jun 21, 2024
09156c6
Remove unused method coverage
uhafner Jun 21, 2024
fb96482
Remove unused import
uhafner Jun 21, 2024
6b75d33
Added Test for VectorCastCoveragePluginITest and VectorCastCoverageRe…
TimSVector Jun 21, 2024
541321e
Merge branch 'vc_coverage' of https://github.com/TimSVector/coverage-…
TimSVector Jun 21, 2024
24ce46c
Update for PMD and CheckStyle warnings
TimSVector Jun 21, 2024
1dce1f6
Removed placeholder test results file - no longer needed
TimSVector Jun 21, 2024
c4bcf82
Make the visible metrics overridable.
uhafner Jun 21, 2024
32464ee
Delete extra test class.
uhafner Jun 21, 2024
fbaa1df
Bump version of coverage model to 0.46.0.
uhafner Jun 26, 2024
ff05588
Move all integration tests into single test class.
uhafner Jun 26, 2024
7e3260b
Remove qualified call.
uhafner Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The Jenkins Coverage Plug-in collects reports of code coverage or mutation cover
- [JaCoCo](https://www.jacoco.org/jacoco): Code Coverage
- [Cobertura](https://cobertura.github.io/cobertura/): Code Coverage
- [OpenCover](https://github.com/OpenCover/opencover): Code Coverage
- [VectorCAST](https://www.vector.com/int/en/products/products-a-z/software/vectorcast): Code Coverage including MC/DC, Function, Function Call coverages
- [PIT](https://pitest.org/): Mutation Coverage
- [JUnit](https://ant.apache.org/manual/Tasks/junitreport.html): Test Results
- [NUnit](https://nunit.org/): Test Results
Expand Down Expand Up @@ -107,6 +108,7 @@ The Coverage Plug-in supports the following report formats:
- [JaCoCo](https://www.jacoco.org/jacoco): Code Coverage
- [Cobertura](https://cobertura.github.io/cobertura/): Code Coverage
- [OpenCover](https://github.com/OpenCover/opencover): Code Coverage
- [VectorCAST](https://www.vector.com/int/en/products/products-a-z/software/vectorcast) Code Coverage including MC/DC, Function, Function Call coverages
- [PIT](https://pitest.org/): Mutation Coverage
- [JUnit](https://ant.apache.org/manual/Tasks/junitreport.html): Test Results
- [NUnit](https://nunit.org/): Test Results
Expand Down
2 changes: 1 addition & 1 deletion plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<gitHubRepo>jenkinsci/coverage-plugin</gitHubRepo>

<!-- Library Dependencies Versions -->
<coverage-model.version>0.43.0</coverage-model.version>
<coverage-model.version>0.44.0-rc778.0b_52cf96576c</coverage-model.version>
<jsoup.version>1.17.2</jsoup.version>

<!-- Jenkins Plug-in Dependencies Versions -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class CoverageSeriesBuilder extends SeriesBuilder<CoverageStatistics> {
static final String BRANCH_COVERAGE = "branch";
static final String MUTATION_COVERAGE = "mutation";
static final String TEST_STRENGTH = "test-strength";
static final String MCDC_PAIR_COVERAGE = "mcdc-pair";
static final String FUNCTION_CALL_COVERAGE = "function-call";
static final String FUNCTION_COVERAGE = "function";

@Override
protected Map<String, Double> computeSeries(final CoverageStatistics statistics) {
Expand All @@ -29,6 +32,9 @@ protected Map<String, Double> computeSeries(final CoverageStatistics statistics)
add(statistics, Metric.BRANCH, BRANCH_COVERAGE, series);
add(statistics, Metric.MUTATION, MUTATION_COVERAGE, series);
add(statistics, Metric.TEST_STRENGTH, TEST_STRENGTH, series);
add(statistics, Metric.MCDC_PAIR, MCDC_PAIR_COVERAGE, series);
add(statistics, Metric.FUNCTION_CALL, FUNCTION_CALL_COVERAGE, series);
add(statistics, Metric.FUNCTION, FUNCTION_COVERAGE, series);
return series;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@
* @see JacksonFacade
*/
public class CoverageTrendChart {
/* Line Mode used to indicate whether is hsould be a filled line chart or line chart */
TimSVector marked this conversation as resolved.
Show resolved Hide resolved
private static FilledMode lineMode;

/**
* Sets the line mode for the trend chart.
*
* @param dataSet
*
*/

uhafner marked this conversation as resolved.
Show resolved Hide resolved
private void setLineMode(final LinesDataSet dataSet) {
// If the dataset contains MCDC, Function or Function Call Coverage
if (dataSet.containsSeries(CoverageSeriesBuilder.MCDC_PAIR_COVERAGE)
|| dataSet.containsSeries(CoverageSeriesBuilder.FUNCTION_COVERAGE)
|| dataSet.containsSeries(CoverageSeriesBuilder.FUNCTION_CALL_COVERAGE))
{

Check warning on line 41 in plugin/src/main/java/io/jenkins/plugins/coverage/metrics/charts/CoverageTrendChart.java

View check run for this annotation

ci.jenkins.io / CheckStyle

LeftCurlyCheck

NORMAL: '{' at column 9 should be on the previous line.
Raw output
<p>Since Checkstyle 3.0</p><p> Checks for the placement of left curly braces (<code>'{'</code>) for code blocks. The policy to verify is specified using the property <code>option</code>. </p>
lineMode = FilledMode.LINES;
}
else {
lineMode = FilledMode.FILLED;
}
}

/**
* Creates the chart for the specified results.
*
Expand All @@ -38,11 +61,13 @@
final ChartModelConfiguration configuration) {
CoverageSeriesBuilder builder = new CoverageSeriesBuilder();
LinesDataSet dataSet = builder.createDataSet(configuration, results);

setLineMode(dataSet);

LinesChartModel model = new LinesChartModel(dataSet);
if (dataSet.isNotEmpty()) {
LineSeries lineSeries = new LineSeries(Messages.Metric_LINE(),
JenkinsPalette.GREEN.normal(), StackedMode.SEPARATE_LINES, FilledMode.FILLED,
JenkinsPalette.GREEN.normal(), StackedMode.SEPARATE_LINES, lineMode,
dataSet.getSeries(CoverageSeriesBuilder.LINE_COVERAGE));
model.addSeries(lineSeries);
model.useContinuousRangeAxis();
Expand All @@ -55,6 +80,13 @@
JenkinsPalette.GREEN.dark());
addSeries(dataSet, model, Messages.Metric_TEST_STRENGTH(), CoverageSeriesBuilder.TEST_STRENGTH,
JenkinsPalette.GREEN.light());

addSeries(dataSet, model, Messages.Metric_MCDC_PAIR(), CoverageSeriesBuilder.MCDC_PAIR_COVERAGE,
JenkinsPalette.RED.light());
addSeries(dataSet, model, Messages.Metric_FUNCTION(), CoverageSeriesBuilder.FUNCTION_COVERAGE,
JenkinsPalette.RED.normal());
addSeries(dataSet, model, Messages.Metric_FUNCTION_CALL(), CoverageSeriesBuilder.FUNCTION_CALL_COVERAGE,
JenkinsPalette.RED.dark());
}
return model;
}
Expand All @@ -63,7 +95,7 @@
final String name, final String seriesId, final String color) {
if (dataSet.containsSeries(seriesId)) {
LineSeries branchSeries = new LineSeries(name,
color, StackedMode.SEPARATE_LINES, FilledMode.FILLED,
color, StackedMode.SEPARATE_LINES, lineMode,
dataSet.getSeries(seriesId));

model.addSeries(branchSeries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,12 @@ public String getDisplayName(final Metric metric) {
return Messages.Metric_LOC();
case TESTS:
return Messages.Metric_TESTS();
case MCDC_PAIR:
return Messages.Metric_MCDC_PAIR();
case FUNCTION_CALL:
return Messages.Metric_FUNCTION_CALL();
case FUNCTION:
return Messages.Metric_FUNCTION();
default:
throw new NoSuchElementException("No display name found for metric " + metric);
}
Expand Down Expand Up @@ -472,6 +478,12 @@ public String getLabel(final Metric metric) {
return Messages.Metric_Short_LOC();
case TESTS:
return Messages.Metric_Short_TESTS();
case MCDC_PAIR:
return Messages.Metric_Short_MCDC_PAIR();
case FUNCTION_CALL:
return Messages.Metric_Short_FUNCTION_CALL();
case FUNCTION:
return Messages.Metric_Short_FUNCTION();
default:
throw new NoSuchElementException("No label found for metric " + metric);
}
Expand Down Expand Up @@ -527,6 +539,9 @@ public ListBoxModel getMetricItems() {
add(options, Metric.COMPLEXITY_MAXIMUM);
add(options, Metric.LOC);
add(options, Metric.TESTS);
add(options, Metric.MCDC_PAIR);
add(options, Metric.FUNCTION_CALL);
add(options, Metric.FUNCTION);
return options;
}

Expand Down
Loading
Loading