All files / src/highlights report-utils.ts

100% Statements 18/18
80% Branches 4/5
100% Functions 1/1
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25            1x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x 19x  
import { HighlightCodeLineData } from "./highlights-models";
import { ReportIssueCommandData } from "../issue-reporting/commands/report-issue-command";
 
/**
 * Build report data object from highlight for issue reporting
 */
export function buildReportData(
    highlight: HighlightCodeLineData
): ReportIssueCommandData {
    return {
        jobId: highlight.jobId ?? 0,
        filePath: highlight.filePath,
        codeLine: highlight.codeLine,
        sqlIds:
            highlight.sql_ids || (highlight.sql_id ? [highlight.sql_id] : []),
        nodeIds: highlight.node_ids || [],
        displayText: highlight.displayText ?? highlight.text,
        isHotspot: highlight.isHotspot || false,
        severity: highlight.severity,
        queryPrefix: highlight.queryPrefix,
        alertCount: highlight.alertCount || 0,
        findingCount: highlight.findingCount || 0,
    };
}