UserInput
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class UserInput {
constructor(description) {
this.description = description;
this.config = {
args: [],
Function _parseArgs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_parseArgs(args) {
const result = {};
const multiple = this.config.multiple;
if (multiple) {
- 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 _handleArgs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_handleArgs() {
const args = this._rewriteArgs(process.argv.slice(2));
if (args.find((i) => i === SHORTCUT + "h" || i === OPTION + "help")) {
this._logUsageThenExit(0);
return {};
- 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 logUsage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
logUsage() {
const multiple = this.config.multiple;
let argNames = this.config.args
.map((arg) => (arg.default === undefined ? arg.name : `[${arg.name}]`))
.join(" ");
- 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 _rewriteArgs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_rewriteArgs(source) {
const args = [];
for (const arg of source) {
if (arg.startsWith(SHORTCUT) && !arg.startsWith(OPTION)) {
for (const char of arg.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 _parseOption
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_parseOption(result, token) {
const option = parseOption(token);
const display = OPTION + option.name;
if (option.name in result) {
throw new Error(`Option ${display} has already been set`);
- 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 parseValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function parseValue(type, name, value) {
let _value = value;
if (!_value) {
throw new Error(`${name} value is not set`);
}
- 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"