arturictus/sidekiq_alive

View on GitHub

Showing 5 of 5 total issues

Method start has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start
      Sidekiq.configure_server do |sq_config|
        sq_config.on(:startup) do
          SidekiqAlive::Worker.sidekiq_options(queue: current_queue)

Severity: Minor
Found in lib/sidekiq_alive.rb - About 1 hr to fix

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

        def start
          Sidekiq.configure_server do |sq_config|
            sq_config.on(:startup) do
              SidekiqAlive::Worker.sidekiq_options(queue: current_queue)
    
    
    Severity: Minor
    Found in lib/sidekiq_alive.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 serve has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def serve(io)
            # parse first line
            if io.gets =~ /^(\S+)\s+(\S+)\s+(\S+)/
              request = Request.new(io, ::Regexp.last_match(1), ::Regexp.last_match(2), ::Regexp.last_match(3))
            else
    Severity: Minor
    Found in lib/sidekiq_alive/server/http_server.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 request_handler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def request_handler(req, res)
            if req.path != path
              res.status = 404
              res.body = "Not found"
              return logger.warn("[SidekiqAlive] Path '#{req.path}' not found")
    Severity: Minor
    Found in lib/sidekiq_alive/server/default.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def call(env)
              req = ::Rack::Request.new(env)
    
              if req.path != path
                logger.warn("[SidekiqAlive] Path '#{req.path}' not found")
    Severity: Minor
    Found in lib/sidekiq_alive/server/rack.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

    Severity
    Category
    Status
    Source
    Language