CartoDB/cartodb20

View on GitHub
lib/carto/ghost_tables_manager.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method fetch_cartodbfied_tables has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def fetch_cartodbfied_tables
      sql = %{
        WITH tables_with_proper_owner_and_schema AS
        (
            SELECT c.oid, c.relname
Severity: Minor
Found in lib/carto/ghost_tables_manager.rb - About 1 hr to fix

    Method fetch_altered_tables has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def fetch_altered_tables
          cartodbfied_tables = fetch_cartodbfied_tables.sort_by(&:id)
          user_tables = fetch_user_tables.sort_by(&:id)
    
          cartodb_table_it = 0
    Severity: Minor
    Found in lib/carto/ghost_tables_manager.rb - About 1 hr to fix

      Method fetch_altered_tables has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def fetch_altered_tables
            cartodbfied_tables = fetch_cartodbfied_tables.sort_by(&:id)
            user_tables = fetch_user_tables.sort_by(&:id)
      
            cartodb_table_it = 0
      Severity: Minor
      Found in lib/carto/ghost_tables_manager.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 link_ghost_tables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def link_ghost_tables
            user_tables = fetch_user_tables
            if (user_tables.length > MAX_USERTABLES_FOR_SYNC_CHECK)
              # When the user has a big amount of tables, we don't even attempt to check if we
              # need to run ghost tables, and instead we request an async link.
      Severity: Minor
      Found in lib/carto/ghost_tables_manager.rb - About 35 mins 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

      There are no issues that match your filters.

      Category
      Status