orbital-js/orbital

View on GitHub

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');

Severity: Minor
Found in packages/core/src/command/command-mapper.ts - About 1 hr to fix

    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');
    
    
    Severity: Minor
    Found in packages/core/src/command/command-mapper.ts - About 45 mins to fix

    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;
    Severity: Minor
    Found in packages/core/src/command/command-resolver.ts - About 45 mins to fix

    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];
    Severity: Minor
    Found in packages/core/src/command/command-executor.ts - About 35 mins to fix

    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
    Severity: Minor
    Found in packages/core/src/orbital-factory.ts - About 35 mins to fix

    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) {
    Severity: Minor
    Found in packages/core/src/command/command-executor.ts - About 25 mins to fix

    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
    Severity: Minor
    Found in packages/core/src/help/util.ts - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language