rapid7/metasploit-framework

View on GitHub
lib/metasploit/framework/ldap/client.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method ldap_connect_opts has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def ldap_connect_opts(rhost, rport, connect_timeout, ssl: true, opts: {})
          connect_opts = {
            host: rhost,
            port: rport,
            connect_timeout: connect_timeout,
Severity: Minor
Found in lib/metasploit/framework/ldap/client.rb - About 1 hr to fix

    Method ldap_auth_opts_schannel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def ldap_auth_opts_schannel(opts, ssl)
              auth_opts = {}
              pfx_path = opts[:ldap_cert_file]
              raise Msf::ValidationError, 'The SSL option must be enabled when using Schannel authentication.' unless ssl
              raise Msf::ValidationError, 'The LDAP::CertFile option is required when using Schannel authentication.' if pfx_path.blank?
    Severity: Minor
    Found in lib/metasploit/framework/ldap/client.rb - About 1 hr to fix

      Method ldap_auth_opts_kerberos has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def ldap_auth_opts_kerberos(opts, ssl)
                auth_opts = {}
                raise Msf::ValidationError, 'The LDAP::Rhostname option is required when using Kerberos authentication.' if opts[:ldap_rhostname].blank?
                raise Msf::ValidationError, 'The DOMAIN option is required when using Kerberos authentication.' if opts[:domain].blank?
      
      
      Severity: Minor
      Found in lib/metasploit/framework/ldap/client.rb - About 1 hr to fix

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

                def ldap_auth_opts_schannel(opts, ssl)
                  auth_opts = {}
                  pfx_path = opts[:ldap_cert_file]
                  raise Msf::ValidationError, 'The SSL option must be enabled when using Schannel authentication.' unless ssl
                  raise Msf::ValidationError, 'The LDAP::CertFile option is required when using Schannel authentication.' if pfx_path.blank?
        Severity: Minor
        Found in lib/metasploit/framework/ldap/client.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 ldap_auth_opts_kerberos has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def ldap_auth_opts_kerberos(opts, ssl)
                  auth_opts = {}
                  raise Msf::ValidationError, 'The LDAP::Rhostname option is required when using Kerberos authentication.' if opts[:ldap_rhostname].blank?
                  raise Msf::ValidationError, 'The DOMAIN option is required when using Kerberos authentication.' if opts[:domain].blank?
        
        
        Severity: Minor
        Found in lib/metasploit/framework/ldap/client.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 ldap_connect_opts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def ldap_connect_opts(rhost, rport, connect_timeout, ssl: true, opts: {})
                  connect_opts = {
                    host: rhost,
                    port: rport,
                    connect_timeout: connect_timeout,
        Severity: Minor
        Found in lib/metasploit/framework/ldap/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

        There are no issues that match your filters.

        Category
        Status