fog/fog-profitbricks

View on GitHub

Showing 41 of 140 total issues

Method update_group has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def update_group(group_id, options = {})
          if group = data[:groups]['items'].find do |grp|
            grp["id"] == group_id
          end
            group['name']               = options[:name]
Severity: Minor
Found in lib/fog/profitbricks/requests/compute/update_group.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 update_datacenter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def update_datacenter(datacenter_id, options = {})
          if dc = data[:datacenters]["items"].find do |datacenter|
            datacenter["id"] == datacenter_id
          end

Severity: Minor
Found in lib/fog/profitbricks/requests/compute/update_datacenter.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 create_nic has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def create_nic(datacenter_id, server_id, options = {}, entities = {})
          if options[:lan] == nil
            raise Excon::Error::HTTPStatus, "Attribute 'lan' is required"
          end

Severity: Minor
Found in lib/fog/profitbricks/requests/compute/create_nic.rb - About 1 hr to fix

    Method save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def save
              requires :datacenter_id, :server_id, :nic_id, :protocol
    
              properties = {}
              properties[:name]           = name if name
    Severity: Minor
    Found in lib/fog/profitbricks/models/compute/firewall_rule.rb - About 55 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 save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def save
              requires :name, :location
    
              options = {}
              options[:name] = name
    Severity: Minor
    Found in lib/fog/profitbricks/models/compute/datacenter.rb - About 55 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 save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def save
              requires :datacenter_id, :name, :cores, :ram
    
              properties = {}
              properties[:name]             = name if name
    Severity: Minor
    Found in lib/fog/profitbricks/models/compute/server.rb - About 55 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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def update
              requires :datacenter_id, :server_id, :nic_id, :id
    
              properties = {}
              properties[:name]           = name if name
    Severity: Minor
    Found in lib/fog/profitbricks/models/compute/firewall_rule.rb - About 45 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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def save
              requires :datacenter_id, :size, :type
    
              options = {}
              options[:name]              = name if name
    Severity: Minor
    Found in lib/fog/profitbricks/models/compute/volume.rb - About 45 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 attach_volume has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def attach_volume(datacenter_id, server_id, storage_id)
              if volume = data[:volumes]['items'].find do |vlm|
                vlm["id"] == storage_id && vlm["datacenter_id"] == datacenter_id
              end
              else
    Severity: Minor
    Found in lib/fog/profitbricks/requests/compute/attach_volume.rb - About 45 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 attach_cdrom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def attach_cdrom(datacenter_id, server_id, cdrom_image_id)
              if cdrom = data[:images]['items'].find do |cd|
                cd["id"] == cdrom_image_id
              end
              else
    Severity: Minor
    Found in lib/fog/profitbricks/requests/compute/attach_cdrom.rb - About 45 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 update_firewall_rule has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def update_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id, options = {})
    Severity: Minor
    Found in lib/fog/profitbricks/requests/compute/update_firewall_rule.rb - About 35 mins to fix

      Method update_firewall_rule has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def update_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id, options = {})
      Severity: Minor
      Found in lib/fog/profitbricks/requests/compute/update_firewall_rule.rb - About 35 mins to fix

        Method collect_entities has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def collect_entities(entities)
                  if entities.is_a?(Array) && entities.length > 0
                    items = []
                    entities.each do |entity|
                      if entity.key?(:volumes)
        Severity: Minor
        Found in lib/fog/profitbricks/models/compute/datacenter.rb - About 35 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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def save
                  requires :datacenter_id, :server_id, :lan
        
                  properties = {}
                  properties[:name]           = name if name
        Severity: Minor
        Found in lib/fog/profitbricks/models/compute/nic.rb - About 35 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_attached_volume has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def get_attached_volume(datacenter_id, server_id, volume_id)
                  if server = data[:servers]['items'].find do |serv|
                    serv['datacenter_id'] == datacenter_id && serv['id'] == server_id
                  end
                  else
        Severity: Minor
        Found in lib/fog/profitbricks/requests/compute/get_attached_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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def update
                  requires :datacenter_id, :id
        
                  properties = {}
                  properties[:name]             = name if name
        Severity: Minor
        Found in lib/fog/profitbricks/models/compute/server.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_server has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def create_server(datacenter_id, properties = {}, entities = {})
                  if properties[:cores] == nil
                    raise Excon::Error::HTTPStatus, "Attribute 'cores' is required"
                  end
        
        
        Severity: Minor
        Found in lib/fog/profitbricks/requests/compute/create_server.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 update_share has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def update_share(group_id, resource_id, options = {})
                  if share = data[:shares]['items'].find do |shr|
                    shr["id"] == resource_id
                  end
                    share['editPrivilege']   = options[:editPrivilege] if [true, false].include?(options[:editPrivilege])
        Severity: Minor
        Found in lib/fog/profitbricks/requests/compute/update_share.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_lan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def create_lan(datacenter_id, properties = {}, _entities = {})
                  response = Excon::Response.new
                  response.status = 202
        
                  if datacenter = data[:datacenters]['items'].find do |attrib|
        Severity: Minor
        Found in lib/fog/profitbricks/requests/compute/create_lan.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 associate_nic_to_load_balancer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def associate_nic_to_load_balancer(datacenter_id, load_balancer_id, nic_id)
                  if load_balancer = data[:load_balancers]['items'].find do |lb|
                    lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
                  end
                  else
        Severity: Minor
        Found in lib/fog/profitbricks/requests/compute/associate_nic_to_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

        Severity
        Category
        Status
        Source
        Language