rapid7/metasploit-framework

View on GitHub
modules/auxiliary/admin/dns/dyn_dns_update.rb

Summary

Maintainability
C
1 day
Test Coverage

Method update_record has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def update_record(type:, type_enum:, value:, value_name:)
    if value.nil? || value == ""
      print_error "Record type #{type} requires the #{value_name} parameter to be specified"
      return
    end
Severity: Minor
Found in modules/auxiliary/admin/dns/dyn_dns_update.rb - About 2 hrs 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 record_action has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def record_action(type, type_enum, value, action)
    # Send the update to the zone's primary master.
    domain = datastore['DOMAIN']
    fqdn   = "#{datastore['HOSTNAME']}.#{domain}"
    opts   = {nameserver: datastore['RHOST']}
Severity: Major
Found in modules/auxiliary/admin/dns/dyn_dns_update.rb - About 2 hrs to fix

    Method record_action has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def record_action(type, type_enum, value, action)
        # Send the update to the zone's primary master.
        domain = datastore['DOMAIN']
        fqdn   = "#{datastore['HOSTNAME']}.#{domain}"
        opts   = {nameserver: datastore['RHOST']}
    Severity: Minor
    Found in modules/auxiliary/admin/dns/dyn_dns_update.rb - About 1 hr 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 update_record has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update_record(type:, type_enum:, value:, value_name:)
        if value.nil? || value == ""
          print_error "Record type #{type} requires the #{value_name} parameter to be specified"
          return
        end
    Severity: Minor
    Found in modules/auxiliary/admin/dns/dyn_dns_update.rb - About 1 hr to fix

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

        def initialize
          super(
              'Name'           => 'DNS Server Dynamic Update Record Injection',
              'Description'    => %q{
              This module allows adding and/or deleting a record to
      Severity: Minor
      Found in modules/auxiliary/admin/dns/dyn_dns_update.rb - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status