ManageIQ/manageiq-smartstate

View on GitHub

Showing 344 of 711 total issues

Method initialize has a Cognitive Complexity of 43 (exceeds 8 allowed). Consider refactoring.
Open

    def initialize(_c, fs)
      @networks = []

      regHnd = RemoteRegistry.new(fs, true)
      software_doc = regHnd.loadHive("software", [
Severity: Minor
Found in lib/metadata/util/win32/Win32System.rb - About 6 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 process_users_v has 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def process_users_v(data)
      bin = MSRegHive.regBinaryToRawBinary(data)
      header_size = SIZEOF_SAM_STRUCT_USERS_V_HEADER
      v = BinaryStruct.decode(bin[0...header_size], SAM_STRUCT_USERS_V_HEADER)

Severity: Major
Found in lib/metadata/util/win32/Win32Accounts.rb - About 5 hrs to fix

Method fields has a Cognitive Complexity of 39 (exceeds 8 allowed). Consider refactoring.
Open

    def fields
      return @fields if @fields

      return nil if @data.nil?
      len     = @data[0].ord
Severity: Minor
Found in lib/db/MiqSqlite/MiqSqlite3Cell.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 initialize has a Cognitive Complexity of 38 (exceeds 8 allowed). Consider refactoring.
Open

    def initialize(fs)
      @userHash = {}
      @usersByGid = Hash.new { |h, k| h[k] = [] }
      @groups = []

Severity: Minor
Found in lib/metadata/linux/LinuxUsers.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

File MiqFS.rb has 382 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'stringio'
require 'find'

require 'fs/MiqFS/FsProbe'

Severity: Minor
Found in lib/fs/MiqFS/MiqFS.rb - About 5 hrs to fix

Class Inode has 39 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Inode
    # Bits 0 to 8 of file mode.
    PF_O_EXECUTE  = 0x0001  # owner execute
    PF_O_WRITE    = 0x0002  # owner write
    PF_O_READ     = 0x0004  # owner read
Severity: Minor
Found in lib/fs/ext4/inode.rb - About 5 hrs to fix

File inode.rb has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'fs/ext4/directory_entry'
require 'fs/ext4/extent'
require 'fs/ext4/extent_header'
require 'fs/ext4/extent_index'

Severity: Minor
Found in lib/fs/ext4/inode.rb - About 5 hrs to fix

Method add_disk_stats has a Cognitive Complexity of 36 (exceeds 8 allowed). Consider refactoring.
Open

  def add_disk_stats(xml, miqvm)
    # Now loop over the xml and find disk files
    xml.find_first("/*/hardware").each_recursive do |e|
      # Find elements that have a filename attribute
      # Loop through the "whole disks" and get the size for this disk
Severity: Minor
Found in lib/metadata/VmConfig/VmConfig.rb - About 4 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 findInEntries has a Cognitive Complexity of 36 (exceeds 8 allowed). Consider refactoring.
Open

    def findInEntries(name, entries)
      log_prefix = "MIQ(NTFS::IndexRoot.findInEntries)"

      if @foundEntries.key?(name)
        $log.debug "#{log_prefix} Found [#{name}] in #{entries.collect { |e| e.isLast? ? "**last**" : e.name.downcase }.inspect}" if DEBUG_TRACE_FIND
Severity: Minor
Found in lib/fs/ntfs/attrib_index_root.rb - About 4 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 readLog has a Cognitive Complexity of 35 (exceeds 8 allowed). Consider refactoring.
Open

  def readLog(log, filter = nil)
    filter ||= {}
    EventLogFilter.prepare_filter!(filter)

    # Get message source files.  (This also caches the event log registry entries.)
Severity: Minor
Found in lib/metadata/util/win32/Win32EventLog.rb - About 4 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 octal_to_permissions has a Cognitive Complexity of 35 (exceeds 8 allowed). Consider refactoring.
Open

    def self.octal_to_permissions(octal, ftype = nil)
      perms = ""

      unless ftype.nil?
        ftype = ftype[0, 1]
Severity: Minor
Found in lib/metadata/linux/LinuxUtils.rb - About 4 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 initialize has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(_c, fs)
      @users = []
      @groups = []

      # Extracted data also built into a human-readable format if uncommented
Severity: Major
Found in lib/metadata/util/win32/Win32Accounts.rb - About 4 hrs to fix

Method postProcessDisks has a Cognitive Complexity of 34 (exceeds 8 allowed). Consider refactoring.
Open

  def postProcessDisks
    # Convert absolute paths to relative paths for the disks
    if @direct_file_access
      getAllDiskKeys.each do |dk|
        next if @cfgHash[dk + ".devicetype"] && @cfgHash[dk + ".devicetype"].include?("cdrom")
Severity: Minor
Found in lib/metadata/VmConfig/VmConfig.rb - About 4 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 loadXmlData has a Cognitive Complexity of 34 (exceeds 8 allowed). Consider refactoring.
Open

    def loadXmlData(filename, ost = nil)
      # Make sure we have a valid openstruct handle and "from_time" is in a valid format
      ost = OpenStruct.new if ost.nil?
      # Check 'from_time' value and possible remove from the open struct
      validate_from_time(ost)
Severity: Minor
Found in lib/blackbox/xmlStorage.rb - About 4 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 copyIn has a Cognitive Complexity of 34 (exceeds 8 allowed). Consider refactoring.
Open

  def copyIn(from, to, recursive = false)
    allTargets = []
    from = [from] unless from.kind_of?(Array)
    from.each { |t| allTargets.concat(Dir.glob(t)) }

Severity: Minor
Found in lib/fs/MiqFS/MiqFS.rb - About 4 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 process_users_f has a Cognitive Complexity of 33 (exceeds 8 allowed). Consider refactoring.
Open

    def process_users_f(data)
      f = BinaryStruct.decode(MSRegHive.regBinaryToRawBinary(data), SAM_STRUCT_USERS_F)

      @debug_str += "        last_logon              - %s - " % f['last_logon'].to_s if @debug_str
      f['last_logon'] = process_users_f_date(f['last_logon'])
Severity: Minor
Found in lib/metadata/util/win32/Win32Accounts.rb - About 4 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 each_record has a Cognitive Complexity of 33 (exceeds 8 allowed). Consider refactoring.
Open

  def each_record(hdr, log)
    # Check for an empty event log file
    return if hdr[:oldest_record_number].zero?

    last_pos = pos = getNextRecordOffset(nil, hdr)
Severity: Minor
Found in lib/metadata/util/win32/Win32EventLog.rb - About 4 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 hostd_log_to_hashes has a Cognitive Complexity of 33 (exceeds 8 allowed). Consider refactoring.
Open

  def hostd_log_to_hashes(log, filter = nil)
    filter ||= {}
    EventLogFilter.prepare_filter!(filter)

    ret = []
Severity: Minor
Found in lib/metadata/ScanProfile/modules/HostScanItemNteventlog.rb - About 4 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 convert_vmsd has a Cognitive Complexity of 32 (exceeds 8 allowed). Consider refactoring.
Open

  def convert_vmsd(f)
    # Only read the enabled snapshots from the file and ignore the rest
    numSnapshots = timeHigh = timeLow = nil
    knownSnapshots = []
    fileData = ""
Severity: Minor
Found in lib/metadata/VmConfig/vmxConfig.rb - About 4 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

Class PEheader has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

class PEheader
  using ManageIQ::UnicodeString

  IMAGE_NT_SIGNATURE = "PE\0\0"
  IMAGE_DOS_SIGNATURE = "MZ"
Severity: Minor
Found in lib/metadata/util/win32/peheader.rb - About 4 hrs to fix
Severity
Category
Status
Source
Language