maxdemarzi/neography

View on GitHub
lib/neography/connection.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method return_result has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def return_result(response, code, body, parsed, path, query_body)
      case code
      when 200
        @logger.debug "OK #{body}" if @log_enabled
        parsed ? body : @parser.json(body)
Severity: Minor
Found in lib/neography/connection.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 handle_4xx_500_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_4xx_500_response(response, code, body, path, query_body)
      index = 0
      request = {:path => path, :body => query_body}
      if body.nil? or body == ""
        parsed_body = {"message" => "No error message returned from server.",
Severity: Minor
Found in lib/neography/connection.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 save_local_configuration has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def save_local_configuration(config)
      @protocol           = config[:protocol]
      @server             = config[:server]
      @port               = config[:port]
      @directory          = config[:directory]
Severity: Minor
Found in lib/neography/connection.rb - About 1 hr to fix

    Method return_result has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def return_result(response, code, body, parsed, path, query_body)
    Severity: Minor
    Found in lib/neography/connection.rb - About 45 mins to fix

      Method raise_errors has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def raise_errors(code, exception, message, stacktrace, request, index)
      Severity: Minor
      Found in lib/neography/connection.rb - About 45 mins to fix

        Method evaluate_response has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def evaluate_response(response, path, query_body, streaming, batching, stream = nil)
        Severity: Minor
        Found in lib/neography/connection.rb - About 45 mins to fix

          Method handle_4xx_500_response has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def handle_4xx_500_response(response, code, body, path, query_body)
          Severity: Minor
          Found in lib/neography/connection.rb - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status