Katello/katello

View on GitHub
app/models/katello/ping.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class Ping has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Ping
    OK_RETURN_CODE = 'ok'.freeze
    FAIL_RETURN_CODE = 'FAIL'.freeze
    PACKAGES = %w(katello candlepin pulp foreman hammer dynflow).freeze

Severity: Minor
Found in app/models/katello/ping.rb - About 3 hrs to fix

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

          def ping_services_for_capsule(services, capsule_id)
            services ||= self.services(capsule_id)
            result = {}
            services.each { |service| result[service] = {} }
    
    
    Severity: Minor
    Found in app/models/katello/ping.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 backend_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def backend_status(url, backend)
            ca_file = SETTINGS[:katello][backend][:ca_cert_file]
            request_id = ::Logging.mdc['request']
    
            options = {}
    Severity: Minor
    Found in app/models/katello/ping.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 pulp_without_auth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def pulp_without_auth(url)
            json = backend_status(url, :pulp)
    
            fail _("Pulp does not appear to be running at %s.") % url if json.empty?
    
    
    Severity: Minor
    Found in app/models/katello/ping.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 pulp3_without_auth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def pulp3_without_auth(url)
            json = backend_status(url, :pulp)
            fail _("Pulp does not appear to be running at %s.") % url if json.empty?
    
            if json['database_connection'] && json['database_connection']['connected'] != true
    Severity: Minor
    Found in app/models/katello/ping.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