Showing 436 of 436 total issues
Avoid deeply nested control flow statements. Open
Open
for (i = 0; i < dataLength; i++) {
pt = data[i];
xData[i] = pt[0];
yData[i] = pt[1];
}
Avoid deeply nested control flow statements. Open
Open
} else if (key === 'x' && nodeName === 'text') {
for (i = 0; i < element.childNodes.length; i++) {
child = element.childNodes[i];
// if the x values are equal, the tspan represents a linebreak
if (attr(child, 'x') === attr(element, 'x')) {
Avoid deeply nested control flow statements. Open
Open
if (result !== UNDEFINED) {
value = result; // the attribute setter has returned a new value to set
}
Avoid deeply nested control flow statements. Open
Open
if (connector) {
point.connector = connector.destroy();
}
Avoid deeply nested control flow statements. Open
Open
while (slots[slotIndex] === null) { // make sure it is not taken
slotIndex++;
}
Function drawCircle
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
drawCircle: function (x, y, radius, lineColor, fillColor, lineWidth) {
Avoid deeply nested control flow statements. Open
Open
if (val > 0) {
stackTotals[i] += val;
}
Avoid deeply nested control flow statements. Open
Open
if ($.isFunction(tags)) tags=tags();
Avoid deeply nested control flow statements. Open
Open
if (wrapper.stroke && wrapper['stroke-width']) {
attr(element, 'stroke', wrapper.stroke);
attr(element, 'stroke-width', wrapper['stroke-width']);
wrapper.hasStroke = true;
} else if (key === 'stroke-width' && value === 0 && wrapper.hasStroke) {
Avoid deeply nested control flow statements. Open
Open
if (w) {
x = axis.translate(pos); // don't handle log
if (lastRight[lineNo] !== UNDEFINED && x < lastRight[lineNo]) {
overlap = true;
}
Function drawLine
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
drawLine: function (x1, y1, x2, y2, lineColor, lineWidth) {
Avoid deeply nested control flow statements. Open
Open
$(tags).each(function() { if (equal(this.id, id)) { text = this.text; return false; } });
Avoid deeply nested control flow statements. Open
Open
if left_token.blank? and right_token.blank?
all_conditions << "#{numeric_string} BETWEEN #{range[0]} and #{range[1]}"
else
all_conditions << "#{numeric_string} #{left_token} #{range[0]} and #{numeric_string} #{right_token} #{range[1]}"
end
Avoid deeply nested control flow statements. Open
Open
if (value && value.join) { // join path
value = value.join(' ');
}
Avoid deeply nested control flow statements. Open
Open
if (equal(opts.id(token), opts.id(selection[i]))) {
dupe = true; break;
}
Avoid deeply nested control flow statements. Open
Open
if (symbolName && /^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(key)) {
// if one of the symbol size affecting parameters are changed,
// check all the others only once for each call to an element's
// .attr() method
if (!hasSetSymbolSize) {
Avoid deeply nested control flow statements. Open
Open
body_row[index] = (filtered_results.compact.size > 0) ? (filtered_results.compact.max).round(1) : 'n/a'
Avoid deeply nested control flow statements. Open
Open
elsif statistic == 'avg'
body_row[index] = (filtered_results.compact.size > 0) ? (filtered_results.compact.sum.to_f / filtered_results.compact.size).round(1) : 'n/a'
elsif statistic == 'count'
body_row[index] = filtered_results.size
elsif statistic == '%'
Method table_columns
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def table_columns(current_user, table, page = 1, per_page = -1, filter_unmapped = false, search = '')
Method user_has_action?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def user_has_action?(current_user, action)
return true if current_user.all_sources.include?(self)
result = false
blocked = false
self.rules.each do |rule|
- 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"