Showing 6 of 16 total issues
Function details
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function details(analysis, options) {
const sorted = Array.from(analysis.packages).sort((a, b) => b.size - a.size);
const trunc = options.top !== undefined && sorted.length > options.top;
if (trunc) {
Function showTable
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function showTable(table, columns, title, baseline, analysis, options, top) {
if (analysis.packages.length === 0) {
return;
}
Function showTable_
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function showTable_(table, columns, dup, analysis, options) {
utils.appendRow(table, columns, {
label: red('PACKAGE'),
size: red('SIZE'),
pct: red('%SIZE'),
Function normalizeSpecs_
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function normalizeSpecs_(specs) {
let normalized = [];
for (const spec of specs) {
if (spec.name.startsWith('_')) {
const name = spec.name.slice(1);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function showTable
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function showTable(table, columns, title, baseline, analysis, options, top) {
Function showTable_
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function showTable_(table, columns, dup, analysis, options) {