lib/ddr/managers/derivatives_manager.rb
Method update_derivatives
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_derivatives(schedule=SCHEDULE_LATER)
raise ArgumentError, "Must be one of #{SCHEDULES}" unless SCHEDULES.include?(schedule)
Ddr::Derivatives::DERIVATIVES.values.each do |derivative|
if Ddr::Derivatives.update_derivatives.include?(derivative.name)
# Need to update derivative if object has a datastream for this type of derivative and
- 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 generate_derivative!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def generate_derivative!(derivative)
tempdir_path = File.join(Dir.tmpdir, Dir::Tmpname.make_tmpname('',nil))
begin
tempdir = FileUtils.mkdir(tempdir_path).first
generator_source_path = source_datastream.external? ? source_datastream.file_path
- 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"