Function fn
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
fn() {
const thisPackage = utils.readJson("./package.json");
const recordPath = params.dest || "./logs/webpack-size.json";
/** @type {Record<TVersionString, { webpack?: number; umd?: number}>} */
const sizeRecord = fs.existsSync(recordPath)? utils.readJson(recordPath): {};
- 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 processSources
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function processSources(
taskName,
process, {
base = "./build", bases,
test = /\.js$/,
- 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
File tools.js
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env node
/*!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Copyright (C) 2019 jeffy-g <hirotom1107@gmail.com>
Released under the MIT license
Function fn
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn() {
const thisPackage = utils.readJson("./package.json");
const recordPath = params.dest || "./logs/webpack-size.json";
/** @type {Record<TVersionString, { webpack?: number; umd?: number}>} */
const sizeRecord = fs.existsSync(recordPath)? utils.readJson(recordPath): {};
Function fn
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn: () => {
let {
major, minor/*, patch*/,
pkgJsons = ["./package.json"]
} = params;
Consider simplifying this complex logical expression. Open
if (
(prevEntry.webpack && entry.webpack) && (prevEntry.webpack ^ entry.webpack) ||
(prevEntry.umd && entry.umd) && (prevEntry.umd ^ entry.umd)
) {
sizeRecord[versionStr] = entry;
Function fn
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
fn: () => {
processSources(
"[comment trick toggle]", (data) => {
return data.replace(/\/+(?=\*\s?(comment-toggle-trick|https:\/\/coderwall))/g, $0 => {
const slashes = $0.length === 2? "/": "//";
- 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"