VianetManagement/the-captain-ruby

View on GitHub

Showing 3 of 21 total issues

Method symbolize_names has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def symbolize_names(object)
        case object
        when Hash
          {}.tap do |new_hash|
            object.each do |key, value|
Severity: Minor
Found in lib/the_captain/utility/helper.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 to_s has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def to_s
        out_message = message
        out_message += "\n(Status: #{http_status})"            unless http_status.nil?
        out_message += "\nRaw request body: #{http_body}"      unless http_body.nil?
        out_message += "\nResponse Headers: #{http_headers}\n" unless http_headers.nil?
Severity: Minor
Found in lib/the_captain/error/standard_exception.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 capture_response! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def capture_response!(retry_count = TheCaptain.retry_attempts)
      @response = yield
    rescue StandardError
      retry_count ||= 0
      (retry_count -= 1).positive? ? retry : raise
Severity: Minor
Found in lib/the_captain/captain_client.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

Severity
Category
Status
Source
Language