Showing 115 of 227 total issues
Avoid too many return
statements within this function. Open
return Step.PRECEDINGSIBLING;
Avoid too many return
statements within this function. Open
return new NodeTest(-1, undefined);
Avoid too many return
statements within this function. Open
return Step.FOLLOWINGSIBLING;
Avoid too many return
statements within this function. Open
return Step.DESCENDANTORSELF;
Avoid too many return
statements within this function. Open
return Step.NAMESPACE;
Avoid too many return
statements within this function. Open
return test[0] == node[0] && String(test[1]).toLowerCase() == String(node[1]).toLowerCase();
Avoid too many return
statements within this function. Open
return 1;
Avoid too many return
statements within this function. Open
return test[0] == node[0] && test[1] == node[1];
Avoid too many return
statements within this function. Open
return -1;
Avoid too many return
statements within this function. Open
return false;
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));
- 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 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)");
}
- 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 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);
- 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 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
- 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 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
- 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"