Showing 87 of 119 total issues
Method acts_as_content_block
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def acts_as_content_block(options={})
defaults = {
# Set default values here.
allow_attachments: true,
content_module: true,
- 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 ContentBlockController
has 52 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentBlockController < Cms::BaseController
include Cms::ContentRenderingSupport
allow_guests_to [:show_via_slug]
Class Page
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Cms::Page < ActiveRecord::Base
def actual_path
path
end
Method menu_items
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def menu_items(options = {})
# Intialize parameters
selected_page = options[:page] || @page
return nil unless selected_page
- 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 tagList
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.tagList = function(tags) {
var tagListInput = this;
var tagSeparator = " ";
var getTagList = function() {
Class Attachment
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Attachment < ActiveRecord::Base
MULTIPLE = 'multiple'
SANITIZATION_REGEXES = [[/\s/, '_'], [/[&+()]/, '-'], [/[=?!'"{}\[\]#<>%]/, '']]
File content_block_controller.rb
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'cms/category_type'
# This is not called directly
# This is the base class for other content blocks
module Cms
class ContentBlockController < Cms::BaseController
Class Section
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Section < ActiveRecord::Base
flush_cache_on_change
is_addressable no_dynamic_path: true, destroy_if: :deletable?
# Cannot use dependent => :destroy to do this. Ancestry's callbacks trigger before the before_destroy callback.
Class Portlet
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Portlet < ActiveRecord::Base
validates_presence_of :name
is_searchable
uses_soft_delete
has_content_type :module => :core
File page.rb
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Cms::Page < ActiveRecord::Base
def actual_path
path
end
Class ContentType
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentType
attr_accessor :name
def initialize(options)
Method content_blocks
has a Cognitive Complexity of 20 (exceeds 5 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
- 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 copy_connectors
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def copy_connectors(options={})
logger.debug { "Copying connectors from Page #{id} v#{options[:from_version_number]} to v#{options[:to_version_number]}." }
c_found = connectors.for_page_version(options[:from_version_number]).order("#{Cms::Connector.table_name}.container, #{Cms::Connector.table_name}.position").to_a
logger.debug { "Found connectors #{c_found}" }
- 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 a Cognitive Complexity of 19 (exceeds 5 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
- 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 input
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def input(_wrapper_options = nil)
# New blocks will not have their attachments created yet.
object.ensure_attachment_exists if object.respond_to?(:ensure_attachment_exists)
# Need to explictly use correct id (i.e. image_block_file) rather than the autogenerated one (i.e. image_block_attachments_attributes_0_attachment_name)
- 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 cmsContentToolbar
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.cmsContentToolbar = function () {
var content_type = this.data('content_type')
var is_versioned = this.data('versioned')
var can_publish = this.data('can_publish')
var plural_title = this.data('plural_title')
Method create_content_table
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create_content_table(table_name, options={}, &block)
defaults = {
versioned: true,
name: true
}
- 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 complete
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def complete
if params[:task_ids]
Task.where(["id in (?)", params[:task_ids]]).each do |t|
if t.assigned_to == current_user
t.mark_as_complete!
- 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 content_block_tr_tag
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def content_block_tr_tag(block)
cname = class_name_for(block)
can_modify = current_user.able_to_modify?(block)
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"
Further reading
Method has_dynamic_attributes
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def has_dynamic_attributes(options={})
@has_dynamic_attributes = true
include InstanceMethods
# Provide default 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"