myGrid/taverna-player

View on GitHub
lib/taverna_player/worker.rb

Summary

Maintainability
D
2 days
Test Coverage

Method interactions has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def interactions(run, credentials)
      wait = false

      run.notifications(:requests).each do |note|
        if @run.has_parent?
Severity: Minor
Found in lib/taverna_player/worker.rb - About 7 hrs 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 perform has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def perform
      return unless run_callback(TavernaPlayer.pre_run_callback, "pre-callback")

      status_message("connect")

Severity: Minor
Found in lib/taverna_player/worker.rb - About 3 hrs 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

File worker.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module TavernaPlayer
  class Worker
    include TavernaPlayer::Concerns::Callback
    include TavernaPlayer::Concerns::Zip

Severity: Minor
Found in lib/taverna_player/worker.rb - About 2 hrs to fix

    Method perform has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def perform
          return unless run_callback(TavernaPlayer.pre_run_callback, "pre-callback")
    
          status_message("connect")
    
    
    Severity: Major
    Found in lib/taverna_player/worker.rb - About 2 hrs to fix

      Method interactions has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def interactions(run, credentials)
            wait = false
      
            run.notifications(:requests).each do |note|
              if @run.has_parent?
      Severity: Minor
      Found in lib/taverna_player/worker.rb - About 1 hr to fix

        Method process_outputs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_outputs(run)
              outputs = []
        
              Dir.mktmpdir(run.id, Rails.root.join("tmp")) do |tmp_dir|
                run.output_ports.each_value do |port|
        Severity: Minor
        Found in lib/taverna_player/worker.rb - About 1 hr 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 create_run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_run(server, workflow, credentials)
              retries ||= TavernaPlayer.server_connection_error_retries
              server.create_run(workflow, credentials)
            rescue T2Server::ServerAtCapacityError
              status_message("full")
        Severity: Minor
        Found in lib/taverna_player/worker.rb - About 1 hr 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 failed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def failed(exception, run = nil)
              begin
                unless run.nil?
                  download_log(run)
                  run.delete
        Severity: Minor
        Found in lib/taverna_player/worker.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

        Avoid too many return statements within this method.
        Open

              return unless run_callback(TavernaPlayer.post_run_callback, "post-callback")
        Severity: Major
        Found in lib/taverna_player/worker.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return
          Severity: Major
          Found in lib/taverna_player/worker.rb - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status