rapid7/metasploit-framework

View on GitHub
lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb

Summary

Maintainability
D
1 day
Test Coverage

File util.rb has 392 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rex/post/meterpreter/extensions/stdapi/railgun/library_helper'

module Rex
module Post
module Meterpreter
Severity: Minor
Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 5 hrs to fix

    Class Util has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class  Util
    
      # Bring in some useful string manipulation utility functions
      include LibraryHelper
    
    
    Severity: Minor
    Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 3 hrs to fix

      Method sizeof_type has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def sizeof_type(type)
          if is_pointer_type?(type)
            return pointer_size
          end
      
      
      Severity: Minor
      Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.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 sizeof_type has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def sizeof_type(type)
          if is_pointer_type?(type)
            return pointer_size
          end
      
      
      Severity: Minor
      Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                return PRIMITIVE_TYPE_SIZES[primitive]
        Severity: Major
        Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return raw.unpack('V').first == 1
          Severity: Major
          Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return raw.unpack('V').first
            Severity: Major
            Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return raw
              Severity: Major
              Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return pointer_size
                Severity: Major
                Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status