fog/fog-profitbricks

View on GitHub

Showing 140 of 140 total issues

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

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

    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_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
            # 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 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
            # 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_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

    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 :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 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

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

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

    Severity
    Category
    Status
    Source
    Language