hirura/hrr_rb_ssh

View on GitHub

Showing 169 of 169 total issues

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

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

                when Mode::SERVER
                  encryption_algorithm_c_to_s_name = @remote_encryption_algorithms_client_to_server.find{ |a| @local_encryption_algorithms_client_to_server.include? a } or raise
                  encryption_algorithm_s_to_c_name = @remote_encryption_algorithms_server_to_client.find{ |a| @local_encryption_algorithms_server_to_client.include? a } or raise
                  incoming_encryption_algorithm_name = encryption_algorithm_c_to_s_name
                  outgoing_encryption_algorithm_name = encryption_algorithm_s_to_c_name
          Severity: Major
          Found in lib/hrr_rb_ssh/transport.rb and 1 other location - About 1 hr to fix
          lib/hrr_rb_ssh/transport.rb on lines 471..479

          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 48.

          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 2 locations. Consider refactoring.
          Open

            class Connection
              class Channel
                class ChannelType
                  class Session
                    class RequestType
          lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem/context.rb on lines 2..36

          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 48.

          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 2 locations. Consider refactoring.
          Open

            class Connection
              class Channel
                class ChannelType
                  class Session
                    class RequestType
          lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec/context.rb on lines 2..36

          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 48.

          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 2 locations. Consider refactoring.
          Open

                when Mode::CLIENT
                  encryption_algorithm_s_to_c_name = @local_encryption_algorithms_server_to_client.find{ |a| @remote_encryption_algorithms_server_to_client.include? a } or raise
                  encryption_algorithm_c_to_s_name = @local_encryption_algorithms_client_to_server.find{ |a| @remote_encryption_algorithms_client_to_server.include? a } or raise
                  incoming_encryption_algorithm_name = encryption_algorithm_s_to_c_name
                  outgoing_encryption_algorithm_name = encryption_algorithm_c_to_s_name
          Severity: Major
          Found in lib/hrr_rb_ssh/transport.rb and 1 other location - About 1 hr to fix
          lib/hrr_rb_ssh/transport.rb on lines 462..470

          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 48.

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

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

                      module HrrRbSsh
                        class Connection
                          class Channel
                            class ChannelType
                              class Session
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/window_change.rb on lines 3..17

                      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 41.

                      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 6 locations. Consider refactoring.
                      Open

                      module HrrRbSsh
                        class Connection
                          class Channel
                            class ChannelType
                              class Session
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/window_change.rb on lines 3..17

                      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 41.

                      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 6 locations. Consider refactoring.
                      Open

                      module HrrRbSsh
                        class Connection
                          class Channel
                            class ChannelType
                              class Session
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/window_change.rb on lines 3..17

                      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 41.

                      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 6 locations. Consider refactoring.
                      Open

                      module HrrRbSsh
                        class Connection
                          class Channel
                            class ChannelType
                              class Session
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb on lines 3..17
                      lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/window_change.rb on lines 3..17

                      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 41.

                      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