ContentMine/thresher

View on GitHub

Showing 115 of 227 total issues

Avoid too many return statements within this function.
Open

            return Step.PRECEDINGSIBLING;
Severity: Major
Found in lib/xpath.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return new NodeTest(-1, undefined);
    Severity: Major
    Found in lib/xpath.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return Step.FOLLOWINGSIBLING;
      Severity: Major
      Found in lib/xpath.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return Step.DESCENDANTORSELF;
        Severity: Major
        Found in lib/xpath.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return Step.NAMESPACE;
          Severity: Major
          Found in lib/xpath.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return test[0] == node[0] && String(test[1]).toLowerCase() == String(node[1]).toLowerCase();
            Severity: Major
            Found in lib/xpath.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return 1;
              Severity: Major
              Found in lib/xpath.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return test[0] == node[0] && test[1] == node[1];
                Severity: Major
                Found in lib/xpath.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return -1;
                  Severity: Major
                  Found in lib/xpath.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return false;
                    Severity: Major
                    Found in lib/xpath.js - About 30 mins to fix

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

                      XNodeSet.prototype.compareWithNodeSet = function(r, o) {
                          var a = this.toArray();
                          for (var i = 0; i < a.length; i++) {
                              var n = a[i];
                              var l = new XString(this.stringForNode(n));
                      Severity: Minor
                      Found in lib/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 lang has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Functions.lang = function() {
                          var c = arguments[0];
                          if (arguments.length != 2) {
                              throw new Error("Function lang expects (string)");
                          }
                      Severity: Minor
                      Found in lib/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 selectWithResolver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.selectWithResolver = function(e, doc, resolver, single) {
                          var expression = new XPathExpression(e, resolver, new XPathParser());
                          var type = XPathResult.ANY_TYPE;
                      
                          var result = expression.evaluate(doc, type, null);
                      Severity: Minor
                      Found in lib/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 getElementById has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Utilities.getElementById = function(n, id) {
                          // Note that this does not check the DTD to check for actual
                          // attributes of type ID, so this may be a bit wrong.
                          if (n.nodeType == 1 /*Node.ELEMENT_NODE*/) {
                              if (n.getAttribute("id") == id
                      Severity: Minor
                      Found in lib/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 fillChildResults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function fillChildResults(scraper, obj, newRes) {
                        var baseKeys = ['selector', 'attribute', 'download', 'regex', 'follow', 'name'];
                        for (var key in obj) {
                          if (baseKeys.indexOf(key) >= 0) {
                            // ignore base keys
                      Severity: Minor
                      Found in lib/scraper.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

                      Severity
                      Category
                      Status
                      Source
                      Language