Showing 7 of 9 total issues
Function createInstanceOfCommand
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private createInstanceOfCommand(command: any): CommandInstance {
const commandInstance = new command();
const commandMetadata: CommandMetadata = getClassMetadata(command);
const paramTypes = getParamTypes(commandInstance, 'execute');
Function createInstanceOfCommand
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private createInstanceOfCommand(command: any): CommandInstance {
const commandInstance = new command();
const commandMetadata: CommandMetadata = getClassMetadata(command);
const paramTypes = getParamTypes(commandInstance, 'execute');
- 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 findCommand
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public findCommand(args: ParsedArgs)
: { command: CommandInstance, depth: number } {
let command: CommandInstance | null = null;
let commands = this.commands;
let subcommands = this.subcommands;
- 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 getParameters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static getParameters(command: CommandInstance, args: ParsedArgs, depth: number) {
const parameters = [];
if (command.params) {
for (const param of command.params) {
const argument = args.arguments[param.index + depth];
- 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 tryRunCommand
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static tryRunCommand(input: ParsedArgs, commandInstances: MappedCommands) {
let hasRun = true;
try {
/**
* FIXME: this behavior is wrong, atleast until we have custom compiler
- 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 injectOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static injectOptions(command: CommandInstance, args: ParsedArgs): void {
for (const opt in command.options) {
const option = command.options[opt];
const value = this.getOption(option, args);
if (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 generateOptionDocs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function generateOptionDocs(options: { [prop: string]: ModifiedOptionMetadata }): string {
let str = '';
for (const option in options) {
const opt = options[option];
str += chalk.blue('--' + opt.name) + s
- 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"