matschaffer/knife-solo

View on GitHub
lib/knife-solo/ssh_command.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

    def self.included(other)
      other.class_eval do
        # Lazy load our dependencies if the including class did not call
        # Knife#deps yet. Later calls to #deps override previous ones, so if
        # the outer class calls it, it should also call our #load_deps, i.e:
Severity: Major
Found in lib/knife-solo/ssh_command.rb - About 2 hrs to fix

    File ssh_command.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module KnifeSolo
      module SshCommand
    
        def self.load_deps
          require 'knife-solo/ssh_connection'
    Severity: Minor
    Found in lib/knife-solo/ssh_command.rb - About 2 hrs to fix

      Method ssh_args has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def ssh_args
            args = []
      
            args << [user, host].compact.join('@')
      
      
      Severity: Minor
      Found in lib/knife-solo/ssh_command.rb - About 45 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 connection_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def connection_options
            options = config_file_options
            options[:port] = config[:ssh_port] if config[:ssh_port]
            options[:password] = config[:ssh_password] if config[:ssh_password]
            options[:keys] = [identity_file] if identity_file
      Severity: Minor
      Found in lib/knife-solo/ssh_command.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

      Method validate_ssh_options! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_ssh_options!
            if config[:identity_file]
              ui.warn '`--identity-file` is deprecated, please use `--ssh-identity-file`.'
            end
            unless first_cli_arg_is_a_hostname?
      Severity: Minor
      Found in lib/knife-solo/ssh_command.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

      There are no issues that match your filters.

      Category
      Status