Class MasterData
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class MasterData
attr_reader :master_data_file, :model_klass, :columns, :new_records, :updated_records, :no_change_records, :deleted_records,
:before_count, :after_count, :spec_config
# @param [MasterDataTool::MasterDataFile] master_data_file
Method verify!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def verify!(ignore_fail: false)
MasterDataTool::Report::VerifyReport.new(self).tap do |report|
scoped = @model_klass.all
scoped = scoped.preload(preload_associations) if preload_associations
scoped = scoped.eager_load(eager_load_associations) if eager_load_associations
- 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 import!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def import!(dry_run: true, delete_all_ignore_foreign_key: false)
raise MasterDataTool::NotLoadedError unless @loaded
MasterDataTool::Report::ImportReport.new(self).tap do |report|
return report if dry_run
- 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 load
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load
csv = CSV.read(@master_data_file.path, headers: true, skip_blanks: true)
old_records_by_id = @model_klass.all.index_by(&:id)
csv_records_by_id = build_records_from_csv(csv, old_records_by_id)
- 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"