Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #54 from Sbrenthughes/openSourceCardFix
Browse files Browse the repository at this point in the history
Adds missing violation type
  • Loading branch information
nireeshT authored May 8, 2019
2 parents 620157b + 0b9e18a commit f9f09f5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class OpenSourceViolationsGraphStrategy extends GraphStrategyBase {
}

protected count(seriesElement: MetricTimeSeriesElement): number {
const validSet = new Set(['High', 'Medium', 'Low']);
const validSet = new Set(['Critical', 'High', 'Medium', 'Low']);
return seriesElement.counts
.reduce((sum, item) => validSet.has(item.label['severity']) ? sum + item.value : sum, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export class OpenSourceViolationsPreviewStrategy extends PreviewStrategyBase {
return runningSums.set(count.label['severity'], newCount);
}, new Map());

if (sums.get('High')) {
if (sums.get('Critical')) {
return [{name: 'Critical', value: sums.get('Critical').toLocaleString()}];
}

if (sums.get('High')) {
return [{name: 'High', value: sums.get('High').toLocaleString()}];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {OpenSourceViolationsConfiguration} from '../open-source-violations.confi
@Injectable()
export class OpenSourceViolationsPrimaryMetricStrategy extends PrimaryMetricStrategyBase {
parse(counts: Count[]): MetricValueModel {
const validSet = new Set(['High', 'Medium', 'Low']);
const validSet = new Set(['Critical', 'High', 'Medium', 'Low']);

return {
name: OpenSourceViolationsConfiguration.buildingBlockLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export class OpenSourceViolationsSegmentationStrategy implements Strategy<Metric
];

const rows = [
{name: 'High', order: 1},
{name: 'Medium', order: 2},
{name: 'Low', order: 3}
{name: 'Critical', order: 1},
{name: 'High', order: 2},
{name: 'Medium', order: 3},
{name: 'Low', order: 4}
];

return {
Expand Down

0 comments on commit f9f09f5

Please sign in to comment.