hirura/hrr_rb_ssh

View on GitHub

Showing 169 of 169 total issues

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

    def channel_data payload
      log_info { 'received ' + Messages::SSH_MSG_CHANNEL_DATA::ID }
      message = Messages::SSH_MSG_CHANNEL_DATA.new(logger: logger).decode payload
      local_channel = message[:'recipient channel']
      @channels[local_channel].receive_message_queue.enq message if @channels.has_key? local_channel
Severity: Major
Found in lib/hrr_rb_ssh/connection.rb and 4 other locations - About 30 mins to fix
lib/hrr_rb_ssh/connection.rb on lines 219..223
lib/hrr_rb_ssh/connection.rb on lines 226..230
lib/hrr_rb_ssh/connection.rb on lines 240..244
lib/hrr_rb_ssh/connection.rb on lines 247..251

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

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

    def channel_window_adjust payload
      log_info { 'received ' + Messages::SSH_MSG_CHANNEL_WINDOW_ADJUST::ID }
      message = Messages::SSH_MSG_CHANNEL_WINDOW_ADJUST.new(logger: logger).decode payload
      local_channel = message[:'recipient channel']
      @channels[local_channel].receive_message_queue.enq message if @channels.has_key? local_channel
Severity: Major
Found in lib/hrr_rb_ssh/connection.rb and 4 other locations - About 30 mins to fix
lib/hrr_rb_ssh/connection.rb on lines 219..223
lib/hrr_rb_ssh/connection.rb on lines 233..237
lib/hrr_rb_ssh/connection.rb on lines 240..244
lib/hrr_rb_ssh/connection.rb on lines 247..251

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

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

    def channel_request payload
      log_info { 'received ' + Messages::SSH_MSG_CHANNEL_REQUEST::ID }
      message = Messages::SSH_MSG_CHANNEL_REQUEST.new(logger: logger).decode payload
      local_channel = message[:'recipient channel']
      @channels[local_channel].receive_message_queue.enq message if @channels.has_key? local_channel
Severity: Major
Found in lib/hrr_rb_ssh/connection.rb and 4 other locations - About 30 mins to fix
lib/hrr_rb_ssh/connection.rb on lines 226..230
lib/hrr_rb_ssh/connection.rb on lines 233..237
lib/hrr_rb_ssh/connection.rb on lines 240..244
lib/hrr_rb_ssh/connection.rb on lines 247..251

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

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

module HrrRbSsh
  module Messages
    class SSH_MSG_KEX_DH_GEX_REPLY
      include Codable

Severity: Major
Found in lib/hrr_rb_ssh/messages/033_ssh_msg_kex_dh_gex_reply.rb and 4 other locations - About 25 mins to fix
lib/hrr_rb_ssh/messages/004_ssh_msg_debug.rb on lines 3..17
lib/hrr_rb_ssh/messages/031_ssh_msg_kexdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/031_ssh_msg_kexecdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/034_ssh_msg_kex_dh_gex_request.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 31.

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

module HrrRbSsh
  module Messages
    class SSH_MSG_KEXECDH_REPLY
      include Codable

Severity: Major
Found in lib/hrr_rb_ssh/messages/031_ssh_msg_kexecdh_reply.rb and 4 other locations - About 25 mins to fix
lib/hrr_rb_ssh/messages/004_ssh_msg_debug.rb on lines 3..17
lib/hrr_rb_ssh/messages/031_ssh_msg_kexdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/033_ssh_msg_kex_dh_gex_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/034_ssh_msg_kex_dh_gex_request.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 31.

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

module HrrRbSsh
  module Messages
    class SSH_MSG_KEX_DH_GEX_REQUEST
      include Codable

Severity: Major
Found in lib/hrr_rb_ssh/messages/034_ssh_msg_kex_dh_gex_request.rb and 4 other locations - About 25 mins to fix
lib/hrr_rb_ssh/messages/004_ssh_msg_debug.rb on lines 3..17
lib/hrr_rb_ssh/messages/031_ssh_msg_kexdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/031_ssh_msg_kexecdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/033_ssh_msg_kex_dh_gex_reply.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 31.

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

      rescue => e
        log_error { "Failed opening channel" }
        log_error { [e.backtrace[0], ": ", e.message, " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join }
        raise "Error in subsystem"
      ensure
Severity: Minor
Found in lib/hrr_rb_ssh/client.rb and 3 other locations - About 25 mins to fix
lib/hrr_rb_ssh/client.rb on lines 119..123
lib/hrr_rb_ssh/client.rb on lines 152..156
lib/hrr_rb_ssh/client.rb on lines 183..187

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

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

module HrrRbSsh
  module Messages
    class SSH_MSG_KEXDH_REPLY
      include Codable

Severity: Major
Found in lib/hrr_rb_ssh/messages/031_ssh_msg_kexdh_reply.rb and 4 other locations - About 25 mins to fix
lib/hrr_rb_ssh/messages/004_ssh_msg_debug.rb on lines 3..17
lib/hrr_rb_ssh/messages/031_ssh_msg_kexecdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/033_ssh_msg_kex_dh_gex_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/034_ssh_msg_kex_dh_gex_request.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 31.

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

module HrrRbSsh
  module Messages
    class SSH_MSG_DEBUG
      include Codable

Severity: Major
Found in lib/hrr_rb_ssh/messages/004_ssh_msg_debug.rb and 4 other locations - About 25 mins to fix
lib/hrr_rb_ssh/messages/031_ssh_msg_kexdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/031_ssh_msg_kexecdh_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/033_ssh_msg_kex_dh_gex_reply.rb on lines 3..17
lib/hrr_rb_ssh/messages/034_ssh_msg_kex_dh_gex_request.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 31.

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

      rescue => e
        log_error { "Failed opening channel" }
        log_error { [e.backtrace[0], ": ", e.message, " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join }
        raise "Error in shell"
      ensure
Severity: Minor
Found in lib/hrr_rb_ssh/client.rb and 3 other locations - About 25 mins to fix
lib/hrr_rb_ssh/client.rb on lines 119..123
lib/hrr_rb_ssh/client.rb on lines 183..187
lib/hrr_rb_ssh/client.rb on lines 210..214

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

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

      rescue => e
        log_error { "Failed opening channel" }
        log_error { [e.backtrace[0], ": ", e.message, " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join }
        raise "Error in shell"
      ensure
Severity: Minor
Found in lib/hrr_rb_ssh/client.rb and 3 other locations - About 25 mins to fix
lib/hrr_rb_ssh/client.rb on lines 119..123
lib/hrr_rb_ssh/client.rb on lines 152..156
lib/hrr_rb_ssh/client.rb on lines 210..214

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

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

      rescue => e
        log_error { "Failed opening channel" }
        log_error { [e.backtrace[0], ": ", e.message, " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join }
        raise "Error in exec!"
      ensure
Severity: Minor
Found in lib/hrr_rb_ssh/client.rb and 3 other locations - About 25 mins to fix
lib/hrr_rb_ssh/client.rb on lines 152..156
lib/hrr_rb_ssh/client.rb on lines 183..187
lib/hrr_rb_ssh/client.rb on lines 210..214

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

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

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

        rescue => e
          log_error { [e.backtrace[0], ": ", e.message, " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join }
          close
          raise Error::ClosedTransport
        end
Severity: Minor
Found in lib/hrr_rb_ssh/transport.rb and 2 other locations - About 25 mins to fix
lib/hrr_rb_ssh/transport.rb on lines 141..145
lib/hrr_rb_ssh/transport.rb on lines 167..171

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

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

      rescue => e
        log_error { [e.backtrace[0], ": ", e.message, " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join }
        close
        raise Error::ClosedTransport
      else
Severity: Minor
Found in lib/hrr_rb_ssh/transport.rb and 2 other locations - About 25 mins to fix
lib/hrr_rb_ssh/transport.rb on lines 93..97
lib/hrr_rb_ssh/transport.rb on lines 141..145

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

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

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

        rescue => e
          log_error { [e.backtrace[0], ": ", e.message, " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join }
          close
          raise Error::ClosedTransport
        end
Severity: Minor
Found in lib/hrr_rb_ssh/transport.rb and 2 other locations - About 25 mins to fix
lib/hrr_rb_ssh/transport.rb on lines 93..97
lib/hrr_rb_ssh/transport.rb on lines 167..171

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

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