hirura/hrr_rb_ssh

View on GitHub

Showing 169 of 169 total issues

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/subsystem.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/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

Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

          def initialize username, algorithm, session_id, message, variables, authentication_methods, logger: nil
Severity: Minor
Found in lib/hrr_rb_ssh/authentication/method/publickey/context.rb - About 45 mins to fix

    Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                    def initialize proc_chain, username, io, variables, message, session, logger: nil

      Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                      def initialize proc_chain, username, io, variables, message, session, logger: nil

        Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                        def initialize proc_chain, username, io, variables, message, session, logger: nil

          Method initialize has a Cognitive Complexity of 8 (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

          Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                          def initialize proc_chain, username, io, variables, message, session, logger: nil

            Method initialize_dh has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def initialize_dh pg=nil
                      unless pg
                        p_list = KexAlgorithms.constants.map{|c| KexAlgorithms.const_get(c)}.select{|c| c.respond_to?(:const_defined?) && c.const_defined?(:P)}.map{|c| [OpenSSL::BN.new(c::P,16).num_bits, c::P]}.sort_by{|e| e[0]}.reverse
                        candidate = p_list.find{ |e| e[0] <= @n }
                        raise unless (@min .. @max).include?(candidate[0])
            Severity: Minor
            Found in lib/hrr_rb_ssh/transport/kex_algorithms/diffie_hellman_group_exchange.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                            def initialize proc_chain, username, io, variables, message, session, logger: nil

              Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                              def initialize proc_chain, username, io, variables, message, session, logger: nil

                Method send_channel_request_pty_req has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def send_channel_request_pty_req term_env_var_val, term_width_chars, term_height_rows, term_width_pixel, term_height_pixel, encoded_term_modes
                Severity: Minor
                Found in lib/hrr_rb_ssh/connection/channel.rb - About 45 mins to fix

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

                    class Transport
                      class KexAlgorithms
                        module DiffieHellman
                          class H0
                            include Codable
                  Severity: Minor
                  Found in lib/hrr_rb_ssh/transport/kex_algorithms/diffie_hellman/h0.rb and 1 other location - About 45 mins to fix
                  lib/hrr_rb_ssh/transport/kex_algorithms/elliptic_curve_diffie_hellman/h0.rb on lines 2..16

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

                  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

                          def hash transport
                            h0_payload = {
                              :'V_C' => transport.v_c,
                              :'V_S' => transport.v_s,
                              :'I_C' => transport.i_c,
                  Severity: Minor
                  Found in lib/hrr_rb_ssh/transport/kex_algorithms/diffie_hellman.rb and 1 other location - About 45 mins to fix
                  lib/hrr_rb_ssh/transport/kex_algorithms/elliptic_curve_diffie_hellman.rb on lines 38..50

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

                  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

                          def hash transport
                            h0_payload = {
                              :'V_C' => transport.v_c,
                              :'V_S' => transport.v_s,
                              :'I_C' => transport.i_c,
                  lib/hrr_rb_ssh/transport/kex_algorithms/diffie_hellman.rb on lines 44..56

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

                  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 Transport
                      class KexAlgorithms
                        module EllipticCurveDiffieHellman
                          class H0
                            include Codable
                  lib/hrr_rb_ssh/transport/kex_algorithms/diffie_hellman/h0.rb on lines 2..16

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

                  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
                          mac_algorithm_s_to_c_name = @local_mac_algorithms_server_to_client.find{ |a| @remote_mac_algorithms_server_to_client.include? a } or raise
                          mac_algorithm_c_to_s_name = @local_mac_algorithms_client_to_server.find{ |a| @remote_mac_algorithms_client_to_server.include? a } or raise
                          incoming_mac_algorithm_name = mac_algorithm_s_to_c_name
                          outgoing_mac_algorithm_name = mac_algorithm_c_to_s_name
                  Severity: Minor
                  Found in lib/hrr_rb_ssh/transport.rb and 1 other location - About 40 mins to fix
                  lib/hrr_rb_ssh/transport.rb on lines 487..493

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

                  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::SERVER
                          mac_algorithm_c_to_s_name = @remote_mac_algorithms_client_to_server.find{ |a| @local_mac_algorithms_client_to_server.include? a } or raise
                          mac_algorithm_s_to_c_name = @remote_mac_algorithms_server_to_client.find{ |a| @local_mac_algorithms_server_to_client.include? a } or raise
                          incoming_mac_algorithm_name = mac_algorithm_c_to_s_name
                          outgoing_mac_algorithm_name = mac_algorithm_s_to_c_name
                  Severity: Minor
                  Found in lib/hrr_rb_ssh/transport.rb and 1 other location - About 40 mins to fix
                  lib/hrr_rb_ssh/transport.rb on lines 494..500

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

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

                      is_verified = users.any?{ |username|
                        passwd = Etc.getpwnam(username)
                        homedir = passwd.dir
                        authorized_keys = HrrRbSsh::Compat::OpenSSH::AuthorizedKeys.new(File.read(File.join(homedir, '.ssh', 'authorized_keys')))
                        authorized_keys.any?{ |public_key| context.verify username, public_key.algorithm_name, public_key.to_pem }
                  Severity: Minor
                  Found in demo/more_flexible_auth.rb and 1 other location - About 40 mins to fix
                  demo/multi_step_auth.rb on lines 17..21

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

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

                      is_verified = users.any?{ |username|
                        passwd = Etc.getpwnam(username)
                        homedir = passwd.dir
                        authorized_keys = HrrRbSsh::Compat::OpenSSH::AuthorizedKeys.new(File.read(File.join(homedir, '.ssh', 'authorized_keys')))
                        authorized_keys.any?{ |public_key| context.verify username, public_key.algorithm_name, public_key.to_pem }
                  Severity: Minor
                  Found in demo/multi_step_auth.rb and 1 other location - About 40 mins to fix
                  demo/more_flexible_auth.rb on lines 21..25

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

                  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