myGrid/taverna-player

View on GitHub

Showing 26 of 26 total issues

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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def list_port(port, index = [], types = nil)
          types = port.metadata[:type] if types.nil?
        
          content = "<ol>"
          i = 0
        Severity: Major
        Found in lib/generators/templates/callbacks/render_callbacks.rb and 1 other location - About 1 hr to fix
        lib/taverna_player/render_callbacks.rb on lines 44..62

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 67.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def list_tp_default(port, index = [], types = nil)
          types = port.metadata[:type] if types.nil?
        
          content = "<ol>"
          i = 0
        Severity: Major
        Found in lib/taverna_player/render_callbacks.rb and 1 other location - About 1 hr to fix
        lib/generators/templates/callbacks/render_callbacks.rb on lines 66..84

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 67.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

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

                  def set_run_user
                    return if params[:run][:embedded] == "true" || TavernaPlayer.user_proxy.nil?
        
                    unless TavernaPlayer.current_user_callback.blank?
                      user = callback(TavernaPlayer.current_user_callback)
        Severity: Minor
        Found in lib/taverna_player/concerns/controllers/runs_controller.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

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

                def value(*indices)
                  file_path = file.path
                  if depth == 0
                    if file_path.blank?
                      self[:value]
        Severity: Minor
        Found in lib/taverna_player/concerns/models/run_port.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 add_method has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_method(name)
              setter = "#{name}_method_name=".to_sym
              mapper = name
        
              (class << self; self; end).instance_eval do
        Severity: Minor
        Found in lib/taverna_player/model_proxy.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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def show
                  if @run.running?
                    @interaction = Interaction.find_by_run_id_and_replied(@run.id, false)
                    unless @interaction.nil?
                      unless @interaction.displayed
        Severity: Minor
        Found in lib/taverna_player/concerns/controllers/runs_controller.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 cancel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def cancel
                  return unless incomplete?
        
                  # Set the stop flag for all cases.
                  self.stop = true
        Severity: Minor
        Found in lib/taverna_player/concerns/models/run.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

        Avoid too many return statements within this method.
        Open

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

          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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              module Generators
                class ControllersGenerator < Rails::Generators::Base
                  source_root File.expand_path("../../templates/controllers", __FILE__)
            
                  desc "Copy the Taverna Player controllers into the main app for "\
            Severity: Minor
            Found in lib/generators/taverna_player/controllers_generator.rb and 1 other location - About 25 mins to fix
            lib/generators/taverna_player/models_generator.rb on lines 14..23

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 30.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def output
                      # We need to parse out the path into a list of numbers here so we have
                      # a list of indices into the file structure.
                      path = []
                      unless params[:path].nil?
            Severity: Minor
            Found in lib/taverna_player/concerns/controllers/runs_controller.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

            Method cancel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def cancel
                      @run.cancel unless @run.complete?
            
                      respond_with(@run, :action => :show) do |format|
                        format.html do
            Severity: Minor
            Found in lib/taverna_player/concerns/controllers/runs_controller.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

            Severity
            Category
            Status
            Source
            Language