ManageIQ/manageiq-smartstate

View on GitHub

Showing 344 of 711 total issues

Class Win32EventLog has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

class Win32EventLog
  using ManageIQ::UnicodeString

  # Standard file log names
  SYSTEM_LOGS = %w(Application System Security)
Severity: Minor
Found in lib/metadata/util/win32/Win32EventLog.rb - About 4 hrs to fix

Method copy has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring.
Open

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

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

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

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

    def findEntry(name, flags = FE_EITHER)
      de = nil # found directory entry.
      skip_next = found = false
      offset = 0

Severity: Minor
Found in lib/fs/fat32/directory.rb - About 3 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 28 (exceeds 8 allowed). Consider refactoring.
Open

  def initialize(filename, ost = nil) # TODO: Always pass in MiqVm
    ost ||= OpenStruct.new
    @ost = ost
    @dataDir = ost.config.try(:dataDir)
    ost.scanData = {} if ost.scanData.nil?
Severity: Minor
Found in lib/metadata/MIQExtract/MIQExtract.rb - About 3 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 MSRegHive has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

class MSRegHive
  using ManageIQ::UnicodeString

  attr_reader :fileLoadTime, :fileParseTime, :digitalProductKeys, :xmlNode

Severity: Minor
Found in lib/metadata/util/win32/ms-registry.rb - About 3 hrs to fix

Method d_init has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
Open

  def d_init
    # Check to see if a descriptor was not embedded.
    descriptor = dInfo.Descriptor
    if descriptor.nil?
      f = File.open(dInfo.fileName, "rb")
Severity: Minor
Found in lib/disk/modules/VMWareDescriptor.rb - About 3 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 dumpCacheRanges has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
Open

    def dumpCacheRanges
      str = k_start = k_prev = nil
      invalid = true
      out = []
      @clusters.keys.sort.each do |k|
Severity: Minor
Found in lib/fs/ntfs/data_run.rb - About 3 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 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(fs)
      @fs = fs
      @os_type = "Linux"
      @distribution = nil
      @description  = nil
Severity: Major
Found in lib/metadata/linux/LinuxOSInfo.rb - About 3 hrs to fix

Method doUpdate has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def doUpdate(cs)
    #
    # The directory where the collection will be created.
    #
    destDir = cs.todir
Severity: Major
Found in lib/fs/MiqFsUtil.rb - About 3 hrs to fix

Method insert_XML has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
Open

  def insert_XML(key, value, xml)
    maj, min, other = key.split(".")

    # Any elements that cannot be split are put into a misc class
    min, maj = maj, maj if min.nil?
Severity: Minor
Found in lib/metadata/VmConfig/VmConfig.rb - About 3 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 files has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
Open

  def files(miqvm = nil)
    return @files if @files
    log_header = "VmConfig.files"

    @files = []
Severity: Minor
Found in lib/metadata/VmConfig/VmConfig.rb - About 3 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 readVBLK has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
Open

  def self.readVBLK(disk, ph)
    vblk = LdmScanner.readStruct(disk, LdmScanner::VBLK)
    return if vblk.data_length == 0
    buf = vblk.padding

Severity: Minor
Found in lib/VolumeManager/MiqLdm.rb - About 3 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 prepare_filter! has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
Open

  def self.prepare_filter!(filter)
    raise ArgumentError, "filter must be a Hash" unless filter.kind_of?(Hash)

    filter[:rec_count] = 0 if filter[:rec_count].nil?

Severity: Minor
Found in lib/metadata/util/event_log_filter.rb - About 3 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 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

      regHnd = RemoteRegistry.new(fs, true)
      software_doc = regHnd.loadHive("software", [
Severity: Major
Found in lib/metadata/util/win32/Win32System.rb - About 3 hrs to fix

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

class MiqMountManager < MiqFS
  attr_accessor :rootVolume, :volumes, :guestOS, :fileSystems, :devHash, :osNames, :volMgr, :noFsVolumes, :payloads

  def self.mountVolumes(volMgr, vmCfg, ost = nil)
    rootTrees = []
Severity: Minor
Found in lib/fs/MiqMountManager.rb - About 3 hrs to fix

Method systemIdentifier has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
Open

    def self.systemIdentifier(fs = nil, options = {})
      # If we are not passed a fs handle return the %systemRoot% from the environment
      if fs.nil?
        raise(MiqException::MiqVmMountError, "System root not available through environment variables.") if ENV["SystemRoot"].nil?
        return File.expand_path(ENV["SystemRoot"].tr('\\', '/'))
Severity: Minor
Found in lib/metadata/util/win32/system_path_win.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 convert has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
Open

  def convert(filename)
    @convertText = ""
    # $log.debug "Processing Windows Configuration file [#{filename}]"

    xml_data = nil
Severity: Minor
Found in lib/metadata/VmConfig/xmlConfig.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 fs_init has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
Open

  def fs_init
    @guestOS = "Windows"

    @rootFS = MiqFS.getFS(@rootVolume)
    raise MiqException::MiqVmMountError, "WinMount: could not mount root volume" unless @rootFS
Severity: Minor
Found in lib/fs/modules/WinMount.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 readVBLK has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.readVBLK(disk, ph)
    vblk = LdmScanner.readStruct(disk, LdmScanner::VBLK)
    return if vblk.data_length == 0
    buf = vblk.padding

Severity: Major
Found in lib/VolumeManager/MiqLdm.rb - About 2 hrs to fix
Severity
Category
Status
Source
Language