Function validateAndRun
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async validateAndRun(args) {
let commandOptions = this.parseArgs(args);
// If the `help` option was passed, resolve with `callHelp` to call the `help` command:
if (commandOptions && (commandOptions.options.help || commandOptions.options.h)) {
- Read upRead up
- Create a ticketCreate a ticket
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 validateAndRun
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async validateAndRun(args) {
let commandOptions = this.parseArgs(args);
// If the `help` option was passed, resolve with `callHelp` to call the `help` command:
if (commandOptions && (commandOptions.options.help || commandOptions.options.h)) {
- Create a ticketCreate a ticket
Function parseArgs
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseArgs(commandArgs) {
let knownOpts = {}; // Parse options
let commandOptions = {};
let parsedOptions;
- Create a ticketCreate a ticket
Function assignOption
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
assignOption(option, parsedOptions, commandOptions) {
let isValid = isValidParsedOption(option, parsedOptions[option.name]);
if (isValid) {
if (parsedOptions[option.name] === undefined) {
if (option.default !== undefined) {
- Read upRead up
- Create a ticketCreate a ticket
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 isValidAlias
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function isValidAlias(alias, expectedType) {
let type = typeof alias;
let value, valueType;
if (type === 'string') {
return true;
- Read upRead up
- Create a ticketCreate a ticket
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 parseAlias
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseAlias(option, alias) {
let aliasType = typeof alias;
let key, value, aliasValue;
if (isValidAlias(alias, option.type)) {
- Create a ticketCreate a ticket
Function parseAlias
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
parseAlias(option, alias) {
let aliasType = typeof alias;
let key, value, aliasValue;
if (isValidAlias(alias, option.type)) {
- Read upRead up
- Create a ticketCreate a ticket
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 validateAlias
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
validateAlias(option, alias) {
let key = alias.key;
let value = alias.value;
if (!this.optionsAliases[key]) {
- Read upRead up
- Create a ticketCreate a ticket
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 parseArgs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
parseArgs(commandArgs) {
let knownOpts = {}; // Parse options
let commandOptions = {};
let parsedOptions;
- Read upRead up
- Create a ticketCreate a ticket
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 isValidParsedOption
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function isValidParsedOption(option, parsedOption) {
// option.name didn't parse
if (parsedOption === undefined) {
// no default
if (option.default === undefined) {
- Read upRead up
- Create a ticketCreate a ticket
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"