rapid7/metasploit-framework

View on GitHub

Showing 13,691 of 19,405 total issues

Method collect_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_response
      return unless in_item
      return unless has_text
      response_text = @text.dup
      response_header_text,response_body_text = response_text.split(/\r*\n\r*\n/n,2)
Severity: Minor
Found in lib/rex/parser/burp_session_document.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

Method handle_parse_warnings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_parse_warnings(&block)
      return if @parse_warnings.empty?
      return unless block
      @parse_warnings.each_with_index do |pwarn,i|
        unless @parse_warned.include? i
Severity: Minor
Found in lib/rex/parser/burp_session_document.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

Method end_element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def end_element(name=nil)
      block = @block
      case name
      when "Issue" # Wrap it up
        record_issue
Severity: Minor
Found in lib/rex/parser/appscan_document.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

Method record_host_osclass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def record_host_osclass(attrs)
      return unless in_tag("host")
      return unless in_tag("os")
      @state[:os] ||= {}
      temp_hash = attr_hash(attrs)
Severity: Minor
Found in lib/rex/parser/nmap_document.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

Method record_port_service has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def record_port_service(attrs)
      return unless in_tag("host")
      return unless in_tag("port")
      svc = attr_hash(attrs)
      if svc["name"] && @args[:fix_services]
Severity: Minor
Found in lib/rex/parser/nmap_document.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

Method record_host_osmatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def record_host_osmatch(attrs)
      return unless in_tag("host")
      return unless in_tag("os")
      temp_hash = attr_hash(attrs)
      if temp_hash["accuracy"].to_i == 100
Severity: Minor
Found in lib/rex/parser/nmap_document.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

Method report_vuln has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def report_vuln
        return unless @state[:service_object]
        return unless @state[:vuln_name]
        return unless @state[:issue_detail]
        vuln_info = {workspace: @args[:workspace]}
Severity: Minor
Found in lib/rex/parser/burp_issue_document.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

Method extract_deployment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.extract_deployment(deployment)
    return [] if deployment.nil?
    domain    = deployment.elements['Login/Credentials/Domain'].get_text.value rescue ''
    username  = deployment.elements['Login/Credentials/Username'].get_text.value rescue ''
    password  = deployment.elements['Login/Credentials/Password'].get_text.value rescue ''
Severity: Minor
Found in lib/rex/parser/unattend.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

Method cmd_load_custom_methods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def cmd_load_custom_methods(*args)
    if args.length > 0
      cmd_load_custom_methods_help
      return true
    end
Severity: Minor
Found in lib/rex/post/hwbridge/ui/console/command_dispatcher/core.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

Method report_services has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def report_services(host_object,&block)
      return unless host_object.kind_of? ::Mdm::Host
      return unless @report_data[:ports]
      return if @report_data[:ports].empty?
      reported = []
Severity: Minor
Found in lib/rex/parser/nmap_document.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

Method start_element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def start_element(name=nil,attrs=[])
    return nil if in_tag("JobOrder")
    attrs = normalize_attrs(attrs)
    attrs = attr_hash(attrs)
    @state[:current_tag][name] = true
Severity: Minor
Found in lib/rex/parser/fusionvm_document.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

Method record_service_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def record_service_info(attrs)
      return unless in_tag("nodes")
      return unless in_tag("node")
      return unless in_tag("service")
      @state[:service].merge! attr_hash(attrs)
Severity: Minor
Found in lib/rex/parser/nexpose_raw_document.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

Method report_host_fingerprint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def report_host_fingerprint(host_object)
      return unless host_object.kind_of? ::Mdm::Host
      return unless @report_data[:host_fingerprint].kind_of? Hash
      @report_data[:host_fingerprint].reject! {|k,v| v.nil? || v.empty?}
      return if @report_data[:host_fingerprint].empty?
Severity: Minor
Found in lib/rex/parser/nexpose_simple_document.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

Method short_arg_from_long_arg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def short_arg_from_long_arg(long_arg)
        fmt_option = fmt.find { |key, value| value if key.include?(long_arg) }.first
        # if fmt_option == [long_arg] that means that a short flag option for it does not exist
        return if fmt_option.nil? || fmt_option == [long_arg]

Severity: Minor
Found in lib/rex/parser/arguments.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

Method report_web_host_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def report_web_host_info
      return unless @state[:web_site]
      return unless @state[:uri].kind_of? URI::HTTP
      return unless @state[:web_site].service.host.name.to_s.empty?
      host_info = {:workspace => @args[:workspace]}
Severity: Minor
Found in lib/rex/parser/burp_session_document.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

Method extract_autologon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.extract_autologon(auto_logon)
    return [] if auto_logon.nil?

    domain    = auto_logon.elements['Domain'].get_text.value rescue ''
    username  = auto_logon.elements['Username'].get_text.value rescue ''
Severity: Minor
Found in lib/rex/parser/unattend.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

Method tag_end has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def tag_end(name)
    case name
    when "vulnerability"
      @vuln.keys.each do |k|
        @vuln[k] = @vuln[k].strip if @vuln[k].kind_of?(::String)
Severity: Minor
Found in lib/rex/parser/netsparker_xml.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

Method from_xml_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def self.from_xml_attributes(xml_attrs)
            id = xml_attrs['id']
            raise Error::InvalidAttributeError.new('key', 'id') if id.nil?

            name = xml_attrs['attr.name']
Severity: Minor
Found in lib/rex/parser/graphml.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

Method collect_port has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_port
      return unless in_item
      return unless has_text
      return unless @text.to_i.to_s == @text.to_s
      @state[:port] = @text.to_i
Severity: Minor
Found in lib/rex/parser/burp_session_document.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

Method store has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def store(src, sink, level = 0)
    log_sinks_lock.synchronize {
      if (log_sinks[src] == nil)
        log_sinks[src] = sink

Severity: Minor
Found in lib/rex/logging/log_dispatcher.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

Severity
Category
Status
Source
Language