Showing 6 of 8 total issues
Method _encode_geometry
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _encode_geometry(object_, point_encoder_=nil) # :nodoc:
unless point_encoder_
if object_.factory.property(:has_z_coordinate)
if object_.factory.property(:has_m_coordinate)
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.z, p_.m].join(",") }
Method build
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def build
if multi_geometries?
@geo_factory.collection(multi_geometries)
elsif !points.empty?
return nil unless points.kind_of?(::Array)
- 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 build
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build
@text.gsub(/\n/, ' ').strip.split(/\s+/).each do |coord|
x, y, z = coord.split(',')
if x.nil? || y.nil?
fail StandardError, 'Coordinates must have at least x and y elements'
- 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 _encode_geometry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _encode_geometry(object_, point_encoder_=nil) # :nodoc:
unless point_encoder_
if object_.factory.property(:has_z_coordinate)
if object_.factory.property(:has_m_coordinate)
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.z, p_.m].join(",") }
- 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
Avoid deeply nested control flow statements. Open
return nil unless polygons.kind_of?(::Array)
Method multi_geometries?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def multi_geometries?
geometries_counter = 0
geometries_counter += 1 if !points.empty?
geometries_counter += 1 if !line_strings.empty?
- 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"