fog/fog-exoscale

View on GitHub

Showing 32 of 32 total issues

Method data has 231 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.data
          @data ||= begin
            zone_id     = Fog.credentials[:exoscale_zone_id]             || Fog::Exoscale.uuid
            image_id    = Fog.credentials[:exoscale_template_id]         || Fog::Exoscale.uuid
            flavor_id   = Fog.credentials[:exoscale_service_offering_id] || Fog::Exoscale.uuid
Severity: Major
Found in lib/fog/exoscale/compute.rb - About 1 day to fix

    File compute.rb has 396 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "fog/exoscale/core"
    require "digest/md5"
    
    module Fog
      module Compute
    Severity: Minor
    Found in lib/fog/exoscale/compute.rb - About 5 hrs to fix

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

        module Compute
          class Exoscale
      
            class Real
              # Authorizes a particular egress rule for this security group
      lib/fog/exoscale/requests/compute/authorize_security_group_ingress.rb on lines 2..71

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

      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 Exoscale
      
            class Real
              # Authorizes a particular ingress rule for this security group
      lib/fog/exoscale/requests/compute/authorize_security_group_egress.rb on lines 2..71

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

      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 Exoscale
      
            class Real
              # Deletes a particular ingress rule from this security group
      lib/fog/exoscale/requests/compute/revoke_security_group_egress.rb on lines 2..46

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

      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 Exoscale
      
            class Real
              # Deletes a particular egress rule from this security group
      lib/fog/exoscale/requests/compute/revoke_security_group_ingress.rb on lines 2..46

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

      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 deploy_virtual_machine has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def deploy_virtual_machine(options={})
                zone_id = options['zoneid']
                unless zone_id
                  raise Fog::Compute::Exoscale::BadRequest.new('Unable to execute API command deployvirtualmachine due to missing parameter zoneid')
                end
      Severity: Major
      Found in lib/fog/exoscale/requests/compute/deploy_virtual_machine.rb - About 3 hrs to fix

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

          module Compute
            class Exoscale
        
              class Real
                # Lists all available service offerings.
        Severity: Major
        Found in lib/fog/exoscale/requests/compute/list_service_offerings.rb and 1 other location - About 1 hr to fix
        lib/fog/exoscale/requests/compute/list_security_groups.rb on lines 2..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 74.

        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 Exoscale
        
              class Real
                # Lists security groups
        Severity: Major
        Found in lib/fog/exoscale/requests/compute/list_security_groups.rb and 1 other location - About 1 hr to fix
        lib/fog/exoscale/requests/compute/list_service_offerings.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 74.

        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 authorize_security_group_egress has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def authorize_security_group_egress(options={})
                  security_group_id      = options['securitygroupid']
                  security_group_rule_id = Fog::Exoscale.uuid
        
                  unless cidr = options['cidrlist']

          Method authorize_security_group_ingress has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def authorize_security_group_ingress(options={})
                    security_group_id      = options['securitygroupid']
                    security_group_rule_id = Fog::Exoscale.uuid
          
                    unless cidr = options['cidrlist']

            Method deploy_virtual_machine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    def deploy_virtual_machine(options={})
                      zone_id = options['zoneid']
                      unless zone_id
                        raise Fog::Compute::Exoscale::BadRequest.new('Unable to execute API command deployvirtualmachine due to missing parameter zoneid')
                      end
            Severity: Minor
            Found in lib/fog/exoscale/requests/compute/deploy_virtual_machine.rb - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method authorize_security_group_egress has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def authorize_security_group_egress(options={})
                      security_group_id      = options['securitygroupid']
                      security_group_rule_id = Fog::Exoscale.uuid
            
                      unless cidr = options['cidrlist']

            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 authorize_security_group_ingress has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def authorize_security_group_ingress(options={})
                      security_group_id      = options['securitygroupid']
                      security_group_rule_id = Fog::Exoscale.uuid
            
                      unless cidr = options['cidrlist']

            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

                  class Real
                    # Creates resource tag(s)
                    #
                    # {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/createTags.html]
                    def create_tags(*args)
            Severity: Minor
            Found in lib/fog/exoscale/requests/compute/create_tags.rb and 1 other location - About 45 mins to fix
            lib/fog/exoscale/requests/compute/deploy_virtual_machine.rb on lines 5..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 40.

            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 Real
                    # Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.
                    #
                    # {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/deployVirtualMachine.html]
                    def deploy_virtual_machine(*args)
            Severity: Minor
            Found in lib/fog/exoscale/requests/compute/deploy_virtual_machine.rb and 1 other location - About 45 mins to fix
            lib/fog/exoscale/requests/compute/create_tags.rb on lines 5..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 40.

            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 Exoscale
            
                  class Real
                    # Register a public key in a keypair under a certain name
            Severity: Major
            Found in lib/fog/exoscale/requests/compute/register_ssh_key_pair.rb and 2 other locations - About 40 mins to fix
            lib/fog/exoscale/requests/compute/change_service_for_virtual_machine.rb on lines 2..19
            lib/fog/exoscale/requests/compute/delete_tags.rb on lines 2..19

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

              module Compute
                class Exoscale
            
                  class Real
                    # Deleting resource tag(s)
            Severity: Major
            Found in lib/fog/exoscale/requests/compute/delete_tags.rb and 2 other locations - About 40 mins to fix
            lib/fog/exoscale/requests/compute/change_service_for_virtual_machine.rb on lines 2..19
            lib/fog/exoscale/requests/compute/register_ssh_key_pair.rb on lines 2..19

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

              module Compute
                class Exoscale
            
                  class Real
                    # Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.
            lib/fog/exoscale/requests/compute/delete_tags.rb on lines 2..19
            lib/fog/exoscale/requests/compute/register_ssh_key_pair.rb on lines 2..19

            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

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

                    def get(server_id)
                      servers = service.list_virtual_machines('id' => server_id)["listvirtualmachinesresponse"]["virtualmachine"]
                      if servers.nil? || servers.empty?
                        servers = service.list_virtual_machines('id' => server_id, 'projectid' => '-1')["listvirtualmachinesresponse"]["virtualmachine"]
                      end
            Severity: Minor
            Found in lib/fog/exoscale/models/compute/servers.rb - About 35 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language