lib/carto/ghost_tables_manager.rb
Method fetch_cartodbfied_tables
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def fetch_cartodbfied_tables
sql = %{
WITH tables_with_proper_owner_and_schema AS
(
SELECT c.oid, c.relname
Method fetch_altered_tables
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method fetch_altered_tables
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
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
- 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 link_ghost_tables
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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.
- 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"