Showing 7 of 9 total issues
Method acts_as_mappable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def acts_as_mappable(options = {})
metaclass = (class << self; self; end)
include Geokit::ActsAsMappable
- 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 acts_as_mappable
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def acts_as_mappable(options = {})
metaclass = (class << self; self; end)
include Geokit::ActsAsMappable
Method formulate_bounds_from_distance
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def formulate_bounds_from_distance(options, origin, units)
distance = options[:within] if options.has_key?(:within) && options[:within].is_a?(Numeric)
distance = options[:range].last-(options[:range].exclude_end?? 1 : 0) if options.has_key?(:range)
if distance
Geokit::Bounds.from_point_and_radius(origin,distance,:units=>units)
- 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
Consider simplifying this complex logical expression. Open
if reflection = Geokit::ActsAsMappable.end_of_reflection_chain(self.through, self)
metaclass.instance_eval do
OPTION_SYMBOLS.each do |method_name|
define_method method_name do
reflection.klass.send(method_name)
Method end_of_reflection_chain
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.end_of_reflection_chain(through, klass)
while through
reflection = nil
if through.is_a?(Hash)
association, through = through.to_a.first
- 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 bound_conditions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def bound_conditions(bounds, inclusive = false)
return nil unless bounds
if inclusive
lt_operator = :lteq
gt_operator = :gteq
- 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 distance_conditions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def distance_conditions(options)
origin = extract_origin_from_options(options)
units = extract_units_from_options(options)
formula = extract_formula_from_options(options)
distance_column_name = distance_sql(origin, units, formula)
- 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"