Skip to content

Commit 89c6a74

Browse files
committed
feat: SARIF rules include helpUri and rule meta help text
1 parent 9690c11 commit 89c6a74

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils/sarif.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ScanResult } from '../types';
2+
import { RULES } from '../types/rules';
23
import pkg from '../../package.json';
34

45
interface SarifLog {
@@ -14,6 +15,7 @@ export function toSarif(results: ScanResult[], repoRoot: string): SarifLog {
1415
const rulesMap = new Map<string, any>();
1516
const sarifResults = results.map((r) => {
1617
if (!rulesMap.has(r.ruleId)) {
18+
const meta = (RULES as any)[r.ruleId];
1719
rulesMap.set(r.ruleId, {
1820
id: r.ruleId,
1921
name: r.ruleId,
@@ -27,7 +29,8 @@ export function toSarif(results: ScanResult[], repoRoot: string): SarifLog {
2729
defaultConfiguration: {
2830
level: r.type === 'error' ? 'error' : r.type === 'warning' ? 'warning' : 'note',
2931
},
30-
help: { text: r.fix || '' },
32+
help: { text: r.fix || (meta?.fix || '') },
33+
helpUri: meta?.helpUri,
3134
});
3235
}
3336
const level = r.type === 'error' ? 'error' : r.type === 'warning' ? 'warning' : 'note';

0 commit comments

Comments
 (0)