Skip to content

Commit

Permalink
feat: move sarif builder outside of for-loop + linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcarman committed May 7, 2024
1 parent 9163b7f commit 9ed8e23
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/commands/metalint/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export default class MetalintRun extends SfCommand<MetalintRunResult> {
});
sarifRunBuilder.addRule(sarifRuleBuilder);

for (const field of fieldsWithoutDescriptions) {
const sarifResultBuilder = new SarifResultBuilder();
const sarifResultBuilder = new SarifResultBuilder();

for (const field of fieldsWithoutDescriptions) {
// let path = process.env.SARIF_URI_ABSOLUTE ? pathToFileURL(field) : path.relative(process.cwd(), field).replace(/\\/g, '/') as const

const sarifResultInit = {
Expand All @@ -70,13 +70,13 @@ export default class MetalintRun extends SfCommand<MetalintRunResult> {

sarifResultBuilder.initSimple(sarifResultInit);
sarifRunBuilder.addResult(sarifResultBuilder);

sarifBuilder.addRun(sarifRunBuilder);
const sarifResults = sarifBuilder.buildSarifJsonString({ indent: false });
// eslint-disable-next-line no-console
console.log(sarifResults);
}

sarifBuilder.addRun(sarifRunBuilder);
const sarifResults = sarifBuilder.buildSarifJsonString({ indent: false });
// eslint-disable-next-line no-console
console.log(sarifResults);

return { outcome: 'Complete' };
}
}

0 comments on commit 9ed8e23

Please sign in to comment.