Showing 175 of 609 total issues
Function isOver
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
isOver: function(y, x, top, left, height, width) {
Method get_user
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_user
render_403 unless User.current.logged?
if params[:user_id] && params[:user_id] != User.current.id.to_s
if User.current.admin?
- 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(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
continue;
Avoid deeply nested control flow statements. Open
Open
for (var j = this.items.length - 1; j >= 0; j--) {
if(!contains(this.containers[i].element[0], this.items[j].item[0])) continue;
var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];
if(Math.abs(cur - base) < dist) {
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
Consider simplifying this complex logical expression. Open
Open
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
return this._hide.apply(this, arguments);
else {
var o = arguments[1] || {}; o['mode'] = 'hide';
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
Consider simplifying this complex logical expression. Open
Open
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
return this._show.apply(this, arguments);
else {
var o = arguments[1] || {}; o['mode'] = 'show';
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
Consider simplifying this complex logical expression. Open
Open
if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.hasClass($.datepicker._triggerClass) &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
$.datepicker._hideDatepicker(null, '');
Function easeInOutCubic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInOutCubic: function (x, t, b, c, d) {
Function easeInQuart
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInQuart: function (x, t, b, c, d) {
Function easeInElastic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInElastic: function (x, t, b, c, d) {
Function easeOutElastic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeOutElastic: function (x, t, b, c, d) {
Function easeInOutElastic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInOutElastic: function (x, t, b, c, d) {
Function easeInOutQuart
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInOutQuart: function (x, t, b, c, d) {
Function easeOutExpo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeOutExpo: function (x, t, b, c, d) {
Function easeInCirc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInCirc: function (x, t, b, c, d) {
Function morph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
morph: function(remove,add,speed,easing,callback) {
Function swing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
swing: function (x, t, b, c, d) {
Function easeInOutQuad
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInOutQuad: function (x, t, b, c, d) {
Function easeInCubic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeInCubic: function (x, t, b, c, d) {
Function easeOutCubic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
easeOutCubic: function (x, t, b, c, d) {