Showing 115 of 227 total issues
Avoid deeply nested control flow statements. Open
Open
if (keywords.indexOf(j) == -1) {
// this element has child[ren]
isLeaf = false;
checkLeaves(e);
}
Function resolveQName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
Utilities.resolveQName = function(qn, nr, n, useDefault) {
var parts = Utilities.splitQName(qn);
if (parts[0] != null) {
parts[0] = nr.getNamespace(parts[0], n);
} else {
- 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
Open
if (s.charAt(pos) == ')') {
types.push(XPathParser.NODETYPE);
} else {
types.push(XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL);
}
Avoid deeply nested control flow statements. Open
Open
if (this.predicateMatches(pred, xpc)) {
newNodes.push(xpc.contextNode);
}
Avoid deeply nested control flow statements. Open
Open
if (nodes[0].ownerDocument == null) {
// IE 5.5 doesn't have ownerDocument?
var n = nodes[0];
while (n.parentNode != null) {
n = n.parentNode;
Avoid deeply nested control flow statements. Open
Open
if (name == "or") {
types.push(XPathParser.OR);
values.push(name);
continue;
}
Avoid deeply nested control flow statements. Open
Open
for (var m = xpc.contextNode.firstChild; m != null; m = m.nextSibling) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
}
Avoid deeply nested control flow statements. Open
Open
if (step.nodeTest.matches(xpc.contextNode, xpc)) {
newNodes.push(xpc.contextNode);
}
Avoid deeply nested control flow statements. Open
Open
if (nnm != null) {
for (var k = 0; k < nnm.length; k++) {
var m = nnm.item(k);
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
Avoid deeply nested control flow statements. Open
Open
if (step.nodeTest.matches(xpc.contextNode, xpc)) {
newNodes.push(xpc.contextNode);
}
Avoid deeply nested control flow statements. Open
Open
if (xpc.contextNode.firstChild != null) {
st.unshift(xpc.contextNode.firstChild);
} else {
st.unshift(xpc.contextNode.nextSibling);
}
Avoid deeply nested control flow statements. Open
Open
while (st.length > 0) {
for (var m = st.pop(); m != null; ) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
Avoid deeply nested control flow statements. Open
Open
for (var m = xpc.contextNode.parentNode; m != null && m.nodeType != 9 /*Node.DOCUMENT_NODE*/ && m !== xpc.virtualRoot; m = m.parentNode) {
st.unshift(m.nextSibling);
}
Avoid deeply nested control flow statements. Open
Open
while (m != null) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
if (m === xpc.virtualRoot) {
Avoid deeply nested control flow statements. Open
Open
outer: while (st.length > 0) {
for (var m = st.pop(); m != null; ) {
if (m == xpc.contextNode) {
break outer;
}
Avoid deeply nested control flow statements. Open
Open
if (xpc.contextNode === xpc.virtualRoot) {
break;
}
Avoid deeply nested control flow statements. Open
Open
for (var m = xpc.contextNode; m != null; m = m.nodeType == 2 /*Node.ATTRIBUTE_NODE*/ ? this.getOwnerElement(m) : m.parentNode) {
if (step.nodeTest.matches(m, xpc)) {
newNodes.push(m);
}
if (m === xpc.virtualRoot) {
Avoid deeply nested control flow statements. Open
Open
if (xpc.contextNode === xpc.virtualRoot) {
break;
}
Avoid deeply nested control flow statements. Open
Open
if (c == '(') {
types.push(XPathParser.FUNCTIONNAME);
values.push(name);
continue;
}
Avoid deeply nested control flow statements. Open
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++) {