Showing 87 of 119 total issues
Method has_dynamic_attributes
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def has_dynamic_attributes(options={})
@has_dynamic_attributes = true
include InstanceMethods
# Provide default options
Method connected_to
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def connected_to(b)
if b.is_a?(Hash)
obj = b[:connectable]
if obj.class.versioned?
ver = b[:version] ? b[:version] : obj.version
- 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 validates_attachment_size
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def validates_attachment_size(name, options = {})
min = options[:greater_than] || (options[:in] && options[:in].first) || 0
max = options[:less_than] || (options[:in] && options[:in].last) || (1.0/0)
range = (min..max)
- 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 menu_items
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def menu_items(options = {})
# Intialize parameters
selected_page = options[:page] || @page
return nil unless selected_page
Method is_searchable
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def is_searchable(options={})
@is_searchable = true
@searchable_columns = options[:searchable_columns] ? options[:searchable_columns].map(&:to_sym) : [:name]
extend ClassMethods
- 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_content_table
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_content_table(table_name, options={}, &block)
defaults = {
versioned: true,
name: true
}
Method render_connectable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def render_connectable(content_block)
if content_block
if content_block.class.renderable?
Rails.logger.debug "Rendering connectable #{content_block.class} ##{content_block.id} #{"v#{content_block.version}" if content_block.respond_to?(:version)}"
content_block.perform_render(controller)
- 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 prepare_connectables_for_render
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def prepare_connectables_for_render
@_connectors = @page.current_connectors
@_connectables = @page.contents
unless (logged_in? && current_user.able_to?(:administrate, :edit_content, :publish_content))
- 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 is_addressable
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def is_addressable(options={})
has_one_options = {as: :node, inverse_of: :node, class_name: 'Cms::SectionNode', validate: true}
unless options[:destroy_if]
has_one_options[:dependent] = :destroy
else
Method content_blocks
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def content_blocks(content_block_name, options = {}, &block)
options = DEFAULT_CONTENT_BLOCKS_OPTIONS.merge options
model_class = guess_model_class(content_block_name)
# options to
Method render_breadcrumbs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def render_breadcrumbs(options={})
return "" unless current_page
start = options[:from_top] || 0
show_parent = options[:show_parent].nil? ? false : options[:show_parent]
- 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 is_addressable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def is_addressable(options={})
has_one_options = {as: :node, inverse_of: :node, class_name: 'Cms::SectionNode', validate: true}
unless options[:destroy_if]
has_one_options[:dependent] = :destroy
else
- 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 redirect_non_cms_users_to_public_site
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def redirect_non_cms_users_to_public_site
@show_toolbar = false
if using_cms_subdomains?
logger.debug "Using cms subdomain is enabled"
if request_is_for_cms_subdomain?
- 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 perform_render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def perform_render(controller)
return "Exception: #{@render_exception}" if @render_exception
unless @controller
- 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 publish!
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def publish!
did_publish = false
if new_record?
ActiveSupport::Deprecation.warn "Calling .publish! on a new record no longer saves the record. Call '.save' to persist and publish the record.", caller
else
Method update
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
content_block = Content.find_draft(params[:content_name], params[:id])
content_block.update_attributes(filtered_content(content_block))
@page = Page.find_draft(params[:page_id].to_i)
if (!@page.live?)
Function init
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
init:function (editor) {
editor.ui.addButton('DeleteContent', {
label:'Remove this content from the page (It will remain in Content Library)',
command:'deleteContent',
toolbar:'tools'
Function saveChanges
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
saveChanges: function(currentEditor, afterSave) {
var block_id = currentEditor.name;
var block = $("#" + block_id);
var attribute = block.data('attribute');
var content_name = block.data('content-name');
Method is_versioned
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def is_versioned(options={})
@is_versioned = true
@version_table_name = (options[:version_table_name] || "#{table_name.singularize}_versions").to_s
Method acts_as_content_block
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def acts_as_content_block(options={})
defaults = {
# Set default values here.
allow_attachments: true,
content_module: true,