rapid7/metasploit-framework

View on GitHub
lib/rex/proto/kerberos/model/krb_error.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method decode_asn1 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def decode_asn1(input)
            input.value[0].value.each do |val|
              case val.tag
              when 0
                self.pvno = decode_pvno(val)
Severity: Minor
Found in lib/rex/proto/kerberos/model/krb_error.rb - About 1 hr to fix

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

              def decode(input)
                case input
                when String
                  decode_string(input)
                when OpenSSL::ASN1::ASN1Data
    Severity: Major
    Found in lib/rex/proto/kerberos/model/krb_error.rb and 24 other locations - About 15 mins to fix
    lib/rex/proto/kerberos/model/ap_rep.rb on lines 25..35
    lib/rex/proto/kerberos/model/authenticator.rb on lines 47..57
    lib/rex/proto/kerberos/model/authorization_data.rb on lines 21..31
    lib/rex/proto/kerberos/model/checksum.rb on lines 22..32
    lib/rex/proto/kerberos/model/enc_ap_rep_part.rb on lines 32..42
    lib/rex/proto/kerberos/model/enc_kdc_response.rb on lines 75..85
    lib/rex/proto/kerberos/model/enc_krb_cred_part.rb on lines 19..29
    lib/rex/proto/kerberos/model/encrypted_data.rb on lines 30..40
    lib/rex/proto/kerberos/model/encryption_key.rb on lines 28..38
    lib/rex/proto/kerberos/model/host_address.rb on lines 23..33
    lib/rex/proto/kerberos/model/kdc_request.rb on lines 29..39
    lib/rex/proto/kerberos/model/kdc_request_body.rb on lines 73..83
    lib/rex/proto/kerberos/model/kdc_response.rb on lines 37..47
    lib/rex/proto/kerberos/model/krb_cred.rb on lines 35..45
    lib/rex/proto/kerberos/model/krb_cred_info.rb on lines 66..76
    lib/rex/proto/kerberos/model/last_request.rb on lines 22..32
    lib/rex/proto/kerberos/model/pre_auth_etype_info2.rb on lines 20..30
    lib/rex/proto/kerberos/model/pre_auth_etype_info2_entry.rb on lines 26..36
    lib/rex/proto/kerberos/model/pre_auth_for_user.rb on lines 32..42
    lib/rex/proto/kerberos/model/pre_auth_pac_options.rb on lines 21..31
    lib/rex/proto/kerberos/model/principal_name.rb on lines 28..38
    lib/rex/proto/kerberos/model/ticket.rb on lines 35..45
    lib/rex/proto/kerberos/model/ticket_enc_part.rb on lines 26..36
    lib/rex/proto/kerberos/model/transited_encoding.rb on lines 19..29

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

    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

    There are no issues that match your filters.

    Category
    Status