rapid7/metasploit-framework

View on GitHub
lib/rex/parser/outpost24_document.rb

Summary

Maintainability
F
4 days
Test Coverage

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

  def start_element(name, attrs)
    @state[:current_tag][name] = true
    case name
    when "description", "information"
      return unless in_tag("detaillist")
Severity: Minor
Found in lib/rex/parser/outpost24_document.rb - About 7 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 end_element has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

  def end_element(name)
    case name
    when "description", "information"
      return unless in_tag("detaillist")
      return unless in_tag("detail")
Severity: Minor
Found in lib/rex/parser/outpost24_document.rb - About 7 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 end_element has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def end_element(name)
    case name
    when "description", "information"
      return unless in_tag("detaillist")
      return unless in_tag("detail")
Severity: Minor
Found in lib/rex/parser/outpost24_document.rb - About 1 hr to fix

    Method start_element has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def start_element(name, attrs)
        @state[:current_tag][name] = true
        case name
        when "description", "information"
          return unless in_tag("detaillist")
    Severity: Minor
    Found in lib/rex/parser/outpost24_document.rb - About 1 hr to fix

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

        def collect_vuln_data(name)
          @state[:has_text] = false
          if name == "name"
            @state[:vname] = @text.strip if @text
          elsif name == "description"
      Severity: Minor
      Found in lib/rex/parser/outpost24_document.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 collect_service_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def collect_service_data(name)
          @state[:has_text] = false
          if name == "portnumber"
            @state[:port] = @text.strip if @text
          elsif name == "protocol"
      Severity: Minor
      Found in lib/rex/parser/outpost24_document.rb - About 55 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

      Avoid deeply nested control flow statements.
      Open

            @state[:ref] = @text.strip if @text
      Severity: Major
      Found in lib/rex/parser/outpost24_document.rb - About 45 mins to fix

        Method collect_host_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def collect_host_data(name)
            @state[:has_text] = false
            if name == "name"
              @state[:hname] = @text.strip if @text
            elsif name == "platform"
        Severity: Minor
        Found in lib/rex/parser/outpost24_document.rb - About 35 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

        Avoid too many return statements within this method.
        Open

              return unless in_tag("host") || in_tag("detail")
        Severity: Major
        Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return unless in_tag("detaillist")
          Severity: Major
          Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return unless in_tag("detail")
            Severity: Major
            Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return unless in_tag("cve")
              Severity: Major
              Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return unless in_tag("portlist-host")
                Severity: Major
                Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return unless in_tag("detaillist")
                  Severity: Major
                  Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          return unless in_tag("portlist")
                    Severity: Major
                    Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                            return unless in_tag("host")
                      Severity: Major
                      Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return unless in_tag("portinfo")
                        Severity: Major
                        Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                return unless in_tag("hostlist") || in_tag("detaillist")
                          Severity: Major
                          Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                  return unless in_tag("hostlist")
                            Severity: Major
                            Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                    return unless in_tag("host")
                              Severity: Major
                              Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                      return unless in_tag("portlist")
                                Severity: Major
                                Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                        return unless in_tag("hostlist")
                                  Severity: Major
                                  Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                          return unless in_tag("portlist")
                                    Severity: Major
                                    Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                            return unless in_tag("detail")
                                      Severity: Major
                                      Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                              return unless in_tag("cve")
                                        Severity: Major
                                        Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                return unless in_tag("portlist-host")
                                          Severity: Major
                                          Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                  return unless in_tag("portinfo")
                                            Severity: Major
                                            Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                    return unless in_tag("portlist")
                                              Severity: Major
                                              Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                      return unless in_tag("portlist-host")
                                                Severity: Major
                                                Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                        return unless in_tag("portlist-host")
                                                  Severity: Major
                                                  Found in lib/rex/parser/outpost24_document.rb - About 30 mins to fix

                                                    There are no issues that match your filters.

                                                    Category
                                                    Status