Skip to content

Commit fade15e

Browse files
committed
ML Security Top 10 aggregator check: JavaDoc.
1 parent a69d8b2 commit fade15e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

plugins/carisma.check.mltop10checks/src/carisma/check/mltop10checks/aggregator/MLSecTop10Aggregator.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,26 @@ public boolean perform(Map<String, CheckParameter> parameters, AnalysisHost host
6363
this.host.appendLineToReport("Empty model");
6464
return false;
6565
}
66-
// Package pkg = (Package) currentModel.getContents().get(0);
6766

68-
int id = 1;
69-
for (CarismaCheckWithID check : checks) {
67+
// Perform each check and collect results
68+
for (int i = 0; i < checks.size(); i++) {
7069
this.host.addResultMessage(new AnalysisResultMessage(StatusType.INFO, new String("---- ").repeat(20)));
7170
this.host.addResultMessage(new AnalysisResultMessage(StatusType.INFO,
72-
String.format("ML%1$02d", id++) + ":" + check.getName() + ":"));
73-
results.put(check.getCheckID(), check.perform(this.parameters, this.host));
71+
String.format("ML%1$02d", i + 1) + ":" + checks.get(i).getName() + ":"));
72+
results.put(checks.get(i).getCheckID(), checks.get(i).perform(this.parameters, this.host));
7473
}
7574

7675
// Overall result is successful, if there is no check that returned false.
7776
return !results.containsValue(Boolean.FALSE);
7877
}
7978

79+
/**
80+
* Return the list of all checks that should be included in this aggregator
81+
* check. Order matters, since the order determines the labels (ML01, ML02, ...,
82+
* ML10).
83+
*
84+
* @return List of all checks that should be included in the aggregate report.
85+
*/
8086
private List<CarismaCheckWithID> initializeChecks() {
8187
List<CarismaCheckWithID> checks = new ArrayList<>();
8288
checks.add(new InputManipulationCheck());

0 commit comments

Comments
 (0)