services/importer/lib/importer/georeferencer.rb
Method create_the_geom_from_geometry_column
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
Open
def create_the_geom_from_geometry_column
column = nil
geometry_column_name = geometry_column_in
return false unless geometry_column_name
job.log "Creating the_geom from #{geometry_column_name} column"
- 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 Georeferencer
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Georeferencer
include ::LoggerHelper
DEFAULT_BATCH_SIZE = 50000
File georeferencer.rb
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative './column'
require_relative './job'
require_relative './query_batcher'
require_relative './content_guesser'
Method geocode
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def geocode(formatter, geometry_type, kind, country_column_name=nil, country=nil)
geocoder = nil
@importer_stats.timing("geocoding.#{kind}") do
@tracker.call('geocoding')
create_the_geom_in(table_name)
Method geocode
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def geocode(formatter, geometry_type, kind, country_column_name=nil, country=nil)
geocoder = nil
@importer_stats.timing("geocoding.#{kind}") do
@tracker.call('geocoding')
create_the_geom_in(table_name)
- 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 create_the_geom_from_geometry_column
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_the_geom_from_geometry_column
column = nil
geometry_column_name = geometry_column_in
return false unless geometry_column_name
job.log "Creating the_geom from #{geometry_column_name} column"
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(db, table_name, options, schema=DEFAULT_SCHEMA, job=nil, geometry_columns=nil, logger=nil)
Method geocode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def geocode(formatter, geometry_type, kind, country_column_name=nil, country=nil)