fog/fog-profitbricks

View on GitHub

Showing 140 of 140 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                  {
                    'id'    => fwr2_id,
                    'type'  => 'firewall-rule',
                    'href'  => "https://api.profitbricks.com/rest/v2/datacenters/#{dc1_id}/servers/#{serv1_id}/nics/#{nic1_id}/firewallrules/#{fwr2_id}",
                    'metadata' => {
Severity: Major
Found in lib/fog/profitbricks/compute.rb and 1 other location - About 1 hr to fix
lib/fog/profitbricks/compute.rb on lines 979..1004

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                  {
                    'id'    => fwr1_id,
                    'type'  => 'firewall-rule',
                    'href'  => "https://api.profitbricks.com/rest/v2/datacenters/#{dc1_id}/servers/#{serv1_id}/nics/#{nic1_id}/firewallrules/#{fwr1_id}",
                    'metadata' => {
Severity: Major
Found in lib/fog/profitbricks/compute.rb and 1 other location - About 1 hr to fix
lib/fog/profitbricks/compute.rb on lines 1006..1031

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                  {
                    'id'              => '05cadf29-6c12-11e4-beeb-52540066fee9',
                    'type'            => 'image',
                    'href'            => 'https=>//api.profitbricks.com/rest/v2/images/05cadf29-6c12-11e4-beeb-52540066fee9',
                    'metadata'        => {
Severity: Major
Found in lib/fog/profitbricks/compute.rb and 3 other locations - About 1 hr to fix
lib/fog/profitbricks/compute.rb on lines 508..537
lib/fog/profitbricks/compute.rb on lines 540..569
lib/fog/profitbricks/requests/compute/create_server.rb on lines 224..253

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                  {
                    'id'              => 'dfcb40db-28b5-11e6-9336-52540005ab80',
                    'type'            => 'image',
                    'href'            => 'https=>//api.profitbricks.com/rest/v2/images/dfcb40db-28b5-11e6-9336-52540005ab80',
                    'metadata'        => {
Severity: Major
Found in lib/fog/profitbricks/compute.rb and 3 other locations - About 1 hr to fix
lib/fog/profitbricks/compute.rb on lines 508..537
lib/fog/profitbricks/compute.rb on lines 572..601
lib/fog/profitbricks/requests/compute/create_server.rb on lines 224..253

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                {
                  'id'        => 'dfcb40db-28b5-11e6-9336-52540005ab80',
                  'type'      => 'image',
                  'href'      => 'https=>//api.profitbricks.com/rest/v2/images/dfcb40db-28b5-11e6-9336-52540005ab80',
                  'metadata'  => {
Severity: Major
Found in lib/fog/profitbricks/requests/compute/create_server.rb and 3 other locations - About 1 hr to fix
lib/fog/profitbricks/compute.rb on lines 508..537
lib/fog/profitbricks/compute.rb on lines 540..569
lib/fog/profitbricks/compute.rb on lines 572..601

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                  {
                    'id'              => 'dfcb40db-28b5-11e6-9336-52540005ab80',
                    'type'            => 'image',
                    'href'            => 'https=>//api.profitbricks.com/rest/v2/images/dfcb40db-28b5-11e6-9336-52540005ab80',
                    'metadata'        => {
Severity: Major
Found in lib/fog/profitbricks/compute.rb and 3 other locations - About 1 hr to fix
lib/fog/profitbricks/compute.rb on lines 540..569
lib/fog/profitbricks/compute.rb on lines 572..601
lib/fog/profitbricks/requests/compute/create_server.rb on lines 224..253

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Deletes the specified volume
        #
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_volume.rb and 2 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_lan.rb on lines 2..37
lib/fog/profitbricks/requests/compute/delete_load_balancer.rb on lines 2..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Deletes the specified load balancer
        #
lib/fog/profitbricks/requests/compute/delete_lan.rb on lines 2..37
lib/fog/profitbricks/requests/compute/delete_volume.rb on lines 2..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Delete the specified LAN
        #
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_lan.rb and 2 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_load_balancer.rb on lines 2..37
lib/fog/profitbricks/requests/compute/delete_volume.rb on lines 2..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Get all servers within a datacenter
        #
Severity: Major
Found in lib/fog/profitbricks/requests/compute/get_all_servers.rb and 1 other location - About 1 hr to fix
lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb on lines 2..112

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Retrieve a list of load balancers within the data center
        #
lib/fog/profitbricks/requests/compute/get_all_servers.rb on lines 2..128

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method create_firewall_rule has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def create_firewall_rule(datacenter_id, server_id, nic_id, options = {})
          response = Excon::Response.new
          response.status = 202

          properties = {}
Severity: Minor
Found in lib/fog/profitbricks/requests/compute/create_firewall_rule.rb - About 1 hr to fix

    Method attach_cdrom has 28 lines of code (exceeds 25 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 1 hr to fix

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        module Compute
          class ProfitBricks
            class Real
              # Get a virtual data center by id
              #
      Severity: Major
      Found in lib/fog/profitbricks/requests/compute/get_datacenter.rb and 4 other locations - About 1 hr to fix
      lib/fog/profitbricks/requests/compute/get_image.rb on lines 2..64
      lib/fog/profitbricks/requests/compute/get_ip_block.rb on lines 2..51
      lib/fog/profitbricks/requests/compute/get_location.rb on lines 2..42
      lib/fog/profitbricks/requests/compute/get_user.rb on lines 2..67

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        module Compute
          class ProfitBricks
            class Real
              # Retrieves the attributes of a specific IP Block
              #
      Severity: Major
      Found in lib/fog/profitbricks/requests/compute/get_ip_block.rb and 4 other locations - About 1 hr to fix
      lib/fog/profitbricks/requests/compute/get_datacenter.rb on lines 2..58
      lib/fog/profitbricks/requests/compute/get_image.rb on lines 2..64
      lib/fog/profitbricks/requests/compute/get_location.rb on lines 2..42
      lib/fog/profitbricks/requests/compute/get_user.rb on lines 2..67

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        module Compute
          class ProfitBricks
            class Real
              # Retrieves the attributes of a specific image
              #
      Severity: Major
      Found in lib/fog/profitbricks/requests/compute/get_image.rb and 4 other locations - About 1 hr to fix
      lib/fog/profitbricks/requests/compute/get_datacenter.rb on lines 2..58
      lib/fog/profitbricks/requests/compute/get_ip_block.rb on lines 2..51
      lib/fog/profitbricks/requests/compute/get_location.rb on lines 2..42
      lib/fog/profitbricks/requests/compute/get_user.rb on lines 2..67

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        module Compute
          class ProfitBricks
            class Real
              # Get all locations
              #
      Severity: Major
      Found in lib/fog/profitbricks/requests/compute/get_location.rb and 4 other locations - About 1 hr to fix
      lib/fog/profitbricks/requests/compute/get_datacenter.rb on lines 2..58
      lib/fog/profitbricks/requests/compute/get_image.rb on lines 2..64
      lib/fog/profitbricks/requests/compute/get_ip_block.rb on lines 2..51
      lib/fog/profitbricks/requests/compute/get_user.rb on lines 2..67

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        module Compute
          class ProfitBricks
            class Real
              # Retrieve details about a specific user including what groups and resources the user is associated with.
              #
      Severity: Major
      Found in lib/fog/profitbricks/requests/compute/get_user.rb and 4 other locations - About 1 hr to fix
      lib/fog/profitbricks/requests/compute/get_datacenter.rb on lines 2..58
      lib/fog/profitbricks/requests/compute/get_image.rb on lines 2..64
      lib/fog/profitbricks/requests/compute/get_ip_block.rb on lines 2..51
      lib/fog/profitbricks/requests/compute/get_location.rb on lines 2..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        module Compute
          class ProfitBricks
            class Real
              # Retrieves the attributes of a specific snapshot
              #
      Severity: Major
      Found in lib/fog/profitbricks/requests/compute/get_snapshot.rb and 1 other location - About 1 hr to fix
      lib/fog/profitbricks/requests/compute/get_group.rb on lines 2..59

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 50.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

      Severity
      Category
      Status
      Source
      Language