activerecord/lib/active_record/fixtures.rb
Class FixtureSet
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class FixtureSet
require "active_record/fixture_set/file"
require "active_record/fixture_set/render_context"
require "active_record/fixture_set/table_rows"
File fixtures.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require "erb"
require "yaml"
require "zlib"
require "set"
require "active_support/dependencies"
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(_, name, class_name, path, config = ActiveRecord::Base)
Method read_fixture_files
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def read_fixture_files(path)
yaml_files = Dir["#{path}{.yml,/{**,*}/*.yml}"].select { |f|
::File.file?(f)
}
- 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 insert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def insert(fixture_sets, connection_pool) # :nodoc:
fixture_sets_by_pool = fixture_sets.group_by do |fixture_set|
if fixture_set.model_class
fixture_set.model_class.connection_pool
else
- 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"