ContentMine/thresher

View on GitHub

Showing 115 of 227 total issues

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

                      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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

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

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

                                                  return;
                                  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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language