hirura/hrr_rb_ssh

View on GitHub

Showing 83 of 169 total issues

Method start_service has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def start_service io, logger=nil
  require 'etc'

  begin
    require 'hrr_rb_ssh'
Severity: Major
Found in demo/more_flexible_auth.rb - About 2 hrs to fix

    Method initialize has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def initialize
              @proc = Proc.new { |context|
                ptm = context.vars[:ptm]
                pts = context.vars[:pts]
    
    

      Method start_service has 45 lines of code (exceeds 25 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 1 hr to fix

        Method receive has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def receive
              raise Error::ClosedTransport if @closed
              @receiver_monitor.synchronize do
                begin
                  payload = @receiver.receive self
        Severity: Minor
        Found in lib/hrr_rb_ssh/transport.rb - About 1 hr to fix

          Method respond_to_authentication has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def respond_to_authentication
                authentication_methods = (@options['authentication_preferred_authentication_methods'].dup rescue nil) || Method.list_preferred # rescue nil.dup for Ruby version < 2.4
                log_info { "preferred authentication methods: #{authentication_methods}" }
                loop do
                  payload = @transport.receive
          Severity: Minor
          Found in lib/hrr_rb_ssh/authentication.rb - About 1 hr to fix

            Method start_service has a Cognitive Complexity of 14 (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/subsystem_echo_server.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 respond_to_authentication has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def respond_to_authentication
                  authentication_methods = (@options['authentication_preferred_authentication_methods'].dup rescue nil) || Method.list_preferred # rescue nil.dup for Ruby version < 2.4
                  log_info { "preferred authentication methods: #{authentication_methods}" }
                  loop do
                    payload = @transport.receive
            Severity: Minor
            Found in lib/hrr_rb_ssh/authentication.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 connection_loop_thread has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def connection_loop_thread
                  log_info { "start connection loop" }
                  Thread.new do
                    begin
                      while true
            Severity: Minor
            Found in lib/hrr_rb_ssh/connection.rb - About 1 hr to fix

              Method out_receiver_thread has a Cognitive Complexity of 13 (exceeds 5 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

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

                  def receive
                    raise Error::ClosedTransport if @closed
                    @receiver_monitor.synchronize do
                      begin
                        payload = @receiver.receive self
              Severity: Minor
              Found in lib/hrr_rb_ssh/transport.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 err_receiver_thread has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                    def err_receiver_thread
                      Thread.start {
                        log_info { "start err receiver thread" }
                        loop do
                          begin
              Severity: Minor
              Found in lib/hrr_rb_ssh/connection/channel.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 connection_loop_thread has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  def connection_loop_thread
                    log_info { "start connection loop" }
                    Thread.new do
                      begin
                        while true
              Severity: Minor
              Found in lib/hrr_rb_ssh/connection.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 receiver_thread has a Cognitive Complexity of 13 (exceeds 5 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

              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 38 lines of code (exceeds 25 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/subsystem_echo_server.rb - About 1 hr to fix

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

                    def request_authentication
                      authentication_methods = (@options['authentication_preferred_authentication_methods'].dup rescue nil) || Method.list_preferred # rescue nil.dup for Ruby version < 2.4
                      log_info { "preferred authentication methods: #{authentication_methods}" }
                      next_method_name = "none"
                      log_info { "authentication request begins with none method" }
                Severity: Minor
                Found in lib/hrr_rb_ssh/authentication.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 request_authentication has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def request_authentication
                      authentication_methods = (@options['authentication_preferred_authentication_methods'].dup rescue nil) || Method.list_preferred # rescue nil.dup for Ruby version < 2.4
                      log_info { "preferred authentication methods: #{authentication_methods}" }
                      next_method_name = "none"
                      log_info { "authentication request begins with none method" }
                Severity: Minor
                Found in lib/hrr_rb_ssh/authentication.rb - About 1 hr to fix

                  Method start has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def start transport
                            case transport.mode
                            when Mode::SERVER
                              message = receive_kex_dh_gex_request transport.receive
                              @min = message[:'min']

                    Method exec has 30 lines of code (exceeds 25 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 1 hr to fix

                      Method start_service has 30 lines of code (exceeds 25 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 1 hr to fix

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

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