Skip to content

Commit

Permalink
Mapper tweaks (#6054)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles Hu <[email protected]>
  • Loading branch information
charleshu-8 authored Aug 7, 2024
1 parent 6a22b39 commit ae5d4a4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions libs/hdf-converters/src/twistlock-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ export class TwistlockResults {
constructor(twistlockJson: string, withRaw = false) {
this.data = JSON.parse(twistlockJson);
this.withRaw = withRaw;
}

toHdf(): ExecJSON.Execution {
// Add a wrapper to the data for the repository scan case which doesn't include the `results` key
if (!_.has(this.data, 'results')) {
this.data = {results: [this.data]};
}
}

toHdf(): ExecJSON.Execution {
return new TwistlockMapper(this.data, this.withRaw).toHdf();
}
}
Expand Down Expand Up @@ -107,9 +109,8 @@ export class TwistlockMapper extends BaseConverter {
transformer: impactMapping(IMPACT_MAPPING)
},
code: {
transformer: (vulnerability: Record<string, unknown>): string => {
return JSON.stringify(vulnerability, null, 2);
}
transformer: (vulnerability: Record<string, unknown>): string =>
JSON.stringify(vulnerability, null, 2)
},
results: [
{
Expand Down

0 comments on commit ae5d4a4

Please sign in to comment.