Showing 135 of 334 total issues
Avoid deeply nested control flow statements. Open
Open
for (i2 = i + 1; i2 < len; i2++) {
if (format.charAt(i2) == ']') {
var subformat = format.substring(i + 1, i2);
var subres = formatDate(date, subformat, options);
if (subres != formatDate(otherDate, subformat, options)) {
Avoid deeply nested control flow statements. Open
Open
if (format.charAt(i2) == ')') {
var subres = formatDate(date, format.substring(i + 1, i2), options);
if (parseInt(subres.replace(/\D/, ''), 10)) {
res += subres;
}
Avoid deeply nested control flow statements. Open
Open
if (helperRes) {
rect.position = 'absolute';
selectionHelper = $(helperRes)
.css(rect)
.appendTo(slotContainer);
Avoid deeply nested control flow statements. Open
Open
if (date) {
if (i2 == i + 1) {
res += "'";
} else {
res += format.substring(i + 1, i2);
Consider simplifying this complex logical expression. Open
Open
if (ignoreTimezone || !m[13]) {
var check = new Date(m[1], 0, 1, 9, 0);
if (m[3]) {
date.setMonth(m[3] - 1);
check.setMonth(m[3] - 1);
Consider simplifying this complex logical expression. Open
Open
if (!support.rgba && value._rgba[3] !== 1) {
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
while (
(backgroundColor === "" || backgroundColor === "transparent") &&
curElem && curElem.style
Consider simplifying this complex logical expression. Open
Open
if (o.mode === "toggle" && mode === "show") {
el.from = o.to || zero;
el.to = o.from || original;
} else {
el.from = o.from || ( mode === "show" ? zero : original );
Consider simplifying this complex logical expression. Open
Open
if (
inst.options.greedy && !inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) &&
$.ui.intersect(draggable, $.extend(inst, {offset: inst.element.offset()}), inst.options.tolerance)
Function rect
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
t.rect = function (row0, col0, row1, col1, originElement) { // row1,col1 is inclusive
Function switchClass
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
switchClass: function (remove, add, speed, easing, callback) {
Method store_location
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
return unless request.get?
if (request.path != "/users/sign_in" &&
request.path != "/users/sign_up" &&
- 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
Open
return;
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return null;
Avoid too many return
statements within this function. Open
Open
return true;