Method active_scaffold
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def active_scaffold(model_id = nil, &block)
extend Prefixes
# initialize bridges here
ActiveScaffold::Bridges.run_all
- 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 link_for_association
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def link_for_association(column, options = {})
return if (controller = active_scaffold_controller_for_column(column, options)).nil?
options.reverse_merge! :position => :after, :type => :member, :column => column,
:controller => (controller == :polymorph ? controller : "/#{controller.controller_path}")
options[:parameters] ||= {}
- 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 active_scaffold_controller_for
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.active_scaffold_controller_for(klass, controller_namespace = '::')
error_message = []
class_names = [klass.to_s, klass.to_s.demodulize].map { |k| k.underscore.pluralize }.map { |k| [k, k.singularize] }.flatten
[controller_namespace, ''].each do |namespace|
class_names.each do |controller_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
Method active_scaffold
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def active_scaffold(model_id = nil, &block)
extend Prefixes
# initialize bridges here
ActiveScaffold::Bridges.run_all
Method links_for_associations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def links_for_associations
return unless active_scaffold_config.actions.include?(:list) && active_scaffold_config.actions.include?(:nested)
active_scaffold_config.columns.each do |column|
next unless column.link.nil? && column.autolink?
# lazy load of action_link, cause it was really slowing down app in dev mode
- 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 active_record_column_type_cast
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.active_record_column_type_cast(value, column_or_type)
return Time.zone.at(value.to_i) if value =~ /\A\d+\z/ && %i[time datetime].include?(column_or_type.type)
cast_type = column_or_type.is_a?(ActiveRecord::ConnectionAdapters::Column) ? ActiveRecord::Type.lookup(column_or_type.type) : column_or_type
cast_type ? cast_type.cast(value) : value
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"