Showing 8 of 18 total issues
File ffi-ogr.rb
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'ffi'
require 'multi_json'
module OGR
OGR_BASE = File.join(File.dirname(__FILE__), 'ffi-ogr')
Method copy_with_transform
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def copy_with_transform(driver_name, output_path, spatial_ref=nil, driver_options=nil)
writer = OGR::Writer.new driver_name
writer.set_output(output_path)
out = writer.ptr
- 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 parse_db_config
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def parse_db_config(db_config_file)
conf =
if db_config_file.instance_of? String
YAML.load_file(File.expand_path(db_config_file))
elsif db_config_file.instance_of? Hash
- 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
Class Geometry
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Geometry
attr_accessor :ptr
def initialize(ptr)
@ptr = FFI::AutoPointer.new(ptr, self.class.method(:release))
Method copy_with_transform
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def copy_with_transform(driver_name, output_path, spatial_ref=nil, driver_options=nil)
writer = OGR::Writer.new driver_name
writer.set_output(output_path)
out = writer.ptr
Method cast_geometry
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cast_geometry(geom_ptr, auto_free=true)
#options = {auto_free: true}.merge(options)
raise RuntimeError.new("Geometry pointer is NULL") if geom_ptr.null?
geom_type = FFIOGR.OGR_G_GetGeometryType(geom_ptr)
Method to_format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_format(format, output_path, options={})
raise RuntimeError.new("Output path not specified.") if output_path.nil?
spatial_ref = options.delete :spatial_ref
- 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 get_driver_by_extension
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_driver_by_extension(extension)
driver = unless extension == 'kml'
DRIVER_TYPES[extension]
else
drivers.include?('LIBKML') ? 'LIBKML' : 'KML'
- 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"