hirura/hrr_rb_ssh

View on GitHub

Showing 83 of 169 total issues

Method out_receiver_thread has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def out_receiver_thread
        Thread.start {
          log_info { "start out receiver thread" }
          loop do
            begin
Severity: Minor
Found in lib/hrr_rb_ssh/connection/channel.rb - About 1 hr to fix

    Method receiver_thread has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def receiver_thread
            Thread.start {
              log_info { "start receiver thread" }
              loop do
                begin
    Severity: Minor
    Found in lib/hrr_rb_ssh/connection/channel.rb - About 1 hr to fix

      Method request_authentication has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def request_authentication username, service_name
                message = {
                  :'message number' => Messages::SSH_MSG_USERAUTH_REQUEST::VALUE,
                  :"user name"      => username,
                  :"service name"   => service_name,
      Severity: Minor
      Found in lib/hrr_rb_ssh/authentication/method/keyboard_interactive.rb - About 1 hr to fix

        Method close has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def close from=:outside, exitstatus=0
                @channel_closing_monitor.synchronize {
                  return if @closed
                  log_info { "close channel" }
                  @closed = true
        Severity: Minor
        Found in lib/hrr_rb_ssh/connection/channel.rb - About 1 hr to fix

          Method shell has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def shell env: {}
                log_info { "start shell" }
                begin
                  log_info { "Opning channel" }
                  channel = @connection.request_channel_open "session"
          Severity: Minor
          Found in lib/hrr_rb_ssh/client.rb - About 1 hr to fix

            Method sender_thread has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def sender_thread
                        Thread.new(@socket){ |s|
                          begin
                            loop do
                              begin
            Severity: Minor
            Found in lib/hrr_rb_ssh/connection/channel/channel_type/forwarded_tcpip.rb - About 1 hr to fix

              Method sender_thread has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def sender_thread
                          Thread.new(@socket){ |s|
                            begin
                              loop do
                                begin
              Severity: Minor
              Found in lib/hrr_rb_ssh/connection/channel/channel_type/direct_tcpip.rb - About 1 hr to fix

                Method start_service has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def start_service io, logger=nil
                  begin
                    require 'hrr_rb_ssh'
                  rescue LoadError
                    $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
                Severity: Minor
                Found in demo/echo_server.rb - About 55 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 close has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def close from=:outside, exitstatus=0
                        @channel_closing_monitor.synchronize {
                          return if @closed
                          log_info { "close channel" }
                          @closed = true
                Severity: Minor
                Found in lib/hrr_rb_ssh/connection/channel.rb - About 55 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 run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                              def self.run proc_chain, username, io, variables, message, options, session, logger: nil

                  Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                                def self.run proc_chain, username, io, variables, message, options, session, logger: nil

                    Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                                  def self.run proc_chain, username, io, variables, message, options, session, logger: nil

                      Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                    def self.run proc_chain, username, io, variables, message, options, session, logger: nil

                        Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                      def self.run proc_chain, username, io, variables, message, options, session, logger: nil

                          Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                        def self.run proc_chain, username, io, variables, message, options, session, logger: nil

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

                                            def initialize proc_chain, username, io, variables, message, session, logger: nil

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

                                              def initialize proc_chain, username, io, variables, message, session, logger: nil

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

                                        def initialize_dh pg=nil
                                          unless pg
                                            p_list = KexAlgorithms.constants.map{|c| KexAlgorithms.const_get(c)}.select{|c| c.respond_to?(:const_defined?) && c.const_defined?(:P)}.map{|c| [OpenSSL::BN.new(c::P,16).num_bits, c::P]}.sort_by{|e| e[0]}.reverse
                                            candidate = p_list.find{ |e| e[0] <= @n }
                                            raise unless (@min .. @max).include?(candidate[0])
                                Severity: Minor
                                Found in lib/hrr_rb_ssh/transport/kex_algorithms/diffie_hellman_group_exchange.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                                def initialize proc_chain, username, io, variables, message, session, logger: nil

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

                                                  def initialize proc_chain, username, io, variables, message, session, logger: nil
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language