hirura/hrr_rb_ssh

View on GitHub

Showing 83 of 169 total issues

File channel.rb has 527 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'hrr_rb_ssh/connection/channel/channel_type'

module HrrRbSsh
  class Connection
    class Channel
Severity: Major
Found in lib/hrr_rb_ssh/connection/channel.rb - About 1 day to fix

    File transport.rb has 475 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'hrr_rb_ssh/version'
    require 'hrr_rb_ssh/error/closed_transport'
    require 'hrr_rb_ssh/transport/constant'
    require 'hrr_rb_ssh/transport/direction'
    require 'hrr_rb_ssh/transport/sequence_number'
    Severity: Minor
    Found in lib/hrr_rb_ssh/transport.rb - About 7 hrs to fix

      Method channel_loop_thread has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

            def channel_loop_thread
              Thread.start do
                log_info { "start channel loop thread" }
                begin
                  loop do
      Severity: Minor
      Found in lib/hrr_rb_ssh/connection/channel.rb - About 5 hrs 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 a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

              def initialize
                @proc = Proc.new { |context|
                  begin
                    ptm, pts = PTY.open
                    passwd = Etc.getpwnam(context.username)

      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

      Class Transport has 34 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Transport
          include Loggable
          include Constant
      
          attr_reader \
      Severity: Minor
      Found in lib/hrr_rb_ssh/transport.rb - About 4 hrs to fix

        Class Channel has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Channel
              include Loggable
        
              INITIAL_WINDOW_SIZE = 100000
              MAXIMUM_PACKET_SIZE = 100000
        Severity: Minor
        Found in lib/hrr_rb_ssh/connection/channel.rb - About 3 hrs to fix

          Method initialize has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

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

          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

          File connection.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'hrr_rb_ssh/error/closed_connection'
          require 'hrr_rb_ssh/connection/global_request_handler'
          require 'hrr_rb_ssh/connection/channel'
          
          module HrrRbSsh
          Severity: Minor
          Found in lib/hrr_rb_ssh/connection.rb - About 2 hrs to fix

            Method start_service has 72 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/server.rb - About 2 hrs to fix

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

                      def initialize
                        @proc = Proc.new { |context|
                          begin
                            ptm, pts = PTY.open
                            passwd = Etc.getpwnam(context.username)

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

                    def exec! command, pty: false, env: {}
                      log_info { "start exec!: #{command}" }
                      out_buf = StringIO.new
                      err_buf = StringIO.new
                      begin
                Severity: Minor
                Found in lib/hrr_rb_ssh/client.rb - About 2 hrs 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

                Class Connection has 24 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Connection
                    include Loggable
                
                    attr_reader \
                      :username,
                Severity: Minor
                Found in lib/hrr_rb_ssh/connection.rb - About 2 hrs to fix

                  Method sender_thread has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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_sender_thread has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def err_sender_thread
                          Thread.start {
                            log_info { "start err sender thread" }
                            loop do
                              if @r_io_err.closed?
                  Severity: Minor
                  Found in lib/hrr_rb_ssh/connection/channel.rb - About 2 hrs 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 sender_thread has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 sender_thread has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def sender_thread
                          Thread.start {
                            log_info { "start sender thread" }
                            loop do
                              if @r_io_in.closed?
                  Severity: Minor
                  Found in lib/hrr_rb_ssh/connection/channel.rb - About 2 hrs 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 out_sender_thread has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def out_sender_thread
                          Thread.start {
                            log_info { "start out sender thread" }
                            loop do
                              if @r_io_out.closed?
                  Severity: Minor
                  Found in lib/hrr_rb_ssh/connection/channel.rb - About 2 hrs 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 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

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

                          def channel_loop_thread
                            Thread.start do
                              log_info { "start channel loop thread" }
                              begin
                                loop do
                    Severity: Major
                    Found in lib/hrr_rb_ssh/connection/channel.rb - About 2 hrs to fix

                      Method exec! has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def exec! command, pty: false, env: {}
                            log_info { "start exec!: #{command}" }
                            out_buf = StringIO.new
                            err_buf = StringIO.new
                            begin
                      Severity: Major
                      Found in lib/hrr_rb_ssh/client.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language