rapid7/metasploit-framework

View on GitHub
plugins/request.rb

Summary

Maintainability
C
1 day
Test Coverage

Method parse_args_http has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_args_http(args = [], _type = 'http')
        opt_parser = Rex::Parser::Arguments.new(
          '-0' => [ false, 'Use HTTP 1.0' ],
          '-1' => [ false, 'Use TLSv1 (SSL)' ],
          '-2' => [ false, 'Use SSLv2 (SSL)' ],
Severity: Major
Found in plugins/request.rb - About 2 hrs to fix

    Method cmd_request has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def cmd_request(*args)
            # short circuit the whole deal if they need help
            return help if args.empty?
            return help if args.length == 1 && args.first =~ HELP_REGEX
    
    
    Severity: Minor
    Found in plugins/request.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 handle_request_http has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def handle_request_http(opts, _opt_parser)
            uri = opts[:uri]
            http_client = Rex::Proto::Http::Client.new(
              uri.host,
              uri.port,
    Severity: Minor
    Found in plugins/request.rb - About 2 hrs to fix

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

            def cmd_request(*args)
              # short circuit the whole deal if they need help
              return help if args.empty?
              return help if args.length == 1 && args.first =~ HELP_REGEX
      
      
      Severity: Minor
      Found in plugins/request.rb - About 1 hr to fix

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

              def handle_request_http(opts, _opt_parser)
                uri = opts[:uri]
                http_client = Rex::Proto::Http::Client.new(
                  uri.host,
                  uri.port,
        Severity: Minor
        Found in plugins/request.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 parse_args_http has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_args_http(args = [], _type = 'http')
                opt_parser = Rex::Parser::Arguments.new(
                  '-0' => [ false, 'Use HTTP 1.0' ],
                  '-1' => [ false, 'Use TLSv1 (SSL)' ],
                  '-2' => [ false, 'Use SSLv2 (SSL)' ],
        Severity: Minor
        Found in plugins/request.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 output_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def output_line(opts, line)
                if opts[:output_file].nil?
                  if line[-2..] == "\r\n"
                    print_line(line[0..-3])
                  elsif line[-1] == "\n"
        Severity: Minor
        Found in plugins/request.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