Showing 10 of 12 total issues
Method define_association_methods
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def define_association_methods(association,attr_class)
# Accessor
# return empty array or @association variable for each association
define_method association 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
Class LogicalModel
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class LogicalModel
module RESTActions
def self.included(base)
base.send(:include, InstanceMethods)
File rest_actions.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
class LogicalModel
module RESTActions
def self.included(base)
base.send(:include, InstanceMethods)
Method define_association_methods
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_association_methods(association,attr_class)
# Accessor
# return empty array or @association variable for each association
define_method association do
Method belongs_to
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def belongs_to(key, options = {})
attr_accessor "#{key}_id"
attr_class = get_attr_class(key, options)
@belongs_to_keys ||= {}
- 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 belongs_to
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def belongs_to(key, options = {})
attr_accessor "#{key}_id"
attr_class = get_attr_class(key, options)
@belongs_to_keys ||= {}
Method _create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _create(params = {})
unless params[:ignore_validation]
return false unless valid?
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 async_paginate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def async_paginate(options={})
options[:page] ||= 1
options[:per_page] ||= 20
options = self.merge_key(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 logger
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def logger
unless @logger
@logger = Logger.new(self.log_path || "log/logical_model.log")
if defined?(Rails)
@logger.level = Rails.logger.level
- 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 encoded?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def encoded?(hash)
return false if hash.empty?
if hash.keys.size > 1
keys = hash.keys.map{|i| i.to_i if i.respond_to?(:to_i)}.sort
keys == hash.keys.size.times.to_a
- 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"