rapid7/metasploit-framework

View on GitHub
lib/msf/core/rhosts_walker.rb

Summary

Maintainability
C
1 day
Test Coverage

Method parse has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(value, datastore)
      Enumerator.new do |results|
        # extract the individual elements from the rhost string, ensuring that
        # whitespace, strings, escape characters, etc are handled correctly.
        values = Rex::Parser::Arguments.from_s(value)
Severity: Minor
Found in lib/msf/core/rhosts_walker.rb - About 5 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 parse has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse(value, datastore)
      Enumerator.new do |results|
        # extract the individual elements from the rhost string, ensuring that
        # whitespace, strings, escape characters, etc are handled correctly.
        values = Rex::Parser::Arguments.from_s(value)
Severity: Major
Found in lib/msf/core/rhosts_walker.rb - About 2 hrs to fix

    Method parse_http_uri has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_http_uri(value, datastore)
          uri = ::Addressable::URI.parse(value)
          result = {}
    
          result['RHOSTS'] = uri.hostname
    Severity: Minor
    Found in lib/msf/core/rhosts_walker.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 parse_smb_uri has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_smb_uri(value, datastore)
          uri = ::Addressable::URI.parse(value)
          result = {}
    
          result['RHOSTS'] = uri.hostname
    Severity: Minor
    Found in lib/msf/core/rhosts_walker.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 each has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def each(&block)
          return unless @value
          return unless block_given?
    
          parse(@value, @datastore).each do |result|
    Severity: Minor
    Found in lib/msf/core/rhosts_walker.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

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

        def errors(&block)
          return unless @value
          return unless block_given?
    
          parse(@value, @datastore).each do |result|
    Severity: Minor
    Found in lib/msf/core/rhosts_walker.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

    There are no issues that match your filters.

    Category
    Status