app/connectors/importer.rb
Class Importer
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Importer
include ::LoggerHelper
ORIGIN_SCHEMA = 'cdb_importer'
DESTINATION_SCHEMA = 'public'
File importer.rb
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'carto/importer/table_setup'
require_relative '../models/visualization/support_tables'
require_relative '../../lib/carto/ghost_tables_manager'
require_dependency 'carto/db/user_schema'
Method register
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
def register(result)
@support_tables_helper.reset
log("Before renaming from #{result.table_name} to #{result.name}")
names_taken = overwrite_strategy? ? [] : taken_names
- 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 register
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def register(result)
@support_tables_helper.reset
log("Before renaming from #{result.table_name} to #{result.name}")
names_taken = overwrite_strategy? ? [] : taken_names
Method compatible_schemas_for_overwrite?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def compatible_schemas_for_overwrite?(name)
orig_schema = user.in_database.schema(results.first.tables.first, reload: true, schema: ORIGIN_SCHEMA)
dest_schema = user.in_database.schema(name, reload: true, schema: user.database_schema)
# NOTE: Sanitize columnn names from 'orig_schema' due to the 'dest_schema' columns were
- 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"