Showing 9 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
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
export class DuplicateNameError extends OrbitalError { constructor(name: string) { const message = `CLI modules defines two commands with conflicting names: [${name}]`; super(message); }
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
export class MetadataError extends OrbitalError { constructor(commandName: string) { const message = `There has been an error parsing metadata on command: '${commandName}.`; super(message); }
- Read upRead up
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
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
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
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