mperham/sidekiq

View on GitHub
lib/sidekiq/cli.rb

Summary

Maintainability
C
1 day
Test Coverage
B
84%

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

  class CLI
    include Util
    include Singleton unless $TESTING

    attr_accessor :launcher
Severity: Minor
Found in lib/sidekiq/cli.rb - About 2 hrs to fix

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

    $stdout.sync = true
    
    require "yaml"
    require "singleton"
    require "optparse"
    Severity: Minor
    Found in lib/sidekiq/cli.rb - About 2 hrs to fix

      Method setup_options has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def setup_options(args)
            # parse CLI options
            opts = parse_options(args)
      
            set_environment opts[:environment]
      Severity: Minor
      Found in lib/sidekiq/cli.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 option_parser has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def option_parser(opts)
            parser = OptionParser.new { |o|
              o.on "-c", "--concurrency INT", "processor threads to use" do |arg|
                opts[:concurrency] = Integer(arg)
              end
      Severity: Minor
      Found in lib/sidekiq/cli.rb - About 1 hr to fix

        Method run has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def run
              boot_system
              if environment == "development" && $stdout.tty? && Sidekiq.log_formatter.is_a?(Sidekiq::Logger::Formatters::Pretty)
                print_banner
              end
        Severity: Minor
        Found in lib/sidekiq/cli.rb - About 1 hr to fix

          Method run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def run
                boot_system
                if environment == "development" && $stdout.tty? && Sidekiq.log_formatter.is_a?(Sidekiq::Logger::Formatters::Pretty)
                  print_banner
                end
          Severity: Minor
          Found in lib/sidekiq/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 boot_system has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def boot_system
                ENV["RACK_ENV"] = ENV["RAILS_ENV"] = environment
          
                if File.directory?(options[:require])
                  require "rails"
          Severity: Minor
          Found in lib/sidekiq/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 symbolize_keys_deep! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def symbolize_keys_deep!(hash)
                hash.keys.each do |k|
                  symkey = k.respond_to?(:to_sym) ? k.to_sym : k
                  hash[symkey] = hash.delete k
                  symbolize_keys_deep! hash[symkey] if hash[symkey].is_a? Hash
          Severity: Minor
          Found in lib/sidekiq/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

          There are no issues that match your filters.

          Category
          Status