ContentMine/thresher

View on GitHub

Showing 227 of 227 total issues

Avoid deeply nested control flow statements.
Open

                    if (c == '(') {
                        types.push(XPathParser.FUNCTIONNAME);
                        values.push(name);
                        continue;
                    }
Severity: Major
Found in lib/xpath.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (xpc.contextNode.nodeType == 1 /*Node.ELEMENT_NODE*/) {
                                n["xml"] = XPath.XML_NAMESPACE_URI;
                                n["xmlns"] = XPath.XMLNS_NAMESPACE_URI;
                                for (var m = xpc.contextNode; m != null && m.nodeType == 1 /*Node.ELEMENT_NODE*/; m = m.parentNode) {
                                    for (var k = 0; k < m.attributes.length; k++) {
    Severity: Major
    Found in lib/xpath.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (xpc.contextNode === xpc.virtualRoot) {
                                  break;
                              }
      Severity: Major
      Found in lib/xpath.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                while (st.length > 0) {
                                    for (var m = st.pop(); m != null; ) {
                                        if (step.nodeTest.matches(m, xpc)) {
                                            newNodes.push(m);
                                        }
        Severity: Major
        Found in lib/xpath.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (xpc.contextNode === xpc.virtualRoot) {
                                      break;
                                  }
          Severity: Major
          Found in lib/xpath.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for (var m = xpc.contextNode.nextSibling; m != null; m = m.nextSibling) {
                                        if (step.nodeTest.matches(m, xpc)) {
                                            newNodes.push(m);
                                        }
                                    }
            Severity: Major
            Found in lib/xpath.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for (var m = xpc.contextNode.previousSibling; m != null; m = m.previousSibling) {
                                          if (step.nodeTest.matches(m, xpc)) {
                                              newNodes.push(m);
                                          }
                                      }
              Severity: Major
              Found in lib/xpath.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if (name == "and") {
                                        types.push(XPathParser.AND);
                                        values.push(name);
                                        continue;
                                    }
                Severity: Major
                Found in lib/xpath.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (name == "mod") {
                                          types.push(XPathParser.MOD);
                                          values.push(name);
                                          continue;
                                      }
                  Severity: Major
                  Found in lib/xpath.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if (this.predicateMatches(pred, xpc)) {
                                            newNodes.push(xpc.contextNode);
                                        } else {
                                        }
                    Severity: Major
                    Found in lib/xpath.js - About 45 mins to fix

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

                      Scraper.prototype.scrapeElement = function(doc, element, scrapeUrl, key, follow_url) {
                      Severity: Minor
                      Found in lib/scraper.js - About 35 mins to fix

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

                            doc.evaluate = function(e, cn, r, t, res) {
                        Severity: Minor
                        Found in lib/xpath.js - About 35 mins to fix

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

                                              while (Utilities.isNCNameChar(c.charCodeAt(0))) {
                                                  name += c;
                                                  c = s.charAt(pos++);
                                              }
                          Severity: Minor
                          Found in lib/xpath.js and 1 other location - About 35 mins to fix
                          lib/xpath.js on lines 1008..1011

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

                          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

                              this.reduceActions[39] = function(rhs) {
                                  rhs[2].unshift(rhs[0]);
                                  return rhs[2];
                              };
                          Severity: Minor
                          Found in lib/xpath.js and 1 other location - About 35 mins to fix
                          lib/xpath.js on lines 239..242

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

                          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

                              this.reduceActions[55] = function(rhs) {
                                  rhs[1].unshift(rhs[0]);
                                  return rhs[1];
                              };
                          Severity: Minor
                          Found in lib/xpath.js and 1 other location - About 35 mins to fix
                          lib/xpath.js on lines 206..209

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

                          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 (Utilities.isNCNameChar(c.charCodeAt(0))) {
                                          name += c;
                                          c = s.charAt(pos++);
                                      }
                          Severity: Minor
                          Found in lib/xpath.js and 1 other location - About 35 mins to fix
                          lib/xpath.js on lines 1067..1070

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                          var Scraper = function(definition, headless) {
                            var scraper = this;
                          
                            EventEmitter2.call(this, {
                              wildcard: true,
                          Severity: Minor
                          Found in lib/scraper.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

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

                          Functions.name = function() {
                              var c = arguments[0];
                              var n;
                              if (arguments.length == 1) {
                                  n = c.contextNode;
                          Severity: Minor
                          Found in lib/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

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

                              if (this.resultType != XPathResult.UNORDERED_NODE_ITERATOR_TYPE
                                      && this.resultType != XPathResult.ORDERED_NODE_ITERATOR_TYPE) {
                                  throw new XPathException(XPathException.TYPE_ERR);
                              }
                          Severity: Minor
                          Found in lib/xpath.js and 1 other location - About 35 mins to fix
                          lib/xpath.js on lines 4220..4223

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

                          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 (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE
                                      && this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) {
                                  throw new XPathException(XPathException.TYPE_ERR);
                              }
                          Severity: Minor
                          Found in lib/xpath.js and 1 other location - About 35 mins to fix
                          lib/xpath.js on lines 4212..4215

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

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

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

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

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

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language