benSlaughter/segregate

View on GitHub

Showing 4 of 4 total issues

Class Segregate has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

class Segregate
  attr_reader :uri, :type, :state, :http_version, :headers
  attr_accessor :request_method, :status_code, :status_phrase, :body

  def method_missing meth, *args, &block
Severity: Minor
Found in lib/segregate.rb - About 4 hrs to fix

    File segregate.rb has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'juncture'
    require 'hashie'
    require 'uri'
    require 'segregate/version'
    require 'segregate/http_methods'
    Severity: Minor
    Found in lib/segregate.rb - About 2 hrs to fix

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

        def read_in_headers line
          if line.empty?
            @state.next
          else
            key, value = line.split(": ",2)
      Severity: Minor
      Found in lib/segregate.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_chunked_data_chunk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse_chunked_data_chunk line
          line = @stashed_body + line
          @stashed_body = ""
      
          if line.length >= @chunk_size
      Severity: Minor
      Found in lib/segregate.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