fog/fog-openstack

View on GitHub

Showing 156 of 616 total issues

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

        def save(options = {})
          requires :directory, :key
          options['Cache-Control'] = cache_control if cache_control
          options['Content-Type'] = content_type if content_type
          options['Content-Disposition'] = content_disposition if content_disposition
Severity: Minor
Found in lib/fog/openstack/storage/models/file.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 update_stack has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def update_stack(arg1, arg2 = nil, arg3 = nil)
          if arg1.kind_of?(Stack)
            # Normal use, update_stack(stack, options = {})
            stack = arg1
            stack_name = stack.stack_name
Severity: Minor
Found in lib/fog/openstack/orchestration/requests/update_stack.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 request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

          def request(params)
            response = @connection.request(
              params.merge(
                :headers => {
                  'Content-Type' => 'application/json',
Severity: Minor
Found in lib/fog/openstack/workflow/v2.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 list_events has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def list_events(options = {})
          if !options.key?(:stack) && !(options.key?(:stack_name) && options.key?(:stack_id))
            raise(ArgumentError, "Missing required options keys: :stack or :stack_name and :stack_id, while calling "\
                                 " .list_events(options)")
          end
Severity: Minor
Found in lib/fog/openstack/orchestration/requests/list_events.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 get_bay has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_bay(_uuid_or_name)
          response = Excon::Response.new
          response.status = 200
          response.body = {
            "status"             => "CREATE_COMPLETE",
Severity: Minor
Found in lib/fog/openstack/container_infra/requests/get_bay.rb - About 1 hr to fix

    Method get_port has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def get_port(port_id)
              response = Excon::Response.new
              if data = self.data[:ports][port_id]
                response.status = 200
                response.body = {
    Severity: Minor
    Found in lib/fog/openstack/network/requests/get_port.rb - About 1 hr to fix

      Method update_ipsec_site_connection has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def update_ipsec_site_connection(ipsec_site_connection_id, options = {})
                response = Excon::Response.new
                ipsec_site_connection = list_ipsec_site_connections.body['ipsec_site_connections'].detect do |instance|
                  instance['id'] == ipsec_site_connection_id
                end
      Severity: Minor
      Found in lib/fog/openstack/network/requests/update_ipsec_site_connection.rb - About 1 hr to fix

        Method delete_key_pair has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def delete_key_pair(key_name)
                  response = Excon::Response.new
                  response.status = 200
                  response.headers = {
                    "X-Compute-Request-Id" => "req-c373a42c-2825-4e60-8d34-99416ea850be",
        Severity: Minor
        Found in lib/fog/openstack/compute/requests/get_key_pair.rb - About 1 hr to fix

          Method patch_plan has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def patch_plan(_plan_uuid, _parameters)
                    response = Excon::Response.new
                    response.status = 201
                    response.body = {
                      "created_at"  => "2014-09-26T20:23:14.222815",
          Severity: Minor
          Found in lib/fog/openstack/planning/requests/patch_plan.rb - About 1 hr to fix

            Method request has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def request(params)
                        response = @connection.request(
                          params.merge(
                            :headers => {
                              'Content-Type' => 'application/json',
            Severity: Minor
            Found in lib/fog/openstack/workflow/v2.rb - About 1 hr to fix

              Method request has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def request(params, parse_json = true)
                      retried = false
                      begin
                        authenticate! if @expires && (@expires - Time.now.utc).to_i < 60
              
              
              Severity: Minor
              Found in lib/fog/openstack/core.rb - About 1 hr to fix

                Method list_volumes_detailed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def list_volumes_detailed(_options = {})
                            response            = Excon::Response.new
                            response.status     = 200
                            data[:volumes] ||= [
                              {"status"            => "available",
                Severity: Minor
                Found in lib/fog/openstack/volume/v3/requests/list_volumes_detailed.rb - About 1 hr to fix

                  Method list_stack_data_detailed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def list_stack_data_detailed(_options = {})
                            Excon::Response.new(
                              :body   => {
                                'stacks' =>
                                            [{"parent"                => nil,

                    Method list_volumes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def list_volumes(_options = true, _options_deprecated = {})
                                response            = Excon::Response.new
                                response.status     = 200
                                data[:volumes] ||= [
                                  {"status"            => "available",
                    Severity: Minor
                    Found in lib/fog/openstack/volume/v2/requests/list_volumes.rb - About 1 hr to fix

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

                              def self.data
                                @data ||= Hash.new do |hash, key|
                                  hash[key] = {
                                    :vnfs  => [
                                      {
                      Severity: Minor
                      Found in lib/fog/openstack/nfv.rb - About 1 hr to fix

                        Method list_volumes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  def list_volumes(_options = true, _options_deprecated = {})
                                    response            = Excon::Response.new
                                    response.status     = 200
                                    data[:volumes] ||= [
                                      {"status"              => "available",
                        Severity: Minor
                        Found in lib/fog/openstack/volume/v1/requests/list_volumes.rb - About 1 hr to fix

                          Method list_volumes_detailed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    def list_volumes_detailed(_options = {})
                                      response            = Excon::Response.new
                                      response.status     = 200
                                      data[:volumes] ||= [
                                        {"status"              => "available",
                          Severity: Minor
                          Found in lib/fog/openstack/volume/v1/requests/list_volumes_detailed.rb - About 1 hr to fix

                            Method boot_from_snapshot has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    def boot_from_snapshot(name, image_ref, flavor_ref, options = {})
                                      data = {
                                        'server' => {
                                          'flavorRef' => flavor_ref,
                                          'imageRef'  => image_ref,
                            Severity: Minor
                            Found in lib/fog/openstack/compute/requests/boot_from_snapshot.rb - About 1 hr to fix

                              Method list_volumes_detailed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                        def list_volumes_detailed(_options = {})
                                          response            = Excon::Response.new
                                          response.status     = 200
                                          data[:volumes] ||= [
                                            {"status"            => "available",
                              Severity: Minor
                              Found in lib/fog/openstack/volume/v2/requests/list_volumes_detailed.rb - About 1 hr to fix

                                Method list_volumes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                          def list_volumes(_options = true, _options_deprecated = {})
                                            response            = Excon::Response.new
                                            response.status     = 200
                                            data[:volumes] ||= [
                                              {"status"            => "available",
                                Severity: Minor
                                Found in lib/fog/openstack/volume/v3/requests/list_volumes.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language