kigster/sidekiq-pool

View on GitHub

Showing 9 of 88 total issues

File cli.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'sidekiq/cli'
require 'sidekiq/pool'

module Sidekiq
  module Pool
Severity: Minor
Found in lib/sidekiq/pool/cli.rb - About 3 hrs to fix

    Class CLI has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class CLI < Sidekiq::CLI
    
          START_CTX = {
            :argv => ARGV.map(&:dup),
            0 => $0.dup,
    Severity: Minor
    Found in lib/sidekiq/pool/cli.rb - About 3 hrs to fix

      Method parse_options has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def parse_options(argv)
              opts = {}
      
              @parser = OptionParser.new do |o|
                o.on '-c', '--concurrency INT', "processor threads to use" do |arg|
      Severity: Major
      Found in lib/sidekiq/pool/cli.rb - About 2 hrs to fix

        Method fork_child has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def fork_child(command, wait_for_busy = true)
                logger.info "Adding child with args: (#{command}) in #{working_directory}, waiting for busy: #{wait_for_busy}"
                if working_directory && !Dir.exist?(working_directory)
                  logger.info "Working directory: #{working_directory} does not exist unable to fork"
                  return
        Severity: Minor
        Found in lib/sidekiq/pool/cli.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 parse_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_options(argv)
                opts = {}
        
                @parser = OptionParser.new do |o|
                  o.on '-c', '--concurrency INT', "processor threads to use" do |arg|
        Severity: Minor
        Found in lib/sidekiq/pool/cli.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 fork_child has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def fork_child(command, wait_for_busy = true)
                logger.info "Adding child with args: (#{command}) in #{working_directory}, waiting for busy: #{wait_for_busy}"
                if working_directory && !Dir.exist?(working_directory)
                  logger.info "Working directory: #{working_directory} does not exist unable to fork"
                  return
        Severity: Minor
        Found in lib/sidekiq/pool/cli.rb - About 1 hr to fix

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

                def parse_config_file(filename)
                  config = YAML.load(ERB.new(File.read(filename)).result)
                  unless config.key?(:workers)
                    raise ArgumentError, 'Invalid configuration file - "workers" key must be present'
                  end
          Severity: Minor
          Found in lib/sidekiq/pool/cli.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 stop_children has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def stop_children(given_pool = @pool)
                  @done = true
                  logger.info 'Stopping children'
                  update_process_name
          
          
          Severity: Minor
          Found in lib/sidekiq/pool/cli.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 trap_signals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def trap_signals
                  @self_read, @self_write = IO.pipe
          
                  %w(INT TERM USR1 TSTP USR2 CHLD HUP).each do |sig|
                    begin
          Severity: Minor
          Found in lib/sidekiq/pool/cli.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