SnareChops/SQiggL

View on GitHub

Showing 23 of 35 total issues

Function invoke has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    public invoke(input: string): DSLVariable{
        let currentType: DSLVariableType = DSLVariableType.key,
            original: string = input,
            idx: number = 0,
            startIdx: number = 0,
Severity: Minor
Found in src/lexers/variable.lexer.ts - About 7 hrs 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 invoke has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    public invoke(parts: string[]): DSLExpression{
        let dsl: DSLExpression = {literal: this.craftLiteralFromParts(parts), expression: null},
            expression: Expression,
            pidx: number,
            eidx: number,
Severity: Minor
Found in src/lexers/expression.lexer.ts - About 7 hrs 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 invoke has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public invoke(parts: string[]): DSLExpression{
        let dsl: DSLExpression = {literal: this.craftLiteralFromParts(parts), expression: null},
            expression: Expression,
            pidx: number,
            eidx: number,
Severity: Major
Found in src/lexers/expression.lexer.ts - About 3 hrs to fix

Function invoke has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public invoke<T extends DSLExpressionTree>(parts: string[]): T{
        let dsl: T = <any>{},
            idx: number = 0,
            singleExpressionParts: string[];
        while(idx < parts.length){
Severity: Minor
Found in src/lexers/expression.tree.lexer.ts - About 2 hrs 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 invoke has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public invoke(input: string): DSLVariable{
        let currentType: DSLVariableType = DSLVariableType.key,
            original: string = input,
            idx: number = 0,
            startIdx: number = 0,
Severity: Major
Found in src/lexers/variable.lexer.ts - About 2 hrs to fix

Function levelDSL has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private levelDSL(dsls: DSL[]): LeveledDSL[]{
        let currentLevel: number = 0,
            levels: LeveledDSL[] = [],
            dsl: DSL;
        for(dsl of dsls){
Severity: Minor
Found in src/lexer.ts - About 2 hrs 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 identify has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private identify(input: string): DSL[]{
        let currentType: DSLType = DSLType.text,
            idx: number = 0,
            startIdx: number = 0,
            dsl: DSL[] = [];
Severity: Minor
Found in src/lexer.ts - About 2 hrs 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 parse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public parse(dsl: DSL[], variables: ScopedVariables = {}): string{
        let output: string = '', idx: number;
        for(idx=0; idx < dsl.length; idx++){
            if(dsl[idx].variable) variables = this.resolveVariable(dsl[idx].variable, variables);
            if(dsl[idx].command && !!(<DependentAction | StartingAction>dsl[idx].command.action).rule){
Severity: Minor
Found in src/parser.ts - About 1 hr 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 identify has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private identify(input: string): DSL[]{
        let currentType: DSLType = DSLType.text,
            idx: number = 0,
            startIdx: number = 0,
            dsl: DSL[] = [];
Severity: Minor
Found in src/lexer.ts - About 1 hr to fix

Function compareOrderedModifier has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private compareOrderedModifier(part: string, ePart: OrderedModifier[]): [string, OrderedModifier] {
        let ord: OrderedModifier,
            key: string,
            identifier: string;
        for(ord of ePart){
Severity: Minor
Found in src/lexers/expression.lexer.ts - About 1 hr 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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public parse(dsl: DSLCommand, scope: DSL[], variables: ScopedVariables):string {
        const action: StartingAction | DependentAction | IterableAction = <StartingAction | DependentAction | IterableAction>dsl.action;
        let expressionResult: ExpressionResult,
            result: string;
        if(!!action.rule){
Severity: Minor
Found in src/parsers/command.parser.ts - About 55 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

Avoid deeply nested control flow statements.
Open

                    if(clone[pidx] === SPACE && Array.isArray(expression.template[eidx-1])){
                        /* Rule: M2 */
                        clone.splice(pidx, 1);
                    }
Severity: Major
Found in src/lexers/expression.lexer.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if(!dsl.branches) dsl.branches = [];
Severity: Major
Found in src/lexers/expression.tree.lexer.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if(!foundIdentifier) {/* Rule: M1 */
                        eidx++;
                        continue;
                    }
Severity: Major
Found in src/lexers/expression.lexer.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if(ePart !== (<string>clone[pidx]).slice(0, ePart.length)){
                        /* Rule: O2 */
                        isMatch = false;
                        break;
                    }
Severity: Major
Found in src/lexers/expression.lexer.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if((<string>clone[pidx]).length === foundIdentifier.length) {
                        /* Rule: M3 */
                        clone.splice(pidx, 1);
                    } else {
                        /* Rule: M3 */
Severity: Major
Found in src/lexers/expression.lexer.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if(ePart.length !== (<string>clone[pidx]).length){
                        /* Rule: O3 */
                        clone.splice(pidx, 1, (<string>clone[pidx]).slice(ePart.length, (<string>clone[pidx]).length));
                    } else {
                        /* Rule: O5 */
Severity: Major
Found in src/lexers/expression.lexer.ts - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if(!dsl.conjunctions) dsl.conjunctions = [];
Severity: Major
Found in src/lexers/expression.tree.lexer.ts - About 45 mins to fix

Function parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public parse(dsl: DSLReplacement, variables?: ScopedVariables): string{
        let output: string | boolean,
            result: ExpressionResult;
        if(!!dsl.expressions) {
            result = new ExpressionTreeParser(this.options).parse(dsl.expressions, variables);
Severity: Minor
Found in src/parsers/replacement.parser.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 extractString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private extractString(input: string, start: number, stringChar: string): string{
        let idx: number = start + 1;
        while(idx < input.length){
            switch(input[idx]){
                case this.options.stringEscapeChar:
Severity: Minor
Found in src/lexer.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

Severity
Category
Status
Source
Language