fog/fog-profitbricks

View on GitHub

Showing 99 of 140 total issues

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

  module Compute
    class ProfitBricks
      class Real
        # Delete a single group.
        # Resources that are assigned to the group are NOT deleted, but are no longer accessible
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_group.rb and 5 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_datacenter.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_image.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_ip_block.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_snapshot.rb on lines 2..35
lib/fog/profitbricks/requests/compute/delete_user.rb on lines 2..38

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 47.

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 6 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Delete virtual data center
        #
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_datacenter.rb and 5 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_group.rb on lines 2..38
lib/fog/profitbricks/requests/compute/delete_image.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_ip_block.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_snapshot.rb on lines 2..35
lib/fog/profitbricks/requests/compute/delete_user.rb on lines 2..38

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 47.

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 6 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Blacklists the user, disabling them.
        # The user is not completely purged, therefore if you anticipate needing to create
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_user.rb and 5 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_datacenter.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_group.rb on lines 2..38
lib/fog/profitbricks/requests/compute/delete_image.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_ip_block.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_snapshot.rb on lines 2..35

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 47.

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 6 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Deletes the specified IP Block
        #
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_ip_block.rb and 5 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_datacenter.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_group.rb on lines 2..38
lib/fog/profitbricks/requests/compute/delete_image.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_snapshot.rb on lines 2..35
lib/fog/profitbricks/requests/compute/delete_user.rb on lines 2..38

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 47.

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 6 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Delete virtual data center
        #
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_snapshot.rb and 5 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_datacenter.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_group.rb on lines 2..38
lib/fog/profitbricks/requests/compute/delete_image.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_ip_block.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_user.rb on lines 2..38

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 47.

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 6 locations. Consider refactoring.
Open

  module Compute
    class ProfitBricks
      class Real
        # Delete an existing image
        #
Severity: Major
Found in lib/fog/profitbricks/requests/compute/delete_image.rb and 5 other locations - About 1 hr to fix
lib/fog/profitbricks/requests/compute/delete_datacenter.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_group.rb on lines 2..38
lib/fog/profitbricks/requests/compute/delete_ip_block.rb on lines 2..36
lib/fog/profitbricks/requests/compute/delete_snapshot.rb on lines 2..35
lib/fog/profitbricks/requests/compute/delete_user.rb on lines 2..38

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 47.

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 Fog
  module Compute
    class ProfitBricks
      class Groups < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
Severity: Minor
Found in lib/fog/profitbricks/models/compute/groups.rb and 1 other location - About 50 mins to fix
lib/fog/profitbricks/models/compute/datacenters.rb on lines 4..22

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 43.

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 Fog
  module Compute
    class ProfitBricks
      class Datacenters < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
Severity: Minor
Found in lib/fog/profitbricks/models/compute/datacenters.rb and 1 other location - About 50 mins to fix
lib/fog/profitbricks/models/compute/groups.rb on lines 4..21

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 43.

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

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

          if server['entities']
            volume = server['entities']['volumes']['items'].find do |vlm|
              vlm['id'] == volume_id
            end
          elsif server['volumes']
Severity: Minor
Found in lib/fog/profitbricks/requests/compute/detach_volume.rb and 1 other location - About 50 mins to fix
lib/fog/profitbricks/requests/compute/get_attached_volume.rb on lines 64..74

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 43.

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

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

          if server['entities']
            volume = server['entities']['volumes']['items'].find do |vlm|
              vlm['id'] == volume_id
            end
          elsif server['volumes']
Severity: Minor
Found in lib/fog/profitbricks/requests/compute/get_attached_volume.rb and 1 other location - About 50 mins to fix
lib/fog/profitbricks/requests/compute/detach_volume.rb on lines 39..49

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 43.

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

module Fog
  module Compute
    class ProfitBricks
      class IpBlocks < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
Severity: Major
Found in lib/fog/profitbricks/models/compute/ip_blocks.rb and 3 other locations - About 45 mins to fix
lib/fog/profitbricks/models/compute/images.rb on lines 4..20
lib/fog/profitbricks/models/compute/locations.rb on lines 4..20
lib/fog/profitbricks/models/compute/snapshots.rb on lines 4..20

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 41.

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

module Fog
  module Compute
    class ProfitBricks
      class Images < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
Severity: Major
Found in lib/fog/profitbricks/models/compute/images.rb and 3 other locations - About 45 mins to fix
lib/fog/profitbricks/models/compute/ip_blocks.rb on lines 4..20
lib/fog/profitbricks/models/compute/locations.rb on lines 4..20
lib/fog/profitbricks/models/compute/snapshots.rb on lines 4..20

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 41.

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

module Fog
  module Compute
    class ProfitBricks
      class Snapshots < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
Severity: Major
Found in lib/fog/profitbricks/models/compute/snapshots.rb and 3 other locations - About 45 mins to fix
lib/fog/profitbricks/models/compute/images.rb on lines 4..20
lib/fog/profitbricks/models/compute/ip_blocks.rb on lines 4..20
lib/fog/profitbricks/models/compute/locations.rb on lines 4..20

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 41.

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

module Fog
  module Compute
    class ProfitBricks
      class Locations < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
Severity: Major
Found in lib/fog/profitbricks/models/compute/locations.rb and 3 other locations - About 45 mins to fix
lib/fog/profitbricks/models/compute/images.rb on lines 4..20
lib/fog/profitbricks/models/compute/ip_blocks.rb on lines 4..20
lib/fog/profitbricks/models/compute/snapshots.rb on lines 4..20

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 41.

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

          if firewall_rule = data[:firewall_rules]["items"].find do |attribute|
            attribute["datacenter_id"] == datacenter_id && attribute["server_id"] == server_id && attribute["nic_id"] == nic_id && attribute["id"] == firewall_rule_id
          end
          else
            raise Fog::Errors::NotFound, "The requested firewall rule resource could not be found"
Severity: Minor
Found in lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb and 1 other location - About 40 mins to fix
lib/fog/profitbricks/requests/compute/get_firewall_rule.rb on lines 53..57

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 38.

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' => ipb1_id,
                    'type' => 'ipblock',
                    'href' => "https://api.profitbricks.com/cloudapi/v4/um/resources/ipblock/#{ipb1_id}",
                    'metadata' => {
Severity: Minor
Found in lib/fog/profitbricks/compute.rb and 1 other location - About 40 mins to fix
lib/fog/profitbricks/compute.rb on lines 1176..1193

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 38.

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'        => dc1_id,
                    'type'      => 'datacenter',
                    'href'      => "https://api.profitbricks.com/cloudapi/v4/um/resources/datacenter/#{dc1_id}",
                    'metadata'  => {
Severity: Minor
Found in lib/fog/profitbricks/compute.rb and 1 other location - About 40 mins to fix
lib/fog/profitbricks/compute.rb on lines 1239..1256

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 38.

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

          if firewall_rule = data[:firewall_rules]['items'].find do |fwr|
            fwr["datacenter_id"] == datacenter_id && fwr["server_id"] == server_id && fwr["nic_id"] == nic_id && fwr["id"] == firewall_rule_id
          end
          else
            raise Excon::Error::HTTPStatus, "Resource does not exist"
Severity: Minor
Found in lib/fog/profitbricks/requests/compute/get_firewall_rule.rb and 1 other location - About 40 mins to fix
lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb on lines 32..36

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 38.

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

      class Mock
        def reboot_server(datacenter_id, server_id)
          if server = data[:servers]['items'].find do |attrib|
            attrib['datacenter_id'] == datacenter_id && attrib['id'] == server_id
          end
Severity: Minor
Found in lib/fog/profitbricks/requests/compute/reboot_server.rb and 1 other location - About 40 mins to fix
lib/fog/profitbricks/requests/compute/remove_nic_association.rb on lines 26..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 37.

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'        => dc1_id,
                    'type'      => 'datacenter',
                    'href'      => "https://api.profitbricks.com/rest/v2/datacenters/#{dc1_id}",
                    'metadata'  => {
Severity: Minor
Found in lib/fog/profitbricks/compute.rb and 1 other location - About 40 mins to fix
lib/fog/profitbricks/compute.rb on lines 267..284

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 37.

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

Severity
Category
Status
Source
Language