Skip to content

Commit 29b2fdb

Browse files
committedAug 24, 2022
fix: Spacing for issue descriptions with custom rules
1 parent 42d4720 commit 29b2fdb

File tree

2 files changed

+8
-6
lines changed
  • src/lib/formatters/iac-output/v2/issues-list
  • test/jest/acceptance/iac/output-formats

2 files changed

+8
-6
lines changed
 

‎src/lib/formatters/iac-output/v2/issues-list/issue.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,18 @@ function formatProperties(
7777
? result.issue.remediation[remediationKey]
7878
: result.issue.resolve,
7979
],
80-
].filter(([, val]) => !!val) as [string, string][];
80+
];
8181

8282
const maxPropertyNameLength = Math.max(
8383
...properties.map(([key]) => key.length),
8484
);
8585

86-
return properties.map(
87-
([key, value]) =>
88-
`${key}: ${' '.repeat(maxPropertyNameLength - key.length)}${value}`,
89-
);
86+
return properties
87+
.filter(([, val]) => !!val)
88+
.map(
89+
([key, value]) =>
90+
`${key}: ${' '.repeat(maxPropertyNameLength - key.length)}${value}`,
91+
);
9092
}
9193

9294
function isValidLineNumber(lineNumber: number | undefined): boolean {

‎test/jest/acceptance/iac/output-formats/text.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ Target file: ${dirPath}/`);
275275
`snyk iac test ${filePath} --rules=./iac/custom-rules/custom.tar.gz`,
276276
);
277277

278-
expect(stdout).toContain(`Rule: custom rule CUSTOM-1`);
278+
expect(stdout).toContain(`Rule: custom rule CUSTOM-1`);
279279
});
280280
});
281281
});

0 commit comments

Comments
 (0)
Please sign in to comment.