MCPcopy Index your code
hub / github.com/code-pushup/cli / tableSection

Function tableSection

packages/utils/src/lib/reports/formatting.ts:35–58  ·  view source on GitHub ↗
(
  table: Table,
  options?: {
    level?: HeadingLevel;
  },
)

Source from the content-addressed store, hash-verified

33import { compareIssueSeverity } from './utils.js';
34
35export function tableSection(
36 table: Table,
37 options?: {
38 level?: HeadingLevel;
39 },
40): MarkdownDocument | null {
41 if (table.rows.length === 0) {
42 return null;
43 }
44 const { level = AUDIT_DETAILS_HEADING_LEVEL } = options ?? {};
45 const columns = columnsToStringArray(table);
46 const alignments = getColumnAlignments(table);
47 const rows = rowToStringArray(table);
48 return new MarkdownDocument().heading(level, table.title).table(
49 columns.map((heading, i) => {
50 const alignment = alignments[i];
51 if (alignment) {
52 return { heading, alignment };
53 }
54 return heading;
55 }),
56 rows,
57 );
58}
59
60export function treeSection(
61 tree: Tree,

Callers 3

auditDetailsFunction · 0.85

Calls 3

columnsToStringArrayFunction · 0.85
getColumnAlignmentsFunction · 0.85
rowToStringArrayFunction · 0.85

Tested by

no test coverage detected