Showing 27 of 178 total issues
Function main
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function main(argv) {
const {command, options, isDefault} = parse(argv.slice(2));
const globals = {
tasks: undefined,
Function subroutine
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function subroutine({scripts, deps, files, config, lintConfig}) {
return {
async postcondition({readPkg, read, assert}) {
const pkgjson = await readPkg();
const devDeps = pkg.devDeps(pkgjson);
- 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 subroutine
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function subroutine({scripts, deps, files, config}) {
return {
async postcondition({readPkg, exists, assert}) {
const pkgjson = await readPkg();
const devDeps = pkg.devDeps(pkgjson);
- 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 apply
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export async function apply({readPkg, writePkg, upgrade, install}) {
// Update package.json
await update({
read: readPkg,
write: writePkg,
- 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 fixedOrder
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
(sortToTop, key = (x) => x) =>
(a, b) => {
const ka = key(a);
const kb = key(b);
if (ka === kb) return 0;
- 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 filter
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
(resolveFromFile, resolveRequire) =>
(node, {is, n}) => {
if (is(node, n.ImportDeclaration) || is(node, n.ExportAllDeclaration)) {
if (!is(node.source, n.Literal)) return false;
const source = node.source.value;
- 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 main
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function main(argv) {
const {command, options, isDefault} = parse(argv.slice(2));
const globals = {
tasks: undefined,
- 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 filter
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
(resolveRequire) =>
(node, {is, n}) => {
if (is(node, n.ImportDeclaration) || is(node, n.ExportAllDeclaration)) {
if (!is(node.source, n.Literal)) return false;
const source = node.source.value;
- 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 checkStatus
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkStatus(status, options, globals) {
globals.debug({status});
const {tracking, current, behind} = status;
if (!current) throw new Error('No current branch');
if (!tracking) throw new Error('Not tracking any remote branch');
Function edit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
edit(pkgjson) {
const {scripts} = pkgjson;
scripts.test = 'npm run test:src';
scripts['test-cmd'] = 'NODE_LOADER_CONFIG=test/loader/config.js ava';
scripts['test:cjs'] =
Function whole
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const whole = (current, [pattern, replacement]) => {
if (pattern instanceof RegExp) {
const regexp = new RegExp('^' + pattern.source + '$', pattern.flags);
return current.replace(regexp, replacement);
}
- 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 checkStatus
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function checkStatus(status, options, globals) {
globals.debug({status});
const {tracking, current, behind} = status;
if (!current) throw new Error('No current branch');
if (!tracking) throw new Error('Not tracking any remote branch');
- 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 updateScripts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function updateScripts({scripts}) {
return {
async postcondition({readPkg, assert}) {
const pkgjson = await readPkg();
for (const [script, {newDefinition}] of Object.entries(scripts)) {
- 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 replaceOne
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function replaceOne(operations, path, {lines, write, method}) {
const buffer = [];
let changed = false;
for await (const line of lines(path)) {
const replacedLine = reduce(method, operations, line);
- 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
Avoid too many return
statements within this function. Open
return (
object.name === 'testlink' &&
property.name === 'href' &&
operator === '=' &&
right.value !== newValue(right.value)
Avoid too many return
statements within this function. Open
return na < nb ? -1 : 1;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return (
is(callee, n.MemberExpression) &&
callee.object.name === 'document' &&
callee.property.name === 'querySelectorAll'
);
Avoid too many return
statements within this function. Open
return false;