integrallis/geomodel

View on GitHub

Showing 9 of 13 total issues

Method proximity_fetch has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  def self.proximity_fetch(center, query_runner, max_results = 10, max_distance = 0)
    results = []
  
    searched_cells = Set.new
    
Severity: Minor
Found in lib/geomodel.rb - About 5 hrs 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 adjacent has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def self.adjacent(cell, dir)
      return nil if cell.nil?

      dx = dir[0]
      dy = dir[1]
Severity: Minor
Found in lib/geomodel/geocell.rb - About 3 hrs 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 proximity_fetch has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.proximity_fetch(center, query_runner, max_results = 10, max_distance = 0)
    results = []
  
    searched_cells = Set.new
    
Severity: Major
Found in lib/geomodel.rb - About 2 hrs to fix

    Method adjacent has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.adjacent(cell, dir)
          return nil if cell.nil?
    
          dx = dir[0]
          dy = dir[1]
    Severity: Minor
    Found in lib/geomodel/geocell.rb - About 1 hr to fix

      Method interpolate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.interpolate(cell_ne, cell_sw)
            # 2D array, will later be flattened.
            cell_set = [[cell_sw]]
      
            # First get adjacent geocells across until Southeast--collinearity with
      Severity: Minor
      Found in lib/geomodel/geocell.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 best_bbox_search_cells has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.best_bbox_search_cells(bbox, cost_function)
      
            cell_ne = compute(bbox.north_east, MAX_GEOCELL_RESOLUTION)
            cell_sw = compute(bbox.south_west, MAX_GEOCELL_RESOLUTION)
      
      
      Severity: Minor
      Found in lib/geomodel/geocell.rb - About 35 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 point_distance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.point_distance(cell, point)
            bbox = compute_box(cell)
      
            between_w_e = bbox.west <= point.lon && point.lon <= bbox.east
            between_n_s = bbox.south <= point.lat && point.lat <= bbox.north
      Severity: Minor
      Found in lib/geomodel/geocell.rb - About 35 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 collinear has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.collinear(cell1, cell2, column_test)
            upto = [cell1.size, cell2.size].min - 1
            
            (0..upto).each do |i|
              x1, y1 = subdiv_xy(cell1[i])
      Severity: Minor
      Found in lib/geomodel/geocell.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(latitude, longitude)
            if -90 > latitude || latitude > 90
              raise ArgumentError.new("Latitude must be in [-90, 90]") 
            else
              @latitude = latitude
      Severity: Minor
      Found in lib/geomodel/geotypes.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

      Severity
      Category
      Status
      Source
      Language