Showing 27 of 27 total issues
Avoid deeply nested control flow statements. Open
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
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]);
Function remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
jQuery.event.add = function( elem, types, handler, data, selector ){
Method assign_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign_class(base, added)
base = [base] if base.is_a? String
if added.present?
base << added if added.is_a? String
base += added if added.is_a? Array
- 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 redde_tree_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def redde_tree_list collection, &block
collection.each do |item|
controls = content_tag(:div, link_to('Удал', url_for(action: :show, id: item), class: 'a_del sort-tree__btn', data: { confirm: 'Точно удалить?' }, method: 'delete'), class: 'sort-tree__controls')
link = link_to title_for(item), url_for(action: :edit, id: item), class: 'sort-tree__link'
html = content_tag :div, (block_given? ? capture(item, &block) : link).concat(controls), class: 'sort-tree__wrap', 'data-sort-tree-tolerance' => ""
- 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 make_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def make_options(options)
return options.merge(html: { class: 'redde-form' }) unless options.key?(:html)
unless options[:html].key?(:class)
options[:html][:class] = 'redde-form'
return options
- 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"