SysMO-DB/seek

View on GitHub
lib/taverna_player_callbacks.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method fix_file_extensions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def fix_file_extensions(run)
  Dir.mktmpdir("#{run.id}", Rails.root.join("tmp")) do |tmp_dir|
    tmp_zip = File.join(tmp_dir, "all.zip")
    Zip::File.open(run.results.path) do |old_zip|
      Zip::File.open(tmp_zip, Zip::File::CREATE) do |new_zip|
Severity: Minor
Found in lib/taverna_player_callbacks.rb - About 1 hr to fix

    Method fix_run_output_ports_mime_types has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def fix_run_output_ports_mime_types(run)
      run.outputs.each do |output|
        output.metadata = {:size => nil, :type => ''} if output.metadata.nil?
        port = run.executed_workflow.output_ports.detect { |o| o.name == output.name }
        if port && !port.mime_type.blank?
    Severity: Minor
    Found in lib/taverna_player_callbacks.rb - About 55 mins to fix

    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 copy_file_between_zips has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def copy_file_between_zips(src, dest, name, ext)
      if name.ends_with?('.error')
        new_name = name
      else
        new_name = ext.nil? ? name : "#{name}#{ext}"
    Severity: Minor
    Found in lib/taverna_player_callbacks.rb - About 45 mins to fix

    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 recursively_set_mime_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def recursively_set_mime_type(list, depth, type)
      depth -= 1
      list.map do |el|
        if depth == 0
          el == "application/x-error" ? el : type
    Severity: Minor
    Found in lib/taverna_player_callbacks.rb - About 45 mins to fix

    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 fix_file_extensions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def fix_file_extensions(run)
      Dir.mktmpdir("#{run.id}", Rails.root.join("tmp")) do |tmp_dir|
        tmp_zip = File.join(tmp_dir, "all.zip")
        Zip::File.open(run.results.path) do |old_zip|
          Zip::File.open(tmp_zip, Zip::File::CREATE) do |new_zip|
    Severity: Minor
    Found in lib/taverna_player_callbacks.rb - About 25 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status