hirura/hrr_rb_ssh

View on GitHub

Showing 169 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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          loop do
            Thread.new(server.accept) do |io|
              begin
                pid = fork do
                  begin
          Severity: Major
          Found in demo/multi_step_auth.rb and 3 other locations - About 3 hrs to fix
          demo/echo_server.rb on lines 52..70
          demo/more_flexible_auth.rb on lines 81..99
          demo/server.rb on lines 104..122

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 110.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          loop do
            Thread.new(server.accept) do |io|
              begin
                pid = fork do
                  begin
          Severity: Major
          Found in demo/more_flexible_auth.rb and 3 other locations - About 3 hrs to fix
          demo/echo_server.rb on lines 52..70
          demo/multi_step_auth.rb on lines 75..93
          demo/server.rb on lines 104..122

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 110.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          loop do
            Thread.new(server.accept) do |io|
              begin
                pid = fork do
                  begin
          Severity: Major
          Found in demo/echo_server.rb and 3 other locations - About 3 hrs to fix
          demo/more_flexible_auth.rb on lines 81..99
          demo/multi_step_auth.rb on lines 75..93
          demo/server.rb on lines 104..122

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 110.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          loop do
            Thread.new(server.accept) do |io|
              begin
                pid = fork do
                  begin
          Severity: Major
          Found in demo/server.rb and 3 other locations - About 3 hrs to fix
          demo/echo_server.rb on lines 52..70
          demo/more_flexible_auth.rb on lines 81..99
          demo/multi_step_auth.rb on lines 75..93

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 110.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                      def receiver_thread
                        Thread.start {
                          log_info { "start receiver thread" }
                          loop do
                            begin
                Severity: Major
                Found in lib/hrr_rb_ssh/connection/channel.rb and 2 other locations - About 2 hrs to fix
                lib/hrr_rb_ssh/connection/channel.rb on lines 304..333
                lib/hrr_rb_ssh/connection/channel.rb on lines 337..366

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 98.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                      def out_receiver_thread
                        Thread.start {
                          log_info { "start out receiver thread" }
                          loop do
                            begin
                Severity: Major
                Found in lib/hrr_rb_ssh/connection/channel.rb and 2 other locations - About 2 hrs to fix
                lib/hrr_rb_ssh/connection/channel.rb on lines 271..300
                lib/hrr_rb_ssh/connection/channel.rb on lines 337..366

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 98.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                      def err_receiver_thread
                        Thread.start {
                          log_info { "start err receiver thread" }
                          loop do
                            begin
                Severity: Major
                Found in lib/hrr_rb_ssh/connection/channel.rb and 2 other locations - About 2 hrs to fix
                lib/hrr_rb_ssh/connection/channel.rb on lines 271..300
                lib/hrr_rb_ssh/connection/channel.rb on lines 304..333

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 98.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                            def sender_thread
                              Thread.new(@socket){ |s|
                                begin
                                  loop do
                                    begin
                  lib/hrr_rb_ssh/connection/channel/channel_type/direct_tcpip.rb on lines 42..66

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 97.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language