hirura/hrr_rb_ssh

View on GitHub

Showing 83 of 169 total issues

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

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

              def send_channel_request_pty_req term_env_var_val, term_width_chars, term_height_rows, term_width_pixel, term_height_pixel, encoded_term_modes
        Severity: Minor
        Found in lib/hrr_rb_ssh/connection/channel.rb - About 45 mins to fix

          Method build_key has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def build_key(_k, h, _x, session_id, key_length)
          Severity: Minor
          Found in lib/hrr_rb_ssh/transport/kex_algorithms/iv_computable.rb - About 35 mins to fix

            Method generate_signature has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        def generate_signature session_id, username, service_name, method_name, secret_key
            Severity: Minor
            Found in lib/hrr_rb_ssh/authentication/method/publickey/algorithm/functionable.rb - About 35 mins to fix

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

                        def initialize transport, username, submethods, variables, authentication_methods, logger: nil
              Severity: Minor
              Found in lib/hrr_rb_ssh/authentication/method/keyboard_interactive/context.rb - About 35 mins to fix

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

                def start_service io, logger=nil
                  require 'etc'
                
                  begin
                    require 'hrr_rb_ssh'
                Severity: Minor
                Found in demo/more_flexible_auth.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 receive_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def receive_version
                      str_io = StringIO.new
                      loop do
                        str_io.write @io.read(1)
                        if str_io.string[-2..-1] == "#{CR}#{LF}"
                Severity: Minor
                Found in lib/hrr_rb_ssh/transport.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 start_service has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def start_service io, logger=nil
                  require 'etc'
                
                  begin
                    require 'hrr_rb_ssh'
                Severity: Minor
                Found in demo/multi_step_auth.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 encode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.encode arg
                        unless arg.kind_of? ::Integer
                          raise ArgumentError, "must be a kind of Integer, but got #{arg.inspect}"
                        end
                        bn = ::OpenSSL::BN.new(arg)
                Severity: Minor
                Found in lib/hrr_rb_ssh/data_types/mpint.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 exec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def exec command, pty: false, env: {}
                      log_info { "start exec: #{command}" }
                      begin
                        log_info { "Opning channel" }
                        channel = @connection.request_channel_open "session"
                Severity: Minor
                Found in lib/hrr_rb_ssh/client.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 subsystem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def subsystem name
                      log_info { "start subsystem" }
                      begin
                        log_info { "Opning channel" }
                        channel = @connection.request_channel_open "session"
                Severity: Minor
                Found in lib/hrr_rb_ssh/client.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 decode_recursively has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def decode_recursively payload_io, message=nil
                      if message.class == Array and message.size == 0
                        []
                      else
                        definition = case message
                Severity: Minor
                Found in lib/hrr_rb_ssh/codable.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 close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                          def close
                            begin
                              if @sender_thread_finished && @receiver_thread_finished
                                log_info { "closing forwarded-tcpip" }
                                @socket.close
                Severity: Minor
                Found in lib/hrr_rb_ssh/connection/channel/channel_type/forwarded_tcpip.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 receiver_thread has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                          def receiver_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 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 close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                          def close
                            begin
                              if @sender_thread_finished && @receiver_thread_finished
                                log_info { "closing direct-tcpip" }
                                @socket.close
                Severity: Minor
                Found in lib/hrr_rb_ssh/connection/channel/channel_type/direct_tcpip.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 decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.decode io
                        length = io.read(4).unpack("N")[0]
                        hex_str = io.read(length).unpack("H*")[0]
                        # get temporal integer value
                        value = hex_str.hex
                Severity: Minor
                Found in lib/hrr_rb_ssh/data_types/mpint.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 receiver_thread has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                          def receiver_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 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

                Severity
                Category
                Status
                Source
                Language