Showing 8 of 11 total issues
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 execute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def execute
[].tap do |errors|
spec_config.application_record_class.connection.tables.each do |table|
if ignore_tables.include?(table)
print_message "[ignore] #{table}"
- 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 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 execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute
spec_config.application_record_class.transaction do
MasterDataTool::MasterDataStatus.transaction do
print_execute_options
load_master_data_statuses
- 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 print_affected_tables
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def print_affected_tables(master_data_collection)
master_data_collection.each do |master_data|
next unless master_data.loaded?
next unless master_data.affected?
- 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_all!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def import_all!(master_data_collection)
master_data_collection.each do |master_data|
next unless master_data.loaded?
next if import_skip_table?(master_data.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 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"