axsh/wakame-vdc

View on GitHub

Showing 893 of 1,587 total issues

Function initDrag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  initDrag: function(event) {
    if(!Object.isUndefined(Draggable._dragging[this.element]) &&
      Draggable._dragging[this.element]) return;
    if(Event.isLeftClick(event)) {
      // abort on form elements, fixes a Firefox issue
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dragdrop.js - 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 get_service_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_service_address(network_address, service_ipv4 = nil)
    return network_address.first.to_s if service_ipv4.nil? || service_ipv4.empty?

    service_address = IPAddress::IPv4.new(service_ipv4)
    raise E::NetworkVifInvalidAddress if service_address.nil? || service_address.octets[3] == 0
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/networks.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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def generate()
      @object.instance_exec {
        { :id => self.canonical_uuid,
          :network => self.ip_lease.network ? self.ip_lease.network.canonical_uuid : nil,
          :network_vif => self.ip_lease.network_vif ? self.ip_lease.network_vif.canonical_uuid : nil,
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/responses/ip_pool.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 accept_secure_port has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def accept_secure_port
      inbounds.each {|_in|
        if SECURE_PROTOCOLS.include?(_in[:protocol])
          return _in[:port] == 4433 ? 443 : 4433
        end
Severity: Minor
Found in dcmgr/lib/dcmgr/models/load_balancer.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 backup_single_volume has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def backup_single_volume()
        new_object_key = nil
        raise "Missing volume hash object" if @sta_ctx.volume.nil?
        
        rpc.request('sta-collector', 'update_backup_object', @backup_object_id, {:state=>:creating})
Severity: Minor
Found in dcmgr/lib/dcmgr/rpc/sta_handler.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 set_label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def set_label(name, value, value_type=nil)
          l = label(name)
          if value_type
            # TODO: more validations for value_type.
            if l
Severity: Minor
Found in dcmgr/lib/dcmgr/models/base_new.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(app, run_once, run_every=nil)
        raise ArgumentError unless run_once.nil? || run_once.is_a?(Proc)
        raise ArgumentError unless run_every.nil? || run_every.is_a?(Proc)
        @app = app
        @run_once_block = run_once
Severity: Minor
Found in dcmgr/lib/dcmgr/rack/run_initializer.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

Function add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  add: function(element) {
    element = $(element);
    var options = Object.extend({
      greedy:     true,
      hoverclass: null,
Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dragdrop.js - 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 get_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_data(params)
        v = parse_version params[:version]

        get_method = params[:data].gsub(/-/,'_')

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

Function mark has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  mark: function(dropon, position) {
    // mark on ghosting only
    var sortable = Sortable.options(dropon.parentNode);
    if(sortable && !sortable.ghosting) return;

Severity: Minor
Found in frontend/dcmgr_gui/public/javascripts/dragdrop.js - 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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def generate()
      @volume.instance_exec {
        h = to_hash.merge(:id=>canonical_uuid,
                          :store_type=>(self.local_volume? ? 'local' : 'shared'),
                          :instance_id=>(self.instance.nil? ? nil : self.instance.canonical_uuid),
Severity: Minor
Found in dcmgr/lib/dcmgr/endpoints/12.03/responses/volume.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 schedule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def schedule(instance)
          Dcmgr::Scheduler::Network.check_vifs_parameter_format(instance.request_params["vifs"])
          instance.request_params["vifs"].each { |name, vif|
            vnic = instance.add_nic(vif)
            next if options.template[name].nil?
Severity: Minor
Found in dcmgr/lib/dcmgr/scheduler/network/vif_template.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 before_destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def before_destroy
      # Destroy IP leases if they are not owned by a network vif.
      [:inner, :outer].each { |arg|
        current_lease = self.send("#{arg}_lease")

Severity: Minor
Found in dcmgr/lib/dcmgr/models/network_route.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 to_hash_flat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def to_hash_flat
      hash = {
        :network_vif_uuid => self.canonical_uuid,
        :network_id => self.network_id,
        :address => self.direct_ip_lease.first.nil? ? nil : self.direct_ip_lease.first.ipv4,
Severity: Minor
Found in dcmgr/lib/dcmgr/models/network_vif.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 entry_new has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.entry_new(account, image, params, &blk)
      raise ArgumentError, "The account parameter must be an Account. Got '#{account.class}'" unless account.is_a?(Account)
      raise ArgumentError, "The image parameter must be an Image. Got '#{image.class}'" unless image.is_a?(Image)
      # Mash is passed in some cases.
      raise ArgumentError, "The params parameter must be a Hash. Got '#{params.class}'" unless params.class == ::Hash
Severity: Minor
Found in dcmgr/lib/dcmgr/models/instance.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 schedule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def schedule(volume)
        if volume.snapshot_id
          # use same same storage node if it is local snapshot.
          if volume.snapshot.destination == 'local'
            volume.storage_node = Models::StorageNode[volume.snapshot.storage_node_id]
Severity: Minor
Found in dcmgr/lib/dcmgr/scheduler.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
      super
      self.recipients.each { |i|
        if i.has_key?(:mail_address)
          unless i[:mail_address] =~ /^[^@]+@[a-z0-9][a-z0-9\.\-]+$/i
Severity: Minor
Found in dcmgr/lib/dcmgr/models/instance_monitor_attr.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 shell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def shell
        if respond_to?(:task_session) && self.task_session && self.task_session[:shell_runner_class].is_a?(Class)
          unless self.task_session[:shell_runner_class] < ShellRunner
            raise TypeError, "Invalid ShellRunner class is set: #{self.task_session[:shell_runner_class]}"
          end
Severity: Minor
Found in dcmgr/lib/dcmgr/helpers/cli_helper.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 error_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def error_code
            return 0 unless error?
            (self.code != 200 ? code : json_body['error']['code'].to_i) rescue 0
          end
Severity: Minor
Found in dcmgr/lib/dcmgr/helpers/zabbix_json_rpc.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 unmap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def unmap(uuid, object_uuid)
      #Quick hack to get all models in Dcmgr::Models loaded in Taggable.uuid_prefix_collection
      #This is so the Taggable.find method can be used to determine the Model class based on canonical uuid
      M.constants(false).each {|c| M.const_get(c, false) }

Severity: Minor
Found in dcmgr/lib/dcmgr/cli/resource_group.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