Class Loader
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Loader
include ::LoggerHelper
SCHEMA = 'cdb_importer'
File loader.rb
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative './ogr2ogr'
require_relative './exceptions'
require_relative './format_linter'
require_relative './csv_normalizer'
require_relative './shp_normalizer'
Method check_for_import_errors
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def check_for_import_errors
raise DuplicatedColumnError.new if ogr2ogr.duplicate_column?
raise InvalidGeoJSONError.new if ogr2ogr.invalid_geojson?
raise TooManyColumnsError.new if ogr2ogr.too_many_columns?
- 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 check_for_import_errors
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_for_import_errors
raise DuplicatedColumnError.new if ogr2ogr.duplicate_column?
raise InvalidGeoJSONError.new if ogr2ogr.invalid_geojson?
raise TooManyColumnsError.new if ogr2ogr.too_many_columns?
Method post_ogr2ogr_tasks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def post_ogr2ogr_tasks(datasource_name = nil)
georeferencer.mark_as_from_geojson_with_transform if post_import_handler.has_transform_geojson_geom_column?
job.log 'Georeferencing...'
georeferencer.run
- 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 ogr2ogr_options
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def ogr2ogr_options
ogr_options = { encoding: encoding }
unless options[:ogr2ogr_binary].nil?
ogr_options.merge!(ogr2ogr_binary: options[:ogr2ogr_binary])
end
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(job, source_file, layer = nil, ogr2ogr = nil, georeferencer = nil)
Method run_ogr2ogr
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_ogr2ogr(append_mode=false)
# INFO: This is a workaround for the append mode
# Currently it is only used for arcgis importer. In order for this to work
# properly, it must always be executed before cartodbfy.
remove_primary_key if append_mode
- 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"