Showing 1,065 of 16,781 total issues
Avoid deeply nested control flow statements. Open
Open
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.slice( 5 ) );
dataAttr( elem, name, data[ name ] );
Avoid deeply nested control flow statements. Open
Open
while ( j-- ) {
if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
!tbody.childNodes.length ) {
elem.removeChild( tbody );
Avoid deeply nested control flow statements. Open
Open
if ( hasScripts ) {
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
Avoid deeply nested control flow statements. Open
Open
for ( j=0, jLen=(nTds.length/iColumns) ; j<jLen ; j++ )
{
nTds[(iColumns*j)+i].className =
$.trim( nTds[(iColumns*j)+i].className.replace( sClass+"1", "" ) );
}
Avoid deeply nested control flow statements. Open
Open
if (disks[i]["@attributes"][proc_param] !== undefined) {
$('#stablebit-'+ i+ "-" + proc_param).render(disks[i]["@attributes"], directives);
}
Avoid deeply nested control flow statements. Open
Open
if (!isNaN(parseInt(raiditems[i]["@attributes"].Stride))) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(7, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Stride) + "</td></tr>"; // Stride
Avoid deeply nested control flow statements. Open
Open
if (raiditems[i]["@attributes"].Controller !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(19, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Controller + "</td></tr>"; // Controller
Avoid deeply nested control flow statements. Open
Open
if (raiditems[i]["@attributes"].ReadPolicy !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(23, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].ReadPolicy + "</td></tr>"; // Read Policy
Avoid deeply nested control flow statements. Open
Open
if (raiditems[i]["@attributes"].Cache_Size !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(25, 'raid')+"</span></td><td>" + formatBytes(parseInt(raiditems[i]["@attributes"].Cache_Size), data.Options["@attributes"].byteFormat) + "</td></tr>"; // Cache_Size
Avoid deeply nested control flow statements. Open
Open
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray( src ) ? src : [];
} else {
Avoid deeply nested control flow statements. Open
Open
if ( matches[ sel ] ) {
matches.push( handleObj );
}
Avoid deeply nested control flow statements. Open
Open
if (href.substring(0, 2) === "//") {
href = w.location.protocol + href;
}
Avoid deeply nested control flow statements. Open
Open
if (bats[i]["@attributes"][proc_param] !== undefined) {
html+="<tr id=\"bat-" + i + "-" + proc_param + "\" class=\"treegrid-parent-bat-" + i + "\">";
html+="<td><span class=\"treegrid-spanbold\">" + genlang(paramlist[proc_param], 'bat') + "</span></td>";
html+="<td><span data-bind=\"" + proc_param + "\"></span></td>";
if (paramlis2[proc_param] !== undefined) {
Avoid deeply nested control flow statements. Open
Open
if (smartid === "194") {
html += '<td class="rightCell">' + formatTemp(itemvalue, data.Options["@attributes"].tempFormat) + '</td>';
} else {
html += '<td class="rightCell">' + itemvalue + '</td>';
}
Avoid deeply nested control flow statements. Open
Open
if (raiditems[i]["@attributes"].Devs !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(9, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Devs) + "</td></tr>"; // Devices
Avoid deeply nested control flow statements. Open
Open
for (var j = 0; j < diskitems.length ; j++) {
raid_diskicon(diskitems[j]["@attributes"], k, j);
}
Avoid deeply nested control flow statements. Open
Open
if (!isNaN(parseInt(raiditems[i]["@attributes"].Disks_Registered)) && !isNaN(parseInt(raiditems[i]["@attributes"].Disks_Active))) {
html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(18, 'raid')+"</span></td><td>" + parseInt(raiditems[i]["@attributes"].Disks_Registered) + "/<wbr>" + parseInt(raiditems[i]["@attributes"].Disks_Active) + "</td></tr>";
}
Avoid deeply nested control flow statements. Open
Open
if (raiditems[i]["@attributes"].Supported !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(21, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Supported + "</td></tr>"; // Supported RAID-Types
Function 4
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
},{"./helpers":5,"./instance":6}],4:[function(require,module,exports){
var AttributeFactory, Checkbox, Element, ElementFactory, Input, Radio, Select, TextArea, VoidElement, helpers, _,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
- 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 (raiditems[i]["@attributes"].Algorithm !== undefined) html += "<tr class=\"treegrid-parent-raid-" + i + "\"><td><span class=\"treegrid-spanbold\">"+genlang(14, 'raid')+"</span></td><td>" + raiditems[i]["@attributes"].Algorithm + "</td></tr>";