Showing 7 of 7 total issues
Class ActiveRecord
has 33 methods (exceeds 20 allowed). Consider refactoring. 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 machine.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "version"
require_relative "exceptions"
require_relative "guard"
require_relative "callback"
require_relative "adapters/memory_transition"
File active_record.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "../exceptions"
module Statesman
module Adapters
class ActiveRecord
Method filter_callbacks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def filter_callbacks(callbacks, from: nil, to: nil)
callbacks.filter_map do |callback|
next if callback.from == from && to.nil?
if callback.to.include?(to) && (from.nil? || callback.from == from)
- 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 remove_transitions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def remove_transitions(from: nil, to: nil)
raise ArgumentError, "Both from and to can't be nil!" if from.nil? && to.nil?
return if successors.nil?
if from.present?
- 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 create_transition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. 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
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"