resque/resque

View on GitHub
lib/resque/web_runner.rb

Summary

Maintainability
C
1 day
Test Coverage

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 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

      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 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 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 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

      There are no issues that match your filters.

      Category
      Status