rapid7/metasploit-framework

View on GitHub
lib/msf/ui/console/command_dispatcher/developer.rb

Summary

Maintainability
D
2 days
Test Coverage

File developer.rb has 395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Msf::Ui::Console::CommandDispatcher::Developer

  include Msf::Ui::Console::CommandDispatcher

  @@irb_opts = Rex::Parser::Arguments.new(
Severity: Minor
Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 5 hrs to fix

    Class Developer has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Msf::Ui::Console::CommandDispatcher::Developer
    
      include Msf::Ui::Console::CommandDispatcher
    
      @@irb_opts = Rex::Parser::Arguments.new(
    Severity: Minor
    Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 3 hrs to fix

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

        def cmd__historymanager(*args)
          if args.include?('-h') || args.include?('--help')
            cmd__historymanager_help
            return false
          end
      Severity: Minor
      Found in lib/msf/ui/console/command_dispatcher/developer.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 cmd_irb has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def cmd_irb(*args)
          expressions = []
      
          # Parse the command options
          @@irb_opts.parse(args) do |opt, idx, val|
      Severity: Minor
      Found in lib/msf/ui/console/command_dispatcher/developer.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 cmd__historymanager has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def cmd__historymanager(*args)
          if args.include?('-h') || args.include?('--help')
            cmd__historymanager_help
            return false
          end
      Severity: Minor
      Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 1 hr to fix

        Method cmd_irb has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def cmd_irb(*args)
            expressions = []
        
            # Parse the command options
            @@irb_opts.parse(args) do |opt, idx, val|
        Severity: Minor
        Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 1 hr to fix

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

            def cmd__servicemanager(*args)
              if args.include?('-h') || args.include?('--help')
                cmd__servicemanager_help
                return false
              end
          Severity: Minor
          Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 1 hr to fix

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

              def cmd_time(*args)
                if args.empty? || args.first == '-h' || args.first == '--help'
                  cmd_time_help
                  return true
                end
            Severity: Minor
            Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 1 hr to fix

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

                def cmd_edit(*args)
                  editing_module = false
              
                  if args.length > 0
                    path = File.expand_path(args[0])
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/developer.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 modified_file_paths has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def modified_file_paths(print_errors: true)
                  files, is_success = modified_files
              
                  unless is_success
                    print_error("Git is not available") if print_errors
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/developer.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

              Method cmd__servicemanager has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd__servicemanager(*args)
                  if args.include?('-h') || args.include?('--help')
                    cmd__servicemanager_help
                    return false
                  end
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/developer.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

              Method reload_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def reload_file(path, print_errors: true)
                  full_path = File.expand_path(path)
              
                  unless File.exist?(full_path) && full_path.end_with?('.rb')
                    print_error("#{full_path} must exist and be a .rb file") if print_errors
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/developer.rb - About 45 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_log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd_log(*args)
                  path = File.join(Msf::Config.log_directory, 'framework.log')
              
                  # XXX: +G isn't portable and may hang on large files
                  pager = local_pager.to_s.include?('less') ? "#{local_pager} +G" : local_pager
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/developer.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

              There are no issues that match your filters.

              Category
              Status