Showing 11 of 17 total issues
Function _mouseDrag
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
_mouseDrag: function(event) {
//Compute the helpers position
this.position = this._generatePosition(event);
this.positionAbs = this._convertPositionTo("absolute");
Class Page
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Page < ActiveRecord::Base
include ActiveSupport::Inflector
include TheSortableTree::Scopes
# Adding has_many for all field types
File jquery.ui.nestedSortable.js
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* jQuery UI Nested Sortable
* v 1.3.5 / 21 jun 2012
* http://mjsarfatti.com/code/nestedSortable
*
Method ids_by_params
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def ids_by_params(params)
_hash = {}
params.each_pair do |key, value|
next if key == 'utf8'
- 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
Function toArray
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
toArray: function(options) {
var o = $.extend({}, this.options, options),
sDepth = o.startDepthCount || 0,
ret = [],
Consider simplifying this complex logical expression. Open
if (!o.isAllowed(this.currentItem, parentItem) ||
parentItem && parentItem.hasClass(o.disableNesting) ||
o.protectRoot && (parentItem == null && !isRoot || isRoot && level > 1)) {
this.placeholder.addClass(o.errorClass);
if (maxLevels < levels && maxLevels != 0) {
Method update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update
unless @field.type_value == params[:field][:type_value]
@field.type_class.where(field_id: @field.id).each do |field|
_field = "constructor_pages/types/#{params[:field][:type_value]}_type".classify.constantize.new(field_id: @field.id, page_id: field.page_id)
- 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
Method find_page_in_branch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_page_in_branch(cname)
Template.find_by(code_name: cname.singularize).tap {|t| t || return
(descendants.where(template_id: t.id) if cname == cname.pluralize).tap {|r| r ||= []
return r.empty? ? ancestors.find_by(template_id: t.id) : r}}
end
- 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
Consider simplifying this complex logical expression. Open
if (parentItem != null && nextItem == null &&
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) ||
!o.rtl && (this.positionAbs.left < parentItem.offset().left))) {
parentItem.after(this.placeholder[0]);
this._clearEmpty(parentItem[0]);
Method search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def search(what = nil)
_hash, _array = {}, []
@where = Page.find_by(full_url: @where) if @where.is_a?(String)
_array = ['lft > ? and rgt < ?', @where.lft, @where.rgt] if @where
if what
- 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
Method check_code_name
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_code_name(cname)
[cname.pluralize, cname.singularize].each {|name|
return false if root.descendants.map{|t| t.code_name unless t.code_name == cname}.include?(name)}
true
end
- 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"