benmarch/spel2js

View on GitHub

Showing 95 of 95 total issues

Function createNode has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createNode(position, expressionComponents) {
    var node = SpelNode.create.apply(null, ['compound', position].concat(expressionComponents));

    function buildContextStack(state) {
        var childrenCount = node.getChildren().length,
Severity: Minor
Found in src/ast/CompoundExpression.js - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        function pushRealToken(data, isFloat, start, end) {
            if (isFloat) {
                tokens.push(new Token(TokenKind.LITERAL_REAL_FLOAT, data, start, end));
            }
            else {
    Severity: Major
    Found in src/Tokenizer.js and 1 other location - About 1 hr to fix
    src/Tokenizer.js on lines 473..480

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        function pushIntToken(data, isLong, start, end) {
            if (isLong) {
                tokens.push(new Token(TokenKind.LITERAL_LONG, data, start, end));
            }
            else {
    Severity: Major
    Found in src/Tokenizer.js and 1 other location - About 1 hr to fix
    src/Tokenizer.js on lines 505..512

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function selectFromMap has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function selectFromMap(collection, whichElement, expr, state) {
        var newCollection = {},
            entry,
            key,
            entries = [],
    Severity: Minor
    Found in src/ast/Selection.js - About 1 hr to fix

      Function eatRelationalExpression has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function eatRelationalExpression() {
              var expr = eatSumExpression();
              var relationalOperatorToken = maybeEatRelationalOperator();
              if (relationalOperatorToken !== null) {
                  var token = nextToken();  // consume relational operator token
      Severity: Minor
      Found in src/SpelExpressionParser.js - About 1 hr to fix

        Function createNode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

         function createNode(position, dimensions, nodes) {
            var isArray = nodes !== undefined;
            var dimension;
            if (isArray) {
                dimension = dimensions.length && dimensions[0] && dimensions[0].getType() === 'number' ? dimensions[0].getValue() : null;
        Severity: Minor
        Found in src/ast/ConstructorReference.js - About 1 hr to fix

          Function eatExpression has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function eatExpression() {
                  var expr = eatLogicalOrExpression();
                  if (moreTokens()) {
                      var token = peekToken();
                      if (token.getKind() === TokenKind.ASSIGN) {  // a=b
          Severity: Minor
          Found in src/SpelExpressionParser.js - About 1 hr to fix

            Function maybeEatConstructorReference has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function maybeEatConstructorReference() {
                    if (peekIdentifierToken('new')) {
                        var newToken = nextToken();
                        // It looks like a constructor reference but is NEW being used as a map key?
                        if (peekTokenOne(TokenKind.RSQUARE)) {
            Severity: Minor
            Found in src/SpelExpressionParser.js - About 1 hr to fix

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

              function selectFromMap(collection, whichElement, expr, state) {
                  var newCollection = {},
                      entry,
                      key,
                      entries = [],
              Severity: Minor
              Found in src/ast/Selection.js - 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 createNode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              function createNode(position, expressionComponents) {
                  var node = SpelNode.create.apply(null, ['compound', position].concat(expressionComponents));
              
                  function buildContextStack(state) {
                      var childrenCount = node.getChildren().length,
              Severity: Minor
              Found in src/ast/CompoundExpression.js - 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 maybeEatLiteral has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function maybeEatLiteral() {
                      var token = peekToken();
                      if (token === null) {
                          return false;
                      }
              Severity: Minor
              Found in src/SpelExpressionParser.js - About 1 hr to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                case '&':
                                    if (!isTwoCharToken(TokenKind.SYMBOLIC_AND)) {
                                        throw {
                                            name: 'SpelParseException',
                                            message: 'Missing character \'&\' in expression (' + expressionString + ') at position ' + pos
                Severity: Major
                Found in src/Tokenizer.js and 1 other location - About 1 hr to fix
                src/Tokenizer.js on lines 169..177

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 59.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                case '|':
                                    if (!isTwoCharToken(TokenKind.SYMBOLIC_OR)) {
                                        throw {
                                            name: 'SpelParseException',
                                            message: 'Missing character \'|\' in expression (' + expressionString + ') at position ' + pos
                Severity: Major
                Found in src/Tokenizer.js and 1 other location - About 1 hr to fix
                src/Tokenizer.js on lines 160..168

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 59.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function createSpelNode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                function createSpelNode(nodeType, position, ...operands) {
                    var node = {},
                        type = nodeType || 'Abstract',
                        children = [],
                        parent = null,
                Severity: Minor
                Found in src/ast/SpelNode.js - 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 createNode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                function createNode(nullSafeNavigation, position, expr) {
                    var node = SpelNode.create('projection', position, expr);
                
                    node.getValue = function (state) {
                        var collection = state.activeContext.peek(),
                Severity: Minor
                Found in src/ast/Projection.js - 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 createNode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function createNode(position, expressionComponents) {
                    var node = SpelNode.create.apply(null, ['indexer', position].concat(expressionComponents));
                
                    node.getValue = function (state) {
                        var activeContext = state.activeContext,
                Severity: Minor
                Found in src/ast/Indexer.js - About 1 hr to fix

                  Function createNode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function createNode(functionName, position, args) {
                      var node = SpelNode.create('function', position);
                  
                      node.getRaw = function () {
                          return {
                  Severity: Minor
                  Found in src/ast/FunctionReference.js - About 1 hr to fix

                    Function createNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function createNode(variableName, position) {
                        var node = SpelNode.create('variable', position);
                    
                        node.getRaw = function () {
                            return variableName;
                    Severity: Minor
                    Found in src/ast/VariableReference.js - About 1 hr to fix

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                          function isAlphabetic(ch) {
                              if (ch.charCodeAt(0) > 255) {
                                  return false;
                              }
                              return (FLAGS[ch.charCodeAt(0)] & IS_ALPHA) !== 0;
                      Severity: Major
                      Found in src/Tokenizer.js and 2 other locations - About 55 mins to fix
                      src/Tokenizer.js on lines 574..579
                      src/Tokenizer.js on lines 588..593

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 54.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                          function isHexadecimalDigit(ch) {
                              if (ch.charCodeAt(0) > 255) {
                                  return false;
                              }
                              return (FLAGS[ch.charCodeAt(0)] & IS_HEXDIGIT) !== 0;
                      Severity: Major
                      Found in src/Tokenizer.js and 2 other locations - About 55 mins to fix
                      src/Tokenizer.js on lines 574..579
                      src/Tokenizer.js on lines 581..586

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 54.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language