benchmark/http_simple.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method call has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def call(env)
    path = env['PATH_INFO'] || env['REQUEST_URI']
    commands = path.split('/')

    @count += 1
Severity: Minor
Found in benchmark/http_simple.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 call has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def call(env)
    path = env['PATH_INFO'] || env['REQUEST_URI']
    commands = path.split('/')

    @count += 1
Severity: Minor
Found in benchmark/http_simple.rb - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

          if env['CONTENT_LENGTH'].to_i == input_body.length
            body = "Content-Length matches input length"
            status = 200
          else
            body = "Content-Length doesn't matches input length!
    Severity: Major
    Found in benchmark/http_simple.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

            while chunk = env['rack.input'].read(512)
              input_body << chunk
            end
      Severity: Major
      Found in benchmark/http_simple.rb - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status