resque/resque

View on GitHub

Showing 37 of 37 total issues

Class Worker has 79 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Worker
    include Resque::Helpers
    extend Resque::Helpers
    include Resque::Logging

Severity: Major
Found in lib/resque/worker.rb - About 1 day to fix

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

    require 'time'
    require 'set'
    require 'redis/distributed'
    
    module Resque
    Severity: Major
    Found in lib/resque/worker.rb - About 1 day to fix

      Class WebRunner has 32 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class WebRunner
          attr_reader :app, :app_name, :filesystem_friendly_app_name,
            :rack_handler, :port, :options, :args
      
          PORT       = 5678
      Severity: Minor
      Found in lib/resque/web_runner.rb - About 4 hrs to fix

        File resque.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'mono_logger'
        require 'redis/namespace'
        require 'forwardable'
        
        require 'resque/version'
        Severity: Minor
        Found in lib/resque.rb - About 3 hrs to fix

          File web_runner.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'open-uri'
          require 'logger'
          require 'optparse'
          require 'fileutils'
          require 'rack'
          Severity: Minor
          Found in lib/resque/web_runner.rb - About 3 hrs to fix

            Class Job has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Job
                include Helpers
                extend Helpers
                def redis
                  Resque.redis
            Severity: Minor
            Found in lib/resque/job.rb - About 3 hrs to fix

              Method work has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  def work(interval = 5.0, &block)
                    interval = Float(interval)
                    startup
              
                    loop do
              Severity: Minor
              Found in lib/resque/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

              Method new_kill_child has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  def new_kill_child
                    if @child
                      unless child_already_exited?
                        if pre_shutdown_timeout && pre_shutdown_timeout > 0.0
                          log_with_severity :debug, "Waiting #{pre_shutdown_timeout.to_f}s for child process to exit"
              Severity: Minor
              Found in lib/resque/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

              Method prune_dead_workers has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  def prune_dead_workers
                    return unless data_store.acquire_pruning_dead_worker_lock(self, Resque.heartbeat_interval)
              
                    all_workers = Worker.all
              
              
              Severity: Minor
              Found in lib/resque/worker.rb - About 2 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 setup_rack_handler has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def setup_rack_handler
                    # First try to set Rack handler via a special hook we honor
                    @rack_handler = if @app.respond_to?(:detect_rack_handler)
                      @app.detect_rack_handler
              
              
              Severity: Minor
              Found in lib/resque/web_runner.rb - About 2 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 page_entries_info has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def page_entries_info(start, stop, size, name = nil)
                    if size == 0
                      name ? "No #{name}s" : '<b>0</b>'
                    elsif size == 1
                      'Showing <b>1</b>' + (name ? " #{name}" : '')
              Severity: Minor
              Found in lib/resque/server_helper.rb - About 2 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 data_store.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Resque
                # An interface between Resque's persistence and the actual
                # implementation.
                class DataStore
                  extend Forwardable
              Severity: Minor
              Found in lib/resque/data_store.rb - About 2 hrs to fix

                Method perform has 40 lines of code (exceeds 25 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 1 hr to fix

                  Method unregister_worker has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def unregister_worker(exception = nil)
                        # If we're still processing a job, make sure it gets logged as a
                        # failure.
                        if (hash = processing) && !hash.empty?
                          job = Job.new(hash['queue'], hash['payload'])
                  Severity: Minor
                  Found in lib/resque/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 initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def initialize(*runtime_args)
                        @options = runtime_args.last.is_a?(Hash) ? runtime_args.pop : {}
                  
                        self.class.logger.level = options[:debug] ? Logger::DEBUG : Logger::INFO
                  
                  
                  Severity: Minor
                  Found in lib/resque/web_runner.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 each has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def self.each(offset = 0, limit = self.count, queue = :failed, class_name = nil, order = 'desc')
                          if class_name
                            original_limit = limit
                            limit = count
                          end
                  Severity: Minor
                  Found in lib/resque/failure/redis.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 each has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def self.each(offset = 0, limit = self.count, queue = :failed, class_name = nil, order = 'desc')
                          items = all(offset, limit, queue)
                          items = [items] unless items.is_a? Array
                          reversed = false
                          if order.eql? 'desc'
                  Severity: Minor
                  Found in lib/resque/failure/redis_multi_queue.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 constantize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def constantize(camel_cased_word)
                      camel_cased_word = camel_cased_word.to_s
                  
                      if camel_cased_word.include?('-')
                        camel_cased_word = classify(camel_cased_word)
                  Severity: Minor
                  Found in lib/resque.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 working has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def self.working
                        names = all
                        return [] unless names.any?
                  
                        reportedly_working = {}
                  Severity: Minor
                  Found in lib/resque/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 run_hook has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def run_hook(name, *args)
                        hooks = Resque.send(name)
                        return if hooks.empty?
                        return if name == :before_first_fork && @before_first_fork_hook_ran
                        msg = "Running #{name} hooks"
                  Severity: Minor
                  Found in lib/resque/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

                  Severity
                  Category
                  Status
                  Source
                  Language