nofxx/georuby

View on GitHub

Showing 57 of 91 total issues

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

      def bounding_box
        if !with_z
          @rings[0].bounding_box
        else
          result = @rings[0].bounding_box # valid for x and y
Severity: Minor
Found in lib/geo_ruby/simple_features/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

Avoid deeply nested control flow statements.
Open

            if (e[0] == 'coordinates')
              parse_coordinates(@buffer)
              @buffer = '' # clear the buffer
            end
Severity: Major
Found in lib/geo_ruby/kml.rb - About 45 mins to fix

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

          def m_range
            if with_m
              max_m, min_m = -Float::MAX, Float::MAX
              each do |lr|
                lrmr = lr.m_range
    Severity: Minor
    Found in lib/geo_ruby/simple_features/geometry_collection.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 set_x_y_z has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def set_x_y_z(x, y, z)
            @x = x && !x.is_a?(Numeric) ? x.to_f : x
            @y = y && !y.is_a?(Numeric) ? y.to_f : y
            @z = z && !z.is_a?(Numeric) ? z.to_f : z
            self
    Severity: Minor
    Found in lib/geo_ruby/simple_features/point.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def initialize(name, type, length, decimal = 0, version = 1, enc = nil)
    Severity: Minor
    Found in lib/geo_ruby/shp4r/dbf.rb - About 45 mins to fix

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

            def m_range
              if with_m
                max_m, min_m = -Float::MAX, Float::MAX
                each do |lr|
                  lrmr = lr.m_range
      Severity: Minor
      Found in lib/geo_ruby/simple_features/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 get_next_token has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_next_token
              if @scanner.scan(@regex).nil?
                if @scanner.eos?
                  nil
                else
      Severity: Minor
      Found in lib/geo_ruby/ewk/ewkt_parser.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 from_x_y_z_m has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def self.from_x_y_z_m(x, y, z, m, srid = DEFAULT_SRID)
      Severity: Minor
      Found in lib/geo_ruby/simple_features/point.rb - About 35 mins to fix

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

              def ellipsoidal_distance(point, a = 6_378_137.0, b = 6_356_752.3142)
                f = (a - b) / a
                l = (point.lon - lon) * DEG2RAD
        
                u1 = Math.atan((1 - f) * Math.tan(lat * DEG2RAD))
        Severity: Minor
        Found in lib/geo_ruby/simple_features/point.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 get_record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def get_record(index)
                return nil if record_count <= index || index < 0
                dbf_record = @dbf.record(index)
                @shx.seek(100 + 8 * index) # 100 is the header length
                offset, length = @shx.read(8).unpack('N2')
        Severity: Minor
        Found in lib/geo_ruby/shp4r/shp.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 == has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def ==(other)
              if (self.class != other.class) || (features.size != other.features.size)
                return false
              else
                features.each_index do |index|
        Severity: Minor
        Found in lib/geo_ruby/geojson.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 orthogonal_distance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def orthogonal_distance(line, tail = nil)
                head, tail  = tail ?  [line, tail] : [line[0], line[-1]]
                a, b = @x - head.x, @y - head.y
                c, d = tail.x - head.x, tail.y - head.y
        
        
        Severity: Minor
        Found in lib/geo_ruby/simple_features/point.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 parse_geometry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_geometry
                @unpack_structure.endianness = @unpack_structure.read_byte
                geometry_type = @unpack_structure.read_uint
        
                if (geometry_type & Z_MASK) != 0
        Severity: Minor
        Found in lib/geo_ruby/ewk/ewkb_parser.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 as_kml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def as_kml(options = {})
                id_attr = ''
                id_attr = " id=\"#{options[:id]}\"" if options[:id]
        
                geom_data = ''
        Severity: Minor
        Found in lib/geo_ruby/simple_features/geometry.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 as_ewkb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def as_ewkb(allow_srid = true, allow_z = true, allow_m = true)
                ewkb = 1.chr # little_endian by default
        
                type = binary_geometry_type
                type |= Z_MASK if @with_z && allow_z
        Severity: Minor
        Found in lib/geo_ruby/simple_features/geometry.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 from_coordinates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.from_coordinates(coords, srid = DEFAULT_SRID, z = false, m = false)
                if !(z || m)
                  from_x_y(coords[0], coords[1], srid)
                elsif z && m
                  from_x_y_z_m(coords[0], coords[1], coords[2], coords[3], srid)
        Severity: Minor
        Found in lib/geo_ruby/simple_features/point.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 parse_point has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_point
                @factory.begin_geometry(Point, @srid)
                x, y = *@unpack_structure.read_point
                if ! (@with_z || @with_m) # most common case probably
                  @factory.add_point_x_y(x, y)
        Severity: Minor
        Found in lib/geo_ruby/ewk/ewkb_parser.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