UNPKG

debt-collector

Version:

a nodejs tool to identify, track and mesure technical debt

14 lines (13 loc) 1.26 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { Text, Box } from 'ink'; import Table from '../Table.js'; import { formatResults } from '../../lib/utils/index.js'; export const Results = ({ results, limitTop }) => { const { formatedResult, totalDeptScore, impactedFilesNumber } = formatResults(results.results, limitTop); return (_jsxs(_Fragment, { children: [formatedResult.length > 0 && formatedResult.map((result) => (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { bold: true, color: "red", underline: true, children: result.fileShortPath }), _jsx(Table, { data: result.brokenRules.map(({ ruleTitle, occurences, ruleTotalSore }) => ({ title: ruleTitle, nb: occurences, score: ruleTotalSore, })) }), _jsxs(Text, { bold: true, color: "red", children: ["Total Debt Score: ", result.totalScore] })] }, result.fileShortPath))), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { bold: true, backgroundColor: "#880000", color: "white", children: [' ', "Debt Score: ", totalDeptScore, " / Impacted files: ", impactedFilesNumber] }) })] })); };