Skip to content

Commit

Permalink
Merge pull request #134 from jenkinsci/dependabot/maven/edu.hm.hafner…
Browse files Browse the repository at this point in the history
…-codingstyle-pom-5.4.0

Bump edu.hm.hafner:codingstyle-pom from 5.3.0 to 5.4.0
  • Loading branch information
uhafner authored Nov 12, 2024
2 parents 6e1ef5a + 8de78f0 commit aea4bae
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
51 changes: 46 additions & 5 deletions .github/workflows/quality-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,35 +137,76 @@ jobs:
]
}
],
"metrics": [
"metrics":
{
"name": "Toplevel Metrics",
"tools": [
{
"name": "Cyclomatic Complexity",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "CyclomaticComplexity"
"metric": "CYCLOMATIC_COMPLEXITY"
},
{
"name": "Cognitive Complexity",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "CognitiveComplexity"
"metric": "COGNITIVE_COMPLEXITY"
},
{
"name": "Lines of Code",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "LOC"
},
{
"name": "Non Commenting Source Statements",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "NCSS"
},
{
"name": "Access to foreign data",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "ACCESS_TO_FOREIGN_DATA"
},
{
"name": "Class cohesion",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "COHESION"
},
{
"name": "Fan out",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "FAN_OUT"
},
{
"name": "Number of accessors",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "NUMBER_OF_ACCESSORS"
},
{
"name": "Weight of a class",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "WEIGHT_OF_CLASS"
},
{
"name": "Weighted method count",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "WEIGHED_METHOD_COUNT"
},
{
"name": "N-Path Complexity",
"id": "metrics",
"pattern": "**/metrics/pmd.xml",
"metric": "NPathComplexity"
"metric": "NPATH_COMPLEXITY"
}
]
}
]
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>edu.hm.hafner</groupId>
<artifactId>codingstyle-pom</artifactId>
<version>5.3.0</version>
<version>5.4.0</version>
<relativePath />
</parent>

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/edu/hm/hafner/coverage/Metric.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,22 +371,22 @@ public boolean isAggregatingChildren() {

@Override
final Optional<Value> computeDerivedValue(final Node node, final Metric searchMetric) {
var defaultValue = getDefaultValue(node, searchMetric);
var defaultValue = getDefaultValue(node);

return defaultValue.or(() -> node.getChildren().stream()
.map(n -> compute(n, searchMetric))
.flatMap(Optional::stream)
.reduce(accumulator));
}

protected Optional<Value> getDefaultValue(final Node node, final Metric searchMetric) {
protected Optional<Value> getDefaultValue(final Node node) {
return Optional.empty();
}
}

private static class LocEvaluator extends ValuesAggregator {
@Override
protected Optional<Value> getDefaultValue(final Node node, final Metric searchMetric) {
protected Optional<Value> getDefaultValue(final Node node) {
return LINE.getValueFor(node).map(this::getTotal);
}

Expand Down

0 comments on commit aea4bae

Please sign in to comment.