Showing 115 of 227 total issues
Avoid deeply nested control flow statements. Open
if (xpc.virtualRoot != null) {
st = [ xpc.virtualRoot ];
} else {
st = xpc.contextNode.nodeType == 9 /*Node.DOCUMENT_NODE*/
? [ xpc.contextNode ]
Avoid deeply nested control flow statements. Open
if (s.charAt(pos) == ')') {
types.push(XPathParser.NODETYPE);
} else {
types.push(XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL);
}
Avoid deeply nested control flow statements. Open
if (xpc.contextNode === xpc.virtualRoot) {
break;
}
Function getChildElements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getChildElements(obj) {
var elementsArray = [];
// process followables first, they
// will be excluded from results later
if (obj.followables) {
- Read upRead up
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 (name == "mod") {
types.push(XPathParser.MOD);
values.push(name);
continue;
}
Avoid deeply nested control flow statements. Open
if (xpc.contextNode.firstChild != null) {
st.unshift(xpc.contextNode.firstChild);
} else {
st.unshift(xpc.contextNode.nextSibling);
}
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++) {
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);
}
}
Function scrapeElement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Scraper.prototype.scrapeElement = function(doc, element, scrapeUrl, key, follow_url) {
Function evaluate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
doc.evaluate = function(e, cn, r, t, res) {
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,
- Read upRead up
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;
- Read upRead up
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.PARENT;
Avoid too many return
statements within this function. Open
return Step.PRECEDINGSIBLING;
Avoid too many return
statements within this function. Open
return Step.DESCENDANT;
Avoid too many return
statements within this function. Open
return Step.NAMESPACE;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return -1;