debt-collector
Version:
a nodejs tool to identify, track and mesure technical debt
18 lines (17 loc) • 1.09 kB
JavaScript
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 function ResultsFileOnly({ results, limitTop }) {
const { formatedResult, totalDeptScore, impactedFilesNumber } = formatResults(results.results, limitTop);
let displayResults = formatedResult;
if (limitTop) {
displayResults = formatedResult
.sort((a, b) => b.totalScore - a.totalScore)
.filter((_item, index) => index < limitTop);
}
return (_jsxs(_Fragment, { children: [_jsx(Box, { marginTop: 1 }), formatedResult.length > 0 && (_jsx(Table, { data: displayResults.map(({ fileShortPath, totalScore }) => ({
file: fileShortPath,
score: totalScore,
})) })), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { bold: true, backgroundColor: "#880000", color: "white", children: [' ', "Debt Score: ", totalDeptScore, " / Impacted files: ", impactedFilesNumber] }) })] }));
}