fog/fog-openstack

View on GitHub

Showing 156 of 616 total issues

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

        def self.data
          @data ||= Hash.new do |hash, key|
            hash[key] = {
              :shares                   => [
                {
Severity: Major
Found in lib/fog/openstack/shared_file_system.rb - About 1 day to fix

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

              def self.data
                @data ||= Hash.new do |hash, key|
                  hash[key] = {
                    :zones      => [{
                      "id"             => "a86dba58-0043-4cc6-a1bb-69d5e86f3ca3",
    Severity: Major
    Found in lib/fog/openstack/dns/v2.rb - About 7 hrs to fix

      Class Server has 47 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Server < Fog::Compute::Server
              identity :id
              attribute :instance_name, :aliases => 'OS-EXT-SRV-ATTR:instance_name'
      
              attribute :addresses
      Severity: Minor
      Found in lib/fog/openstack/compute/models/server.rb - About 6 hrs to fix

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

                def self.data
                  @data ||= Hash.new do |hash, key|
                    qos_policy_id = Fog::UUID.uuid
                    network_id   = Fog::UUID.uuid
                    extension_id = Fog::UUID.uuid
        Severity: Major
        Found in lib/fog/openstack/network.rb - About 6 hrs to fix

          File token_test.rb has 411 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'test_helper'
          require 'auth_helper'
          
          describe Fog::OpenStack::Auth::Token do
            describe 'V3' do
          Severity: Minor
          Found in unit/auth/token_test.rb - About 5 hrs to fix

            File network.rb has 376 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Fog
              module OpenStack
                class Network < Fog::Service
                  requires :openstack_auth_url
                  recognizes :openstack_auth_token, :openstack_management_url,
            Severity: Minor
            Found in lib/fog/openstack/network.rb - About 5 hrs to fix

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

                      def create_server(name, image_ref, flavor_ref, options = {})
                        data = {
                          'server' => {
                            'flavorRef' => flavor_ref,
                            'name'      => name
              Severity: Minor
              Found in lib/fog/openstack/compute/requests/create_server.rb - About 4 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 data has 110 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def self.data
                        @data ||= Hash.new do |hash, key|
                          chassis_uuid = Fog::UUID.uuid
                          instance_uuid = Fog::UUID.uuid
                          node_uuid = Fog::UUID.uuid
              Severity: Major
              Found in lib/fog/openstack/baremetal.rb - About 4 hrs to fix

                File shared_file_system.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Fog
                  module OpenStack
                    class SharedFileSystem < Fog::Service
                      SUPPORTED_VERSIONS = /v2(\.0)*/
                      SUPPORTED_MICROVERSION = '2.15'.freeze
                Severity: Minor
                Found in lib/fog/openstack/shared_file_system.rb - About 4 hrs to fix

                  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

                      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

                                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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language