rapid7/metasploit-credential

View on GitHub

Showing 25 of 29 total issues

Method import_long_form has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

  def import_long_form
    all_creds_valid = true
    realms = Hash.new
    Metasploit::Credential::Core.transaction do
      core_opts = []
Severity: Minor
Found in lib/metasploit/credential/importer/core.rb - About 1 day 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

File creation.rb has 323 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rex/socket'

# Implements a set of "convenience methods" for creating credentials and related portions of the object graph.  Creates
# {Metasploit::Credential::Core} objects and their attendant relationships as well as {Metasploit::Credential::Login}
# objects and their attendant `Mdm::Host` and `Mdm::Service` objects.
Severity: Minor
Found in lib/metasploit/credential/creation.rb - About 3 hrs to fix

    Method create_credential_login has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_credential_login(opts={})
        return nil unless active_db?
    
        if self.respond_to?(:[]) and self[:task]
          opts[:task_id] ||= self[:task].record.id
    Severity: Minor
    Found in lib/metasploit/credential/creation.rb - About 3 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 import_short_form has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def import_short_form
        core_opts = []
        all_creds_valid = true
        Metasploit::Credential::Core.transaction do
          csv_object.each do |row|
    Severity: Minor
    Found in lib/metasploit/credential/importer/core.rb - About 3 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 import_long_form has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def import_long_form
        all_creds_valid = true
        realms = Hash.new
        Metasploit::Credential::Core.transaction do
          core_opts = []
    Severity: Major
    Found in lib/metasploit/credential/importer/core.rb - About 2 hrs to fix

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

        def create_credential_and_login(opts={})
          return nil unless active_db?
      
          if self.respond_to?(:[]) and self[:task]
            opts[:task_id] ||= self[:task].record.id
      Severity: Minor
      Found in lib/metasploit/credential/creation.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 import! has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def import!
          service_info = nil
          Metasploit::Credential::Core.transaction do
            input.each_line do |line|
              case line
      Severity: Major
      Found in lib/metasploit/credential/importer/pwdump.rb - About 2 hrs to fix

        Method import! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          def import!
            service_info = nil
            Metasploit::Credential::Core.transaction do
              input.each_line do |line|
                case line
        Severity: Minor
        Found in lib/metasploit/credential/importer/pwdump.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 consistent_workspaces has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def consistent_workspaces
            case origin
              when Metasploit::Credential::Origin::Manual
                user = origin.user
        
        
        Severity: Minor
        Found in app/models/metasploit/credential/core.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 create_cracked_credential has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def create_cracked_credential(opts={})
            return nil unless active_db?
        
            if self.respond_to?(:[]) and self[:task]
              opts[:task_id] ||= self[:task].record.id
        Severity: Minor
        Found in lib/metasploit/credential/creation.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 create_cracked_credential has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_cracked_credential(opts={})
            return nil unless active_db?
        
            if self.respond_to?(:[]) and self[:task]
              opts[:task_id] ||= self[:task].record.id
        Severity: Minor
        Found in lib/metasploit/credential/creation.rb - About 1 hr to fix

          Method create_credential_private has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def create_credential_private(opts={})
              return nil unless active_db?
              private_data = opts.fetch(:private_data)
              private_type = opts.fetch(:private_type)
          
          
          Severity: Minor
          Found in lib/metasploit/credential/creation.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 create_credential has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def create_credential(opts={})
              return nil unless active_db?
          
              if self.respond_to?(:[]) and self[:task]
                opts[:task_id] ||= self[:task].record.id
          Severity: Minor
          Found in lib/metasploit/credential/creation.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 create_credential_private has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def create_credential_private(opts={})
              return nil unless active_db?
              private_data = opts.fetch(:private_data)
              private_type = opts.fetch(:private_type)
          
          
          Severity: Minor
          Found in lib/metasploit/credential/creation.rb - About 1 hr to fix

            Method create_credential_login has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create_credential_login(opts={})
                return nil unless active_db?
            
                if self.respond_to?(:[]) and self[:task]
                  opts[:task_id] ||= self[:task].record.id
            Severity: Minor
            Found in lib/metasploit/credential/creation.rb - About 1 hr to fix

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

                def create_credential_and_login(opts={})
                  return nil unless active_db?
              
                  if self.respond_to?(:[]) and self[:task]
                    opts[:task_id] ||= self[:task].record.id
              Severity: Minor
              Found in lib/metasploit/credential/creation.rb - About 1 hr to fix

                Method cluster has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.cluster(*classes)
                    class_queue = classes.dup
                    visited_class_set = Set.new
                
                    until class_queue.empty?
                Severity: Minor
                Found in lib/metasploit/credential/entity_relationship_diagram.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 header_format_and_csv_wellformedness has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def header_format_and_csv_wellformedness
                    begin
                      if csv_object.header_row?
                        csv_headers = csv_object.first.fields
                        if csv_headers_are_correct?(csv_headers)
                Severity: Minor
                Found in lib/metasploit/credential/importer/core.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 create_credential has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def create_credential(opts={})
                    return nil unless active_db?
                
                    if self.respond_to?(:[]) and self[:task]
                      opts[:task_id] ||= self[:task].record.id
                Severity: Minor
                Found in lib/metasploit/credential/creation.rb - About 1 hr to fix

                  Method import_short_form has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def import_short_form
                      core_opts = []
                      all_creds_valid = true
                      Metasploit::Credential::Core.transaction do
                        csv_object.each do |row|
                  Severity: Minor
                  Found in lib/metasploit/credential/importer/core.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language