rapid7/metasploit-framework

View on GitHub
lib/msf/ui/console/local_file_system.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method list_local_path has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        def list_local_path(path, sort, order, search_term = nil)
          # Single file as path
          unless ::File.directory?(path)
            perms = pretty_perms(path)
            stat = ::File.stat(path)
Severity: Minor
Found in lib/msf/ui/console/local_file_system.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 list_local_path has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def list_local_path(path, sort, order, search_term = nil)
          # Single file as path
          unless ::File.directory?(path)
            perms = pretty_perms(path)
            stat = ::File.stat(path)
Severity: Minor
Found in lib/msf/ui/console/local_file_system.rb - About 1 hr to fix

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

            def cmd_lls(*args)
              # Set Defaults
              path = ::Dir.pwd
              sort = 'Name'
              order = :forward
    Severity: Minor
    Found in lib/msf/ui/console/local_file_system.rb - About 1 hr to fix

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

              def pretty_perms(path)
                m = ::File.stat(path).mode
                om = '%04o' % m
                perms = ''
      
      
      Severity: Minor
      Found in lib/msf/ui/console/local_file_system.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_lcat has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def cmd_lcat(*args)
                if args.empty? || args.include?('-h') || args.include?('--help')
                  print_line('Usage: lcat file')
                  return true
                end
      Severity: Minor
      Found in lib/msf/ui/console/local_file_system.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_lls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def cmd_lls(*args)
                # Set Defaults
                path = ::Dir.pwd
                sort = 'Name'
                order = :forward
      Severity: Minor
      Found in lib/msf/ui/console/local_file_system.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