bflad/knife-rhn

View on GitHub

Showing 3 of 5 total issues

Method included has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.included(includer)
        includer.class_eval do

          deps do
            require 'readline'
Severity: Minor
Found in lib/chef/knife/rhn_base.rb - About 1 hr to fix

    Method run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def run
            $stdout.sync = true
            
            system = name_args.first
    
    
    Severity: Minor
    Found in lib/chef/knife/rhn_system_details.rb - About 1 hr to fix

      Method set_rhn_connection_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def set_rhn_connection_options
              RhnSatellite::Connection::Handler.debug_enabled = true if get_config(:rhn_debug)
              RhnSatellite::Connection::Handler.default_hostname = get_config(:rhn_hostname)
              RhnSatellite::Connection::Handler.default_https = false if get_config(:rhn_no_https)
              # See: https://github.com/duritong/ruby-rhn_satellite/issues/3
      Severity: Minor
      Found in lib/chef/knife/rhn_base.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

      Severity
      Category
      Status
      Source
      Language