axsh/wakame-vdc

View on GitHub

Showing 893 of 1,587 total issues

Method on_associate_volume has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def on_associate_volume(instance, volume)
          if instance.boot_volume_id == volume.canonical_uuid && volume.guest_device_name.nil?
            # set device name as boot drive.
            volume.guest_device_name =
              if instance.image.features[:virtio]
Severity: Minor
Found in dcmgr/lib/dcmgr/drivers/hypervisor/linux_hypervisor/kvm.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

Method hypervisor_driver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def hypervisor_driver(driver_class)
        if driver_class.is_a?(Class) && driver_class < (Drivers::Hypervisor)
          # TODO: do not create here. the configuration object needs to be attached in earlier phase.
          @config[:hypervisor_driver][driver_class] ||= driver_class.configuration_class.new(self)
        elsif (c = Drivers::Hypervisor.driver_class(driver_class))
Severity: Minor
Found in dcmgr/lib/dcmgr/configurations/hva.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

Method validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def validate(errors)
        unless self.amqp_server_uri
          errors << "Unknown amqp_server_uri: #{self.amqp_server_uri}"
        end
        unless self.export_uri
Severity: Minor
Found in dcmgr/lib/dcmgr/configurations/bksta.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

Method issue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.issue(command_str,cmd)
    dcmgr_path = DcmgrGui::Application.config.dcmgr_path
    ssh = 'ssh root@`hostname`'
    ruby_path = "#{dcmgr_path}/ruby/bin"
    gem_home = "GEM_HOME=#{dcmgr_path}/.vender/bundle/ruby/1.9.1"
Severity: Minor
Found in frontend/dcmgr_gui/app/models/vdc_manage.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

Method umount_root_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def umount_root_image(ctx, mount_path)
        case ctx.inst[:image][:file_format]
        when "raw"
          # umount vm image directory
          raise "root mount point does not exist #{mount_path}" unless File.directory?(mount_path)
Severity: Minor
Found in dcmgr/lib/dcmgr/drivers/hypervisor/linux_hypervisor/linux_container.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

Method credentials! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def credentials!
        unless provided?
          auth = Rack::Auth::Basic::Request.new(@app.request.env)
          unless auth.provided? && auth.basic? && auth.credentials
            @app.authorize!
Severity: Minor
Found in dcmgr/lib/sinatra/lazy_auth.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

Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    catch_error do
      backup_object_ids = params[:ids]
      display_name = params[:display_name]
      if backup_object_ids
Severity: Minor
Found in frontend/dcmgr_gui/app/controllers/volumes_controller.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

Method modify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def modify(model,uuid,fields)
      UnknownModelError.raise(model) unless model < Sequel::Model
      raise ArgumentError unless fields.is_a? Hash
      to_modify = model[uuid] || UnknownUUIDError.raise(uuid)

Severity: Minor
Found in frontend/dcmgr_gui/lib/cli/base.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

Method build_qemu_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def build_qemu_options(hc, monitor_tcp_port, opts={})
        inst = hc.inst
        cmd = ["-m %d",
               "-smp %d",
               "-name vdc-%s",
Severity: Minor
Found in dcmgr/lib/dcmgr/drivers/hypervisor/linux_hypervisor/kvm.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

Method cgroup_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def cgroup_set(subsys, scope, &blk)
        if driver_configuration.cgroup_blkio.enable_throttling == false
          return
        end
        cgroup_mnt = `findmnt -n -t cgroup -O "#{subsys}"`.split("\n").first
Severity: Minor
Found in dcmgr/lib/dcmgr/drivers/hypervisor/linux_hypervisor.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

Method terminate_instance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def terminate_instance(hc)
        poweroff_instance(hc)

        # delete container folder
        sh("vzctl destroy %s",[hc.inst_id])

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 attach_volume_to_host has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def attach_volume_to_host(ctx, volume_id)
        vol = ctx.inst[:volume][volume_id]
        raise "Unknown volume_id is specified: #{volume_id}" if vol.nil?

        if vol[:volume_type] == 'Dcmgr::Models::IscsiVolume'
Severity: Minor
Found in dcmgr/lib/dcmgr/drivers/hypervisor/linux_hypervisor.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

Method delete_alarm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def delete_alarm(uuid)
      raise ArgumentError unless uuid.is_a?(String)
      if get_hash(uuid)
        get_timer(uuid).cancel unless @timer.nil?
        delete_hash(uuid)
Severity: Minor
Found in metric_libs/lib/metric_libs/alarm_manager.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

Severity
Category
Status
Source
Language