lib/statesman/adapters/active_record.rb
Class ActiveRecord
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ActiveRecord
JSON_COLUMN_TYPES = %w[json jsonb].freeze
def self.database_supports_partial_indexes?(model)
# Rails 3 doesn't implement `supports_partial_index?`
File active_record.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative "../exceptions"
module Statesman
module Adapters
class ActiveRecord
Method create_transition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def create_transition(from, to, metadata)
transition = transitions_for_parent.build(
default_transition_attributes(to, metadata),
)
- 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 not_most_recent_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def not_most_recent_value(db_cast: true)
if transition_class.columns_hash["most_recent"].null == false
return db_cast ? db_false : false
end
- 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"