resque/resque

View on GitHub

Showing 37 of 37 total issues

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

    def perform
      job = payload_class
      job_args = args || []
      job_was_performed = false

Severity: Minor
Found in lib/resque/job.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 each has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.each(offset = 0, limit = self.count, queue = nil, class_name = nil, order = 'desc', &block)
Severity: Minor
Found in lib/resque/failure.rb - About 45 mins to fix

    Method start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def start(path = launch_path)
          logger.info "Running with Windows Settings" if WINDOWS
          logger.info "Running with JRuby" if JRUBY
          logger.info "Starting '#{app_name}'..."
    
    
    Severity: Minor
    Found in lib/resque/web_runner.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 perform_with_fork has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def perform_with_fork(job, &block)
          run_hook :before_fork, job
    
          begin
            @child = fork do
    Severity: Minor
    Found in lib/resque/worker.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 each has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def self.each(offset = 0, limit = self.count, queue = :failed, class_name = nil, order = 'desc')
    Severity: Minor
    Found in lib/resque/failure/redis_multi_queue.rb - About 35 mins to fix

      Method each has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def self.each(offset = 0, limit = self.count, queue = :failed, class_name = nil, order = 'desc')
      Severity: Minor
      Found in lib/resque/failure/redis.rb - About 35 mins to fix

        Method find_port has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def find_port
              if @port = options[:port]
                announce_port_attempted
        
                unless port_open?
        Severity: Minor
        Found in lib/resque/web_runner.rb - About 35 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 count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.count(queue = nil, class_name = nil)
                if queue
                  if class_name
                    n = 0
                    each(0, count(queue), queue, class_name) { n += 1 }
        Severity: Minor
        Found in lib/resque/failure/redis_multi_queue.rb - About 35 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 kill_child has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def kill_child
              if @child
                log_with_severity :debug, "Killing child at #{@child}"
                if `ps -o pid,state -p #{@child}`
                  Process.kill("KILL", @child) rescue nil
        Severity: Minor
        Found in lib/resque/worker.rb - About 35 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 function.
        Open

                  return 'about ' + (parseInt(delta / 3600, 10)).toString() + ' hours ago';
        Severity: Major
        Found in lib/resque/server/public/jquery.relatize_date.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return $r.strftime(fromTime, fmt);
          Severity: Major
          Found in lib/resque/server/public/jquery.relatize_date.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return days + " days ago"
            Severity: Major
            Found in lib/resque/server/public/jquery.relatize_date.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return '1 day ago';
              Severity: Major
              Found in lib/resque/server/public/jquery.relatize_date.js - About 30 mins to fix

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

                    def run_failure_hooks(exception)
                      begin
                        job_args = args || []
                        if has_payload_class?
                          failure_hooks.each { |hook| payload_class.send(hook, exception, *job_args) } unless @failure_hooks_ran
                Severity: Minor
                Found in lib/resque/job.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 decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def decode(object)
                    return unless object
                
                    begin
                      if MultiJson.respond_to?(:dump) && MultiJson.respond_to?(:load)
                Severity: Minor
                Found in lib/resque.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 work_one_job has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def work_one_job(job = nil, &block)
                      return false if paused?
                      return false unless job ||= reserve
                
                      working_on job
                Severity: Minor
                Found in lib/resque/worker.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 register_signal_handlers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def register_signal_handlers
                      trap('TERM') { graceful_term ? shutdown : shutdown!  }
                      trap('INT')  { shutdown!  }
                
                      begin
                Severity: Minor
                Found in lib/resque/worker.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