teableio/teable

View on GitHub
packages/core/src/formula/parser/Formula.ts

Summary

Maintainability
F
5 days
Test Coverage

File Formula.ts has 1072 lines of code (exceeds 300 allowed). Consider refactoring.
Open

// Generated from src/formula/parser/Formula.g4 by ANTLR 4.9.0-SNAPSHOT


import { ATN } from "antlr4ts/atn/ATN";
import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer";
Severity: Major
Found in packages/core/src/formula/parser/Formula.ts - About 2 days to fix

    Function expr has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
    Open

        public expr(_p?: number): ExprContext {
            if (_p === undefined) {
                _p = 0;
            }
    
    
    Severity: Minor
    Found in packages/core/src/formula/parser/Formula.ts - About 2 days 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 expr has 346 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

        public expr(_p?: number): ExprContext {
            if (_p === undefined) {
                _p = 0;
            }
    
    
    Severity: Major
    Found in packages/core/src/formula/parser/Formula.ts - About 2 hrs to fix

      Function ws_or_comment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public ws_or_comment(): Ws_or_commentContext {
              let _localctx: Ws_or_commentContext = new Ws_or_commentContext(this._ctx, this.state);
              this.enterRule(_localctx, 4, Formula.RULE_ws_or_comment);
              let _la: number;
              try {
      Severity: Minor
      Found in packages/core/src/formula/parser/Formula.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

      Function identifier has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public identifier(): IdentifierContext {
              let _localctx: IdentifierContext = new IdentifierContext(this._ctx, this.state);
              this.enterRule(_localctx, 12, Formula.RULE_identifier);
              let _la: number;
              try {
      Severity: Minor
      Found in packages/core/src/formula/parser/Formula.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 (this._input.LA(1) === Token.EOF) {
                                      this.matchedEOF = true;
                                  }
      Severity: Major
      Found in packages/core/src/formula/parser/Formula.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (this._input.LA(1) === Token.EOF) {
                                        this.matchedEOF = true;
                                    }
        Severity: Major
        Found in packages/core/src/formula/parser/Formula.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (this._input.LA(1) === Token.EOF) {
                                          this.matchedEOF = true;
                                      }
          Severity: Major
          Found in packages/core/src/formula/parser/Formula.ts - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (this._input.LA(1) === Token.EOF) {
                                            this.matchedEOF = true;
                                        }
            Severity: Major
            Found in packages/core/src/formula/parser/Formula.ts - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status