ioquatix/geospatial

View on GitHub

Showing 11 of 15 total issues

Method each has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def each(depth: 0)
            # TODO using a range tree might allow a significantly improved implementation.
            @curve.traverse do |child_origin, child_size, prefix, order|
                child = Box.new(Vector.elements(child_origin), Vector.elements(child_size))
                
Severity: Minor
Found in lib/geospatial/filter.rb - About 1 hr 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 map has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.map(hilbert_axes, bits)
            x = hilbert_axes.dup
            n = x.length # n: Number of dimensions
            m = 1 << (bits - 1)
            
Severity: Minor
Found in lib/geospatial/hilbert.rb - About 1 hr to fix

    Method map has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def self.map(hilbert_axes, bits)
                x = hilbert_axes.dup
                n = x.length # n: Number of dimensions
                m = 1 << (bits - 1)
                
    Severity: Minor
    Found in lib/geospatial/hilbert.rb - About 1 hr 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 bounding_box has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def bounding_box(distance, radius = R)
                raise ArgumentError.new("Invalid distance or radius") if distance < 0 or radius < 0
    
                # angular distance in radians on a great circle
                angular_distance = distance / radius
    Severity: Minor
    Found in lib/geospatial/location.rb - About 55 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 winding_number has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def winding_number(p)
                count = 0
                
                edges.each do |pa, pb|
                    if pa[1] <= p[1]
    Severity: Minor
    Found in lib/geospatial/polygon.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 traverse_recurse has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                def traverse_recurse(order, mask, value, origin, size, &block)
    Severity: Minor
    Found in lib/geospatial/hilbert/curve.rb - About 45 mins to fix

      Method unmap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.unmap(transposed_index, bits)
                  x = transposed_index.dup #var X = (uint[])transposedIndex.Clone();
                  n = x.length # n: Number of dimensions
                  m = 1 << bits
                  
      Severity: Minor
      Found in lib/geospatial/hilbert.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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def add(prefix, order)
                  if last = @ranges.last
                      raise ArgumentError.new("Cannot add non-sequential prefix") unless prefix > last.max
                  end
                  
      Severity: Minor
      Found in lib/geospatial/filter.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 traverse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def traverse(region, depth: 0)
                  @curve.traverse do |child_origin, child_size, prefix, order|
                      child = Box.new(Vector.elements(child_origin), Vector.elements(child_size))
                      
                      # puts "Considering (order=#{order}) #{child.inspect}..."
      Severity: Minor
      Found in lib/geospatial/map.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 each has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def each
                  return to_enum unless block_given?
                  
                  @derivative.each_with_index do |y2, x2|
                      x1 = x2 - 1
      Severity: Minor
      Found in lib/geospatial/histogram.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 enclosing_points has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

                  def enclosing_points(points)
                      return nil unless points.any?
                      
                      min = points.first.to_a
                      max = points.first.to_a
      Severity: Minor
      Found in lib/geospatial/box.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