neyric/wireit

View on GitHub
sandbox/grouping/examples/sawire/xml/xpath.js

Summary

Maintainability
F
2 wks
Test Coverage

File xpath.js has 1661 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2005 Google Inc.
// All Rights Reserved
//
// An XPath parser and evaluator written in JavaScript. The
// implementation is complete except for functions handling
Severity: Major
Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 4 days to fix

    Function evaluate has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

    StepExpr.prototype.evaluate = function(ctx) {
      var input = ctx.node;
      var nodelist = [];
      var skipNodeTest = false;
      
    Severity: Minor
    Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 1 day 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 compare has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

    BinaryExpr.prototype.compare = function(ctx, cmp) {
      var v1 = this.expr1.evaluate(ctx);
      var v2 = this.expr2.evaluate(ctx);
    
      var ret;
    Severity: Minor
    Found in sandbox/grouping/examples/sawire/xml/xpath.js - 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 xpathReduce has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    function xpathReduce(stack, ahead) {
      var cand = null;
    
      if (stack.length > 0) {
        var top = stack[stack.length-1];
    Severity: Minor
    Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 4 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

    xpathfunctions has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    FunctionCallExpr.prototype.xpathfunctions = {
      'last': function(ctx) {
        assert(this.args.length == 0);
        // NOTE(mesch): XPath position starts at 1.
        return new NumberValue(ctx.contextSize());
    Severity: Minor
    Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 3 hrs to fix

      Function xpathParse has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      function xpathParse(expr) {
        xpathLog('parse ' + expr);
        xpathParseInit();
      
        var cached = xpathCacheLookup(expr);
      Severity: Minor
      Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 3 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 evaluate has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      StepExpr.prototype.evaluate = function(ctx) {
        var input = ctx.node;
        var nodelist = [];
        var skipNodeTest = false;
        
      Severity: Major
      Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 3 hrs to fix

        Function xpathParse has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xpathParse(expr) {
          xpathLog('parse ' + expr);
          xpathParseInit();
        
          var cached = xpathCacheLookup(expr);
        Severity: Major
        Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 3 hrs to fix

          Function xpathMatchStack has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          function xpathMatchStack(stack, pattern) {
          
            // NOTE(mesch): The stack matches for variable cardinality are
            // greedy but don't do backtracking. This would be an issue only
            // with rules of the form A* A, i.e. with an element with variable
          Severity: Minor
          Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 3 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 compare has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          BinaryExpr.prototype.compare = function(ctx, cmp) {
            var v1 = this.expr1.evaluate(ctx);
            var v2 = this.expr2.evaluate(ctx);
          
            var ret;
          Severity: Major
          Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                if (rule &&
                    (rule == TOK_DIV ||
                     rule == TOK_MOD ||
                     rule == TOK_AND ||
                     rule == TOK_OR) &&
            Severity: Critical
            Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 2 hrs to fix

              Function xpathMatchStack has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function xpathMatchStack(stack, pattern) {
              
                // NOTE(mesch): The stack matches for variable cardinality are
                // greedy but don't do backtracking. This would be an issue only
                // with rules of the form A* A, i.e. with an element with variable
              Severity: Major
              Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 2 hrs to fix

                Function xpathParseInit has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function xpathParseInit() {
                  if (xpathRules.length) {
                    return;
                  }
                
                
                Severity: Major
                Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 2 hrs to fix

                  Function evaluate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  BinaryExpr.prototype.evaluate = function(ctx) {
                    var ret;
                    switch (this.op.value) {
                      case 'or':
                        ret = new BooleanValue(this.expr1.evaluate(ctx).booleanValue() ||
                  Severity: Major
                  Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 2 hrs to fix

                    Function xpathReduce has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function xpathReduce(stack, ahead) {
                      var cand = null;
                    
                      if (stack.length > 0) {
                        var top = stack[stack.length-1];
                    Severity: Minor
                    Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 1 hr to fix

                      Function xpathParseInit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function xpathParseInit() {
                        if (xpathRules.length) {
                          return;
                        }
                      
                      
                      Severity: Minor
                      Found in sandbox/grouping/examples/sawire/xml/xpath.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 _combineSteps has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      LocationExpr.prototype._combineSteps = function(prevStep, nextStep) {
                        if (!prevStep) return null;
                        if (!nextStep) return null;
                        var hasPredicates = (prevStep.predicates && prevStep.predicates.length > 0);
                        if (prevStep.nodetest instanceof NodeTestAny && !hasPredicates) {
                      Severity: Minor
                      Found in sandbox/grouping/examples/sawire/xml/xpath.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 xpathGrammarPrecedence has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function xpathGrammarPrecedence(frame) {
                        var ret = 0;
                      
                        if (frame.rule) { /* normal reduce */
                          if (frame.rule.length >= 3 && frame.rule[2] >= 0) {
                      Severity: Minor
                      Found in sandbox/grouping/examples/sawire/xml/xpath.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 xpathSort has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function xpathSort(input, sort) {
                        if (sort.length == 0) {
                          return;
                        }
                      
                      
                      Severity: Minor
                      Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 1 hr to fix

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

                          'id': function(ctx) {
                            assert(this.args.length == 1);
                            var e = this.args[0].evaluate(ctx);
                            var ret = [];
                            var ids;
                        Severity: Minor
                        Found in sandbox/grouping/examples/sawire/xml/xpath.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 xpathSort has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function xpathSort(input, sort) {
                          if (sort.length == 0) {
                            return;
                          }
                        
                        
                        Severity: Minor
                        Found in sandbox/grouping/examples/sawire/xml/xpath.js - 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 evaluate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        UnionExpr.prototype.evaluate = function(ctx) {
                          var nodes1 = this.expr1.evaluate(ctx).nodeSetValue();
                          var nodes2 = this.expr2.evaluate(ctx).nodeSetValue();
                          var I1 = nodes1.length;
                          for (var i2 = 0; i2 < nodes2.length; ++i2) {
                        Severity: Minor
                        Found in sandbox/grouping/examples/sawire/xml/xpath.js - 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

                        Avoid deeply nested control flow statements.
                        Open

                            if (this.nodetest.evaluate(ctx).booleanValue()) {
                              nodelist.push(input);
                            }
                        Severity: Major
                        Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                          Function ExprContext has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function ExprContext(node, opt_position, opt_nodelist, opt_parent, opt_caseInsensitive, opt_ignoreAttributesWithoutValue) {
                          Severity: Minor
                          Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                  for (var i = 0;  i < n.length; ++i) {
                                    var nn = xmlValue(n[i]) - 0;
                                    if (cmp(nn, s)) {
                                      ret = true;
                                      break;
                            Severity: Major
                            Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                    if (stack[s].tag == pattern[p]) {
                                      while (s - ds >= 0 && stack[s - ds].tag == pattern[p]) {
                                        qmatch.push(stack[s - ds]);
                                        ds += 1;
                                        match.matchlength += 1;
                              Severity: Major
                              Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                  } else if (this.axis == xpathAxis.DESCENDANT) {
                                    var tagName = xpathExtractTagNameFromNodeTest(this.nodetest);
                                    xpathCollectDescendants(nodelist, input, tagName);
                                    if (tagName) skipNodeTest = true;
                                
                                
                                Severity: Major
                                Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                      } else if (v1.type == 'string') {
                                        var s = v1.stringValue();
                                        var n = v2.nodeSetValue();
                                  
                                        ret = false;
                                  Severity: Major
                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                            if (cmp(s, nn)) {
                                              ret = true;
                                              break;
                                            }
                                    Severity: Major
                                    Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                          if (tagName) skipNodeTest = true;
                                      Severity: Major
                                      Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                            } else if (stack[s].tag == pattern[p]) {
                                              match.push(stack[s]);
                                              ds += 1;
                                              match.matchlength += 1;
                                        
                                        
                                        Severity: Major
                                        Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 45 mins to fix

                                          Function makeFunctionCallExpr2 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          function makeFunctionCallExpr2(name, pareno, arg1, args, parenc) {
                                          Severity: Minor
                                          Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 35 mins to fix

                                            Function xPathStep has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            function xPathStep(nodes, steps, step, input, ctx) {
                                            Severity: Minor
                                            Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 35 mins to fix

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

                                                'lang': function(ctx) {
                                                  assert(this.args.length == 1);
                                                  var lang = this.args[0].evaluate(ctx).stringValue();
                                                  var xmllang;
                                                  var n = ctx.node;
                                              Severity: Minor
                                              Found in sandbox/grouping/examples/sawire/xml/xpath.js - 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

                                              Avoid too many return statements within this function.
                                              Open

                                                      return nextStep;
                                              Severity: Major
                                              Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                  return null;
                                                Severity: Major
                                                Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 30 mins to fix

                                                  Function evaluate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  FilterExpr.prototype.evaluate = function(ctx) {
                                                    var nodes = this.expr.evaluate(ctx).nodeSetValue();
                                                    for (var i = 0; i < this.predicate.length; ++i) {
                                                      var nodes0 = nodes;
                                                      nodes = [];
                                                  Severity: Minor
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js - 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 xpathSortByKey has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  function xpathSortByKey(v1, v2) {
                                                    // NOTE: Sort key vectors of different length never occur in
                                                    // xsltSort.
                                                  
                                                    for (var i = 0; i < v1.key.length; ++i) {
                                                  Severity: Minor
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js - 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

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

                                                    for (var i = 0; i < this.predicate.length; ++i) {
                                                      var nodelist0 = nodelist;
                                                      nodelist = [];
                                                      for (var ii = 0; ii < nodelist0.length; ++ii) {
                                                        var n = nodelist0[ii];
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 3 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1299..1308

                                                  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 108.

                                                  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

                                                    for (var i = 0; i < this.predicate.length; ++i) {
                                                      var nodes0 = nodes;
                                                      nodes = [];
                                                      for (var j = 0; j < nodes0.length; ++j) {
                                                        var n = nodes0[j];
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 3 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 828..837

                                                  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 108.

                                                  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

                                                      if (v1.type == 'number') {
                                                        var s = v1.numberValue();
                                                        var n = v2.nodeSetValue();
                                                  
                                                        ret = false;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 3 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1431..1472

                                                  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 105.

                                                  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

                                                      } else if (v2.type == 'number') {
                                                        var n = v1.nodeSetValue();
                                                        var s = v2.numberValue();
                                                  
                                                        ret = false;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 3 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1418..1472

                                                  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 105.

                                                  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

                                                      } else if (v2.type == 'string') {
                                                        var n = v1.nodeSetValue();
                                                        var s = v2.stringValue();
                                                  
                                                        ret = false;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 3 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1444..1472

                                                  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 101.

                                                  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

                                                      } else if (v1.type == 'string') {
                                                        var s = v1.stringValue();
                                                        var n = v2.nodeSetValue();
                                                  
                                                        ret = false;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 3 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1457..1472

                                                  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 101.

                                                  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

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

                                                      if (this.args.length > 0) {
                                                        s = this.args[0].evaluate(ctx).stringValue();
                                                      } else {
                                                        s = new NodeSetValue([ ctx.node ]).stringValue();
                                                      }
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1103..1107

                                                  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 77.

                                                  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

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

                                                      if (this.args.length > 0) {
                                                        s = this.args[0].evaluate(ctx).stringValue();
                                                      } else {
                                                        s = new NodeSetValue([ ctx.node ]).stringValue();
                                                      }
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1093..1097

                                                  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 77.

                                                  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

                                                    } else if (this.axis == xpathAxis.FOLLOWING) {
                                                      for (var n = input; n; n = n.parentNode) {
                                                        for (var nn = n.nextSibling; nn; nn = nn.nextSibling) {
                                                          nodelist.push(nn);
                                                          xpathCollectDescendants(nodelist, nn);
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 795..813

                                                  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 77.

                                                  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

                                                    } else if (this.axis == xpathAxis.PRECEDING) {
                                                      for (var n = input; n; n = n.parentNode) {
                                                        for (var nn = n.previousSibling; nn; nn = nn.previousSibling) {
                                                          nodelist.push(nn);
                                                          xpathCollectDescendantsReverse(nodelist, nn);
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 774..813

                                                  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 77.

                                                  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

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

                                                        while (s - ds >= 0 && stack[s - ds].tag == pattern[p]) {
                                                          qmatch.push(stack[s - ds]);
                                                          ds += 1;
                                                          match.matchlength += 1;
                                                        }
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 295..299

                                                  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 76.

                                                  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

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

                                                          while (s - ds >= 0 && stack[s - ds].tag == pattern[p]) {
                                                            qmatch.push(stack[s - ds]);
                                                            ds += 1;
                                                            match.matchlength += 1;
                                                          }
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 276..280

                                                  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 76.

                                                  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

                                                    'floor': function(ctx) {
                                                      assert(this.args.length == 1);
                                                      var num = this.args[0].evaluate(ctx).numberValue();
                                                      return new NumberValue(Math.floor(num));
                                                    },
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 2 other locations - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1192..1196
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1198..1202

                                                  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 75.

                                                  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

                                                    'ceiling': function(ctx) {
                                                      assert(this.args.length == 1);
                                                      var num = this.args[0].evaluate(ctx).numberValue();
                                                      return new NumberValue(Math.ceil(num));
                                                    },
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 2 other locations - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1186..1190
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1198..1202

                                                  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 75.

                                                  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

                                                    'round': function(ctx) {
                                                      assert(this.args.length == 1);
                                                      var num = this.args[0].evaluate(ctx).numberValue();
                                                      return new NumberValue(Math.round(num));
                                                    },
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 2 other locations - About 2 hrs to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1186..1190
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1192..1196

                                                  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 75.

                                                  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 'or':
                                                        ret = new BooleanValue(this.expr1.evaluate(ctx).booleanValue() ||
                                                                               this.expr2.evaluate(ctx).booleanValue());
                                                        break;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 1 hr to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1335..1338

                                                  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 58.

                                                  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 5 locations. Consider refactoring.
                                                  Open

                                                      case '*':
                                                        ret = new NumberValue(this.expr1.evaluate(ctx).numberValue() *
                                                                              this.expr2.evaluate(ctx).numberValue());
                                                        break;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 4 other locations - About 1 hr to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1340..1343
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1345..1348
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1355..1358
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1360..1363

                                                  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 58.

                                                  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 5 locations. Consider refactoring.
                                                  Open

                                                      case 'mod':
                                                        ret = new NumberValue(this.expr1.evaluate(ctx).numberValue() %
                                                                              this.expr2.evaluate(ctx).numberValue());
                                                        break;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 4 other locations - About 1 hr to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1340..1343
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1345..1348
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1350..1353
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1360..1363

                                                  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 58.

                                                  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 'and':
                                                        ret = new BooleanValue(this.expr1.evaluate(ctx).booleanValue() &&
                                                                               this.expr2.evaluate(ctx).booleanValue());
                                                        break;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 1 hr to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1330..1333

                                                  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 58.

                                                  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 5 locations. Consider refactoring.
                                                  Open

                                                      case '+':
                                                        ret = new NumberValue(this.expr1.evaluate(ctx).numberValue() +
                                                                              this.expr2.evaluate(ctx).numberValue());
                                                        break;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 4 other locations - About 1 hr to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1345..1348
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1350..1353
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1355..1358
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1360..1363

                                                  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 58.

                                                  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 5 locations. Consider refactoring.
                                                  Open

                                                      case 'div':
                                                        ret = new NumberValue(this.expr1.evaluate(ctx).numberValue() /
                                                                              this.expr2.evaluate(ctx).numberValue());
                                                        break;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 4 other locations - About 1 hr to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1340..1343
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1345..1348
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1350..1353
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1355..1358

                                                  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 58.

                                                  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 5 locations. Consider refactoring.
                                                  Open

                                                      case '-':
                                                        ret = new NumberValue(this.expr1.evaluate(ctx).numberValue() -
                                                                              this.expr2.evaluate(ctx).numberValue());
                                                        break;
                                                  Severity: Major
                                                  Found in sandbox/grouping/examples/sawire/xml/xpath.js and 4 other locations - About 1 hr to fix
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1340..1343
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1350..1353
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1355..1358
                                                  sandbox/grouping/examples/sawire/xml/xpath.js on lines 1360..1363

                                                  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 58.

                                                  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

                                                  There are no issues that match your filters.

                                                  Category
                                                  Status