CartoDB/cartodb20

View on GitHub
services/importer/lib/importer/georeferencer.rb

Summary

Maintainability
D
2 days
Test Coverage

Method create_the_geom_from_geometry_column has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
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"
Severity: Minor
Found in services/importer/lib/importer/georeferencer.rb - About 4 hrs to fix

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

    class Georeferencer

      include ::LoggerHelper

      DEFAULT_BATCH_SIZE = 50000
Severity: Minor
Found in services/importer/lib/importer/georeferencer.rb - About 3 hrs to fix

    File georeferencer.rb has 307 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative './column'
    require_relative './job'
    require_relative './query_batcher'
    require_relative './content_guesser'
    
    
    Severity: Minor
    Found in services/importer/lib/importer/georeferencer.rb - About 3 hrs to fix

      Method geocode has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      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)
      Severity: Minor
      Found in services/importer/lib/importer/georeferencer.rb - About 1 hr to fix

        Method geocode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        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)
        Severity: Minor
        Found in services/importer/lib/importer/georeferencer.rb - About 1 hr to fix

        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

              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"
        Severity: Minor
        Found in services/importer/lib/importer/georeferencer.rb - About 1 hr to fix

          Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def initialize(db, table_name, options, schema=DEFAULT_SCHEMA, job=nil, geometry_columns=nil, logger=nil)
          Severity: Major
          Found in services/importer/lib/importer/georeferencer.rb - About 50 mins to fix

            Method geocode has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def geocode(formatter, geometry_type, kind, country_column_name=nil, country=nil)
            Severity: Minor
            Found in services/importer/lib/importer/georeferencer.rb - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status