kaspernj/apsis-on-steroids

View on GitHub
lib/apsis-on-steroids.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

  def parse_obj(obj)
    if obj.is_a?(Array)
      ret = []
      obj.each do |obj_i|
        ret << parse_obj(obj_i)
Severity: Minor
Found in lib/apsis-on-steroids.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 parse_json_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_json_response(response)
    # Throw custom JSON error for debugging if the JSON was corrupt (this actually happens!).
    begin
      json = JSON.parse(response.body)
    rescue JSON::ParserError
Severity: Minor
Found in lib/apsis-on-steroids.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

Avoid too many return statements within this method.
Open

      return obj
Severity: Major
Found in lib/apsis-on-steroids.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return obj
    Severity: Major
    Found in lib/apsis-on-steroids.rb - About 30 mins to fix

      Method read_queued_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def read_queued_response(url)
          uri = URI.parse(url)
      
          Timeout.timeout(300) do
            loop do
      Severity: Minor
      Found in lib/apsis-on-steroids.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

      There are no issues that match your filters.

      Category
      Status