Function getCommands
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function getCommands(cfg) {
const cmds = { ...cfg.commands };
let commands = Object.entries(cmds);
let rootCmd = null;
- 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 findMatchCommand
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function findMatchCommand(entries, meta) {
const match = entries.find(([name, cmd]) => {
if (cmd.isYaroCommand) {
let matched = 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 yaroCreateCli
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function yaroCreateCli(argv, config) {
const cfg = Array.isArray(argv) ? { argv, ...config } : { argv: [], ...argv };
if (cfg.buildOutput && typeof cfg.buildOutput !== 'function') {
throw new TypeError('option `buildOutput` should be function when given');
Function yaroCreateCli
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async function yaroCreateCli(argv, config) {
const cfg = Array.isArray(argv) ? { argv, ...config } : { argv: [], ...argv };
if (cfg.buildOutput && typeof cfg.buildOutput !== 'function') {
throw new TypeError('option `buildOutput` should be function when given');
- 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 getCommands
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getCommands(cfg) {
const cmds = { ...cfg.commands };
let commands = Object.entries(cmds);
let rootCmd = null;
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 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 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 getCliInfo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getCliInfo(rootCommand, commands, cfg) {
const version = cfg.version || '0.0.0';
if (rootCommand && rootCommand.cli) {
const { name, usage } = rootCommand.cli;
- 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;
Avoid too many return
statements within this function. Open
return;