geokit/geokit-rails

View on GitHub
lib/geokit-rails/acts_as_mappable/class_methods.rb

Summary

Maintainability
A
1 hr
Test Coverage

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)
Severity: Minor
Found in lib/geokit-rails/acts_as_mappable/class_methods.rb - About 45 mins to fix

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
Severity: Minor
Found in lib/geokit-rails/acts_as_mappable/class_methods.rb - About 25 mins to fix

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)
Severity: Minor
Found in lib/geokit-rails/acts_as_mappable/class_methods.rb - About 25 mins to fix

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

There are no issues that match your filters.

Category
Status