Skip to content

Commit

Permalink
feat(web-app-template): Implement severe thresholds in the model
Browse files Browse the repository at this point in the history
In preparation for an upcoming change in which columns will
be filtered based on issue and rule violation thresholds.

Signed-off-by: Thomas Steenbergen <[email protected]>
  • Loading branch information
tsteenbe committed Jan 30, 2025
1 parent 436937e commit fad2c87
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/reporters/web-app-template/src/models/IssueStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class IssueStatistics {

#hints = 0;

#severe = 0;

#warnings = 0;

constructor(obj) {
Expand All @@ -34,6 +36,10 @@ class IssueStatistics {
this.#hints = obj.hints;
}

if (obj.severe !== null) {
this.#severe = obj.severe;
}

if (obj.warnings !== null) {
this.#warnings = obj.warnings;
}
Expand All @@ -48,6 +54,10 @@ class IssueStatistics {
return this.#hints;
}

get severe() {
return this.#severe;
}

get warnings() {
return this.#warnings;
}
Expand Down
22 changes: 22 additions & 0 deletions plugins/reporters/web-app-template/src/models/WebAppOrtResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ class WebAppOrtResult {

#scopesByNameMap = new Map();

#severeIssueThreshold = 'WARNING';

#severeRuleViolationThreshold = 'WARNING';

#statistics = {};

#repository;
Expand Down Expand Up @@ -222,6 +226,16 @@ class WebAppOrtResult {
}
}

if (obj.severe_issue_threshold || obj.severeIssueThreshold) {
this.#severeIssueThreshold = obj.severe_issue_threshold
|| obj.severeIssueThreshold;
}

if (obj.severe_rule_violation_threshold || obj.severeRuleViolationThreshold) {
this.#severeRuleViolationThreshold = obj.severe_rule_violation_threshold
|| obj.severeRuleViolationThreshold;
}

if (obj.statistics) {
const { statistics } = obj;
this.#statistics = new Statistics(statistics);
Expand Down Expand Up @@ -483,6 +497,14 @@ class WebAppOrtResult {
return this.#scopes;
}

get severeIssueThreshold() {
return this.#severeIssueThreshold;
}

get severeRuleViolationThreshold() {
return this.#severeRuleViolationThreshold;
}

get statistics() {
return this.#statistics;
}
Expand Down

0 comments on commit fad2c87

Please sign in to comment.