Showing 18 of 1,029 total issues
Function udongo_autocomplete
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.udongo_autocomplete = function(options) {
var original_input = this;
var settings = $.extend({
minLength: 2,
on_add: function(item) { return true; },
Function udongo_tagbox
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.udongo_tagbox = function(options) {
var settings = $.extend({
items: 'items-path',
limit: null,
minLength: 2,
Method resize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def resize(path)
gravity = @options.key?(:gravity) ? @options[:gravity] : 'Center'
img = MiniMagick::Image.open(@file)
cols, rows = img[:dimensions]
- 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 contextmenu_items
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
contextmenu_items: function(node) {
return {
make_invisible: {
separator_before: true,
separator_after: false,
Function init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function() {
$('#content-rows .cards').sortable({
axis: 'y',
handle: '.card-header',
update: sortable.update_position_listener,
Method url
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def url(width = nil, height = nil, options = {})
options[:action] = :resize_to_limit unless options.key?(:action)
if width.nil? && height.nil?
return "/uploads/assets/#{main_dir}/#{second_dir}/#{@asset.actual_filename}"
- 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 address
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def address(category = nil)
category = self.class.address_config.default unless category.present?
unless self.class.address_config.allowed?(category)
raise "You can't select the '#{category}' address because it's not an allowed category"
- 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 replace_vars
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def replace_vars(content, vars, conditionals_allowed = true, prefix: nil)
vars.each do |key, value|
key = "#{prefix}.#{key}" if prefix.present?
if value.respond_to?(:each)
- 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 dnd_check_callback
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dnd_check_callback: function(operation, node, node_parent, node_position, more) {
Method init_values
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def init_values
stores.pluck(:name, :value).each do |field, value|
next unless @config.allowed?(field)
next if @config.fields[field.to_sym][:type].to_s.include?('Uploader')
send "#{field}=", value
- 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 resize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resize(path)
gravity = @options.key?(:gravity) ? @options[:gravity] : 'Center'
background = @options.key?(:background) ? @options[:background] : :transparant
img = MiniMagick::Image.open(@file)
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update(categories, default: nil)
unless categories.respond_to?(:each) && categories.any?
raise 'Please provide an array with address categories'
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
Method object_label
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def object_label(value, locale)
obj = Udongo::ObjectPath.remove_symbols(value)
obj = obj.last if obj.is_a?(Array)
I18n.with_locale(locale) do
- 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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
admin = Admin.find_by(email: params[:session][:email])
if admin && admin.authenticate(params[:session][:password])
session[:admin_id] = admin.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 add_stylesheets_to_precompile_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_stylesheets_to_precompile_list(path)
glob_files(path) do |f|
filepath = f.split('stylesheets/').last
filename = filepath.split('.').join('.')
next if filename.split('/').last[0] == '_'
- 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 parents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parents(instance: nil, list: [], include_self: true)
instance = self unless instance.present?
list << instance if include_self
instance.parent ? parents(instance: instance.parent, list: list) : list
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
Method search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search
return [] unless term.valid?
::SearchTerm.create!(locale: controller.locale, term: term.value)
- 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 save_flexible_content_search_indices!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_flexible_content_search_indices!
content_rows.each do |row|
row.columns.each do |column|
next unless column.content.is_a?(ContentText)
key = "flexible_content:#{column.content_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"