Skip to content

Commit

Permalink
Run linter
Browse files Browse the repository at this point in the history
Signed-off-by: Joyce Quach <[email protected]>
  • Loading branch information
jtquach1 committed Sep 27, 2024
1 parent afa0693 commit e2a348a
Show file tree
Hide file tree
Showing 37 changed files with 1,274 additions and 1,272 deletions.
30 changes: 15 additions & 15 deletions src/commands/convert/anchoregrype2hdf.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Command, Flags} from '@oclif/core';
import fs from 'fs';
import {AnchoreGrypeMapper as Mapper} from '@mitre/hdf-converters';
import {checkInput, checkSuffix} from '../../utils/global';
import {Command, Flags} from '@oclif/core'
import fs from 'fs'
import {AnchoreGrypeMapper as Mapper} from '@mitre/hdf-converters'
import {checkInput, checkSuffix} from '../../utils/global'

export default class AnchoreGrype2HDF extends Command {
static readonly usage =
Expand All @@ -11,37 +11,37 @@ export default class AnchoreGrype2HDF extends Command {
'Translate a Anchore Grype output file into an HDF results set';

static readonly examples = [
'saf convert anchoregrype2hdf -i anchoregrype.json -o output-hdf-name.json'
'saf convert anchoregrype2hdf -i anchoregrype.json -o output-hdf-name.json',
];

static readonly flags = {
help: Flags.help({char: 'h'}),
input: Flags.string({
char: 'i',
required: true,
description: 'Input Anchore Grype file'
description: 'Input Anchore Grype file',
}),
output: Flags.string({
char: 'o',
required: true,
description: 'Output HDF file'
description: 'Output HDF file',
}),
'with-raw': Flags.boolean({char: 'w', required: false})
'with-raw': Flags.boolean({char: 'w', required: false}),
};

async run() {
const {flags} = await this.parse(AnchoreGrype2HDF);
const input = fs.readFileSync(flags.input, 'utf8');
const {flags} = await this.parse(AnchoreGrype2HDF)
const input = fs.readFileSync(flags.input, 'utf8')
checkInput(
{data: input, filename: flags.input},
'grype',
'Anchore Grype JSON results file'
);
'Anchore Grype JSON results file',
)

const converter = new Mapper(input, flags['with-raw']);
const converter = new Mapper(input, flags['with-raw'])
fs.writeFileSync(
checkSuffix(flags.output),
JSON.stringify(converter.toHdf(), null, 2)
);
JSON.stringify(converter.toHdf(), null, 2),
)
}
}
Loading

0 comments on commit e2a348a

Please sign in to comment.