Showing 23 of 27 total issues
Method admin_resources
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def admin_resources(*resources, &block)
options = resources.extract_options!.dup
if apply_common_behavior_for(:admin_resources, resources, options, &block)
return self
- 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 editorConfig
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
CKEDITOR.editorConfig = function (config) {
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
- 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
Class DataItems
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class DataItems
include ::Enumerable
def initialize
@data_items = {}
Class DataItem
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class DataItem
# TODO extract sub classes
attr_accessor :name, :field, :relation, :label, :uploader, :order_column, :form_params,
Class ModelController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ModelController < RademadeAdmin::AbstractController
extend RademadeAdmin::ModelOptions
include RademadeAdmin::InstanceOptions
Function editorConfig
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
CKEDITOR.editorConfig = function (config) {
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
Method _map_relations
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _map_relations
relations = {}
@model.reflections.each do |name, relation_info|
name = name.to_sym
type = relation_info.macro
- 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 _map_relations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _map_relations
relations = {}
@model.relations.each do |name, relation_info|
name = name.to_sym
type = relation_info.relation.macro
- 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 build_items
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def build_items
data_items = RademadeAdmin::Model::Info::DataItems.new
used_relations = []
# TODO extract sub - methods
- 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 admin_resources
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def admin_resources(*resources, &block)
options = resources.extract_options!.dup
if apply_common_behavior_for(:admin_resources, resources, options, &block)
return self
Method template_paths
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def template_paths
@template_paths ||= {
:main_layout => layout_path('main'),
:login_layout => layout_path('login'),
:content_item_layout => layout_path('content_item'),
Method delete_other_images
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_other_images(image_path)
filename = File.basename(image_path)
store_path = full_image_path(store_dir)
- 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 crop
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def crop(image_path, x, y, width, height)
Method collect_where_conditions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def collect_where_conditions(where_conditions)
condition = ''
values = []
where_conditions.parts.each do |part|
condition += " #{where_conditions.type.to_s.capitalize} " unless condition.empty?
- 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_model_upload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def save_model_upload(data_item, image_path)
if item.try(:translation).respond_to? data_item.setter
entity = item.translation
else
entity = item
- 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 collect_children
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def collect_children(menu_key)
menu = []
menu_key = menu_key.to_s
unless @menu_data[menu_key].nil?
@menu_data[menu_key].each do |model_info|
- 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 display_item_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def display_item_value(item, data_item)
if data_item.list_preview_handler.nil?
value = item.send(data_item.list_preview_accessor)
return display_upload_item(value) if data_item.has_uploader?
return display_related_item(data_item, item, value) if data_item.has_relation?
- 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_localizable_fields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def save_localizable_fields
current_locale = I18n.locale
@model_info.data_items.localizable_fields.each do |_, data_item|
values = @params[:data].try(:[], data_item.name)
values.each do |locale, 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 default_field_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def default_field_type(data_item)
if data_item.gallery_relation?
:'rademade_admin/gallery'
elsif data_item.has_relation?
:'rademade_admin/related_select'
- 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 localizable?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def localizable?(localizable = true)
if !@form_params.nil? && @form_params.has_key?(:localize)
@form_params[:localize] == localizable
else
return !localizable unless has_field?
- 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"