lib/chrono_model/adapter/upgrade.rb
Method chrono_upgrade_from_postgres_v90
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def chrono_upgrade_from_postgres_v90(table_name)
# roses are red
# violets are blue
# and this is the most boring piece of code ever
history_table = "#{HISTORY_SCHEMA}.#{table_name}"
Method chrono_tables_needing_upgrade
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def chrono_tables_needing_upgrade
tables = {}
on_temporal_schema { self.tables }.each do |table_name|
next unless is_chrono?(table_name)
- 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 chrono_upgrade_structure!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def chrono_upgrade_structure!
transaction do
chrono_tables_needing_upgrade.each do |table_name, desc|
if desc[:version].blank?
logger.info "ChronoModel: Upgrading legacy PG 9.0 table #{table_name} to #{VERSION}"
- 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"