fog/fog-openstack

View on GitHub

Showing 616 of 616 total issues

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

module Fog
  module OpenStack
    class Compute < Fog::Service
      SUPPORTED_VERSIONS = /v2\.0|v2\.1/
      SUPPORTED_MICROVERSION = '2.15'.freeze
Severity: Minor
Found in lib/fog/openstack/compute.rb - About 3 hrs to fix

    File server.rb has 323 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'fog/compute/models/server'
    require 'fog/openstack/compute/models/metadata'
    
    module Fog
      module OpenStack
    Severity: Minor
    Found in lib/fog/openstack/compute/models/server.rb - About 3 hrs to fix

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

        module OpenStack
          class Network
            class Real
              def update_lbaas_listener(listener_id, options = {})
      
      
      Severity: Major
      Found in lib/fog/openstack/network/requests/update_lbaas_listener.rb and 1 other location - About 3 hrs to fix
      lib/fog/openstack/network/requests/update_lb_vip.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 126.

      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 OpenStack
          class Network
            class Real
              def create_ike_policy(options = {})
                data = {
      Severity: Major
      Found in lib/fog/openstack/network/requests/create_ike_policy.rb and 1 other location - About 3 hrs to fix
      lib/fog/openstack/network/requests/create_ipsec_policy.rb on lines 2..47

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

      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 OpenStack
          class Network
            class Real
              def create_ipsec_policy(options = {})
                data = {
      Severity: Major
      Found in lib/fog/openstack/network/requests/create_ipsec_policy.rb and 1 other location - About 3 hrs to fix
      lib/fog/openstack/network/requests/create_ike_policy.rb on lines 2..47

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

      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 OpenStack
          class Network
            class Real
              def update_lb_vip(vip_id, options = {})
                data = {'vip' => {}}
      Severity: Major
      Found in lib/fog/openstack/network/requests/update_lb_vip.rb and 1 other location - About 3 hrs to fix
      lib/fog/openstack/network/requests/update_lbaas_listener.rb on lines 2..39

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

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

              def self.data
                @data ||= Hash.new do |hash, key|
                  hash[key] = {
                    :last_modified             => {
                      :images          => {},
      Severity: Major
      Found in lib/fog/openstack/compute.rb - About 3 hrs to fix

        Method list_metrics has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def list_metrics(_options = {})
                  response = Excon::Response.new
                  response.status = 200
                  response.body = [
                      {
        Severity: Major
        Found in lib/fog/openstack/metric/requests/list_metrics.rb - About 3 hrs to fix

          Method setup has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def setup(options)
                  if options.respond_to?(:config_service?) && options.config_service?
                    configure(options)
                    return
                  end
          Severity: Minor
          Found in lib/fog/openstack/core.rb - About 3 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

          Method create_server has 79 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def create_server(name, image_ref, flavor_ref, options = {})
                    response = Excon::Response.new
                    response.status = 202
          
                    server_id = Fog::Mock.random_numbers(6).to_s
          Severity: Major
          Found in lib/fog/openstack/compute/requests/create_server.rb - About 3 hrs to fix

            File v2.rb has 294 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'fog/openstack/dns'
            
            module Fog
              module OpenStack
                class DNS
            Severity: Minor
            Found in lib/fog/openstack/dns/v2.rb - About 3 hrs to fix

              Method create_server has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def create_server(name, image_ref, flavor_ref, options = {})
                        data = {
                          'server' => {
                            'flavorRef' => flavor_ref,
                            'name'      => name
              Severity: Major
              Found in lib/fog/openstack/compute/requests/create_server.rb - About 2 hrs to fix

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

                  module OpenStack
                    class Network
                      class Real
                        def update_lbaas_loadbalancer(loadbalancer_id, options = {})
                          data = {
                lib/fog/openstack/network/requests/update_lb_member.rb on lines 2..34

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

                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 OpenStack
                    class Network
                      class Real
                        def update_lb_member(member_id, options = {})
                          data = {'member' => {}}
                Severity: Major
                Found in lib/fog/openstack/network/requests/update_lb_member.rb and 1 other location - About 2 hrs to fix
                lib/fog/openstack/network/requests/update_lbaas_loadbalancer.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 105.

                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

                        class Mock
                          def update_image(attributes)
                            response = Excon::Response.new
                            response.status = 200
                            image = images.last
                Severity: Major
                Found in lib/fog/openstack/image/v1/requests/update_image.rb and 1 other location - About 2 hrs to fix
                lib/fog/openstack/image/v2/requests/update_image.rb on lines 17..43

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

                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

                        class Mock
                          def update_image(attributes)
                            response = Excon::Response.new
                            response.status = 200
                            image = images.last
                Severity: Major
                Found in lib/fog/openstack/image/v2/requests/update_image.rb and 1 other location - About 2 hrs to fix
                lib/fog/openstack/image/v1/requests/update_image.rb on lines 34..60

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

                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

                Class Image has 24 methods (exceeds 20 allowed). Consider refactoring.
                Open

                        class Image < Fog::OpenStack::Model
                          identity :id
                
                          attribute :name
                          attribute :visibility # public or private
                Severity: Minor
                Found in lib/fog/openstack/image/v2/models/image.rb - About 2 hrs to fix

                  Method get_limits has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def get_limits(_options = {})
                            rate_limits = [
                              {'regex' => '.*',
                               'limit' => [
                                 {'next-available' => '2012-11-22T16:13:44Z',
                  Severity: Major
                  Found in lib/fog/openstack/compute/requests/get_limits.rb - About 2 hrs to fix

                    Method create_server has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def create_server(name, image_ref, flavor_ref, options = {})
                              response = Excon::Response.new
                              response.status = 202
                    
                              server_id = Fog::Mock.random_numbers(6).to_s
                    Severity: Minor
                    Found in lib/fog/openstack/compute/requests/create_server.rb - About 2 hrs 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 OpenStack
                        class  ContainerInfra
                          class Real
                            def update_cluster_template(uuid_or_name, params)
                              request(
                    lib/fog/openstack/container_infra/requests/update_bay_model.rb on lines 2..51

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

                    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