Showing 108 of 164 total issues
Function initServer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function initServer() {
const server = createServer(async (req, res) => {
if (req.url === '/' && req.method.toLowerCase() === 'post') {
// parse a file upload
// `upload` does nothing now, could be used with `createTemporary*`
- 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 testResults
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const testResults = await new Promise((resolve) => {
proc
.then(() => {
resolve(
pass({
Function parseFunction
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function parseFunction(opts = {}) {
const plugins = [];
const app = {
/**
* > Parse a given `code` and returns a `result` object
Function initServer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initServer() {
const server = createServer(async (req, res) => {
if (req.url === '/' && req.method.toLowerCase() === 'post') {
// parse a file upload
// `upload` does nothing now, could be used with `createTemporary*`
Function commandAction
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function commandAction(parsedFlags, ...argz) {
const argv = pipeline(
// run parser only if when we are given process.argv array
Array.isArray(parsedFlags) && parser(),
aliases(cli.meta.aliases), // aliases always first
Function findMatchCommand
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findMatchCommand(entries, meta) {
const match = entries.find(([name, cmd]) => {
if (cmd.isYaroCommand) {
let matched = false;
Function jestCov
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
.reduce((acc, file) => {
let value = files[file];
const [monoDir, ws, folderName] = file.split('/');
Function exports
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = utils.errorBase('UsefulError', function (message, options) {
if (typeof message === 'object') {
options = message;
message = false;
}
- 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 packageJson
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default async function packageJson(packageName, endpoint) {
const { name, version } = parsePkgName(packageName);
const tag = version === '' ? 'latest' : version;
const uri =
typeof endpoint === 'function'
- 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 stringToHeader
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function stringToHeader(val, options) {
const opts = { caseSensitive: false, ...options };
/* eslint-disable unicorn/no-unsafe-regex */
const defaultRegex = opts.caseSensitive
Function tryCatch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function tryCatch(code, meta, fn) {
let result = null;
try {
result = await fn(meta.argv);
} catch (err) {
Function each
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function each(items, mapper, options = {}) {
if (typeof mapper !== 'function') {
options = mapper;
mapper = (x) => x;
}
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = utils.errorBase('UsefulError', function (message, options) {
if (typeof message === 'object') {
options = message;
message = false;
}
Consider simplifying this complex logical expression. Open
if (err && has && !err.cmdUsage) {
const isRootFailed = /ROOT_COMMAND_FAILED/.test(err.code);
const cmdErr = err.meta.matchedCommand?.cli || meta.cliInfo;
cmdErr.usage = cmdErr.usage.trim();
Function stringToHeader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function stringToHeader(val, options) {
const opts = { caseSensitive: false, ...options };
/* eslint-disable unicorn/no-unsafe-regex */
const defaultRegex = opts.caseSensitive
- 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 parseFunction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function parseFunction(opts = {}) {
const plugins = [];
const app = {
/**
* > Parse a given `code` and returns a `result` object
- 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 stringifyGithubShortUrl
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function stringifyGithubShortUrl(owner, name, branch, npm) {
if (owner && typeof owner === 'object') {
const params = owner;
owner = params.owner || params.user;
name = params.name || params.repo;
- 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 tryCatch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async function tryCatch(code, meta, fn) {
let result = null;
try {
result = await fn(meta.argv);
} catch (err) {
- 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 testCoverage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function testCoverage(rootDir, testCovPath) {
const {
packageJsonPath,
packageJson: pkg,
isMonorepo: isMono,
- 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 ipFilter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function ipFilter(ip, patterns, options) {
if (typeof ip !== 'string') {
throw new TypeError('ip-filter: expect `ip` to be a string');
}
- 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"