SUSE/connect

View on GitHub
lib/suse/connect/connection.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

      def json_request(method, path, params = {})
        # for :get requests, the params need to go to the url, for other requests into the body
        if method == :get
          request = VERB_TO_CLASS[method].new(path_with_params(path, params))
        else
Severity: Minor
Found in lib/suse/connect/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 update_system_token! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def update_system_token!(response)
        return unless System.credentials?

        value = response.to_hash[SUSE::Toolkit::Utilities::SYSTEM_TOKEN_HEADER.downcase]
        token = value.first.strip unless value.nil? || value.first.nil?
Severity: Minor
Found in lib/suse/connect/connection.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(endpoint, language: nil, insecure: false, debug: false, verify_callback: nil)
        endpoint         = prefix_protocol(endpoint)
        uri              = URI.parse(endpoint)
        http             = Net::HTTP.new(uri.host, uri.port)

Severity: Minor
Found in lib/suse/connect/connection.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 verify_callback= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def verify_callback=(callback)
        if callback
          log.debug "Using custom verify_callback: #{callback.source_location.map(&:to_s).join(':')}"
          http.verify_callback = callback
        else
Severity: Minor
Found in lib/suse/connect/connection.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