fog/fog-digitalocean

View on GitHub

Showing 18 of 65 total issues

Method list_flavors has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def list_flavors(filters = {})
          response        = Excon::Response.new
          response.status = 200
          response.body   = {

Severity: Major
Found in lib/fog/compute/digitalocean/requests/list_flavors.rb - About 4 hrs to fix

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

          class Server < Fog::Compute::Server
            identity :id
            attribute :name
            attribute :memory
            attribute :vcpus
    Severity: Minor
    Found in lib/fog/compute/digitalocean/models/server.rb - About 3 hrs to fix

      Method list_regions has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def list_regions(filters = {})
                response        = Excon::Response.new
                response.status = 200
                response.body   = {
                  'regions' => [
      Severity: Major
      Found in lib/fog/compute/digitalocean/requests/list_regions.rb - About 2 hrs to fix

        Method get_server_details has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def get_server_details(_)
                  response        = Excon::Response.new
                  response.status = 200
        
                  response.body = {
        Severity: Major
        Found in lib/fog/compute/digitalocean/requests/get_server_details.rb - About 2 hrs to fix

          Method list_volume_actions has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def list_volume_actions(id)
                    response        = Excon::Response.new
                    response.status = 201
                    response.body   = {
                      "actions" => [
          Severity: Minor
          Found in lib/fog/compute/digitalocean/requests/list_volume_actions.rb - About 1 hr to fix

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

                    def list_volumes(filters = {})
                      response        = Excon::Response.new
                                response.status = 200
                                response.body   = {
                                    "volumes" => [
            Severity: Minor
            Found in lib/fog/compute/digitalocean/requests/list_volumes.rb - About 1 hr to fix

              Method resize_volume has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def resize_volume(volume_id, size, region)
                                  response         = Excon::Response.new
                                  response.status  = 201
                        response.body    = {
                          "action" => {
              Severity: Minor
              Found in lib/fog/compute/digitalocean/requests/resize_volume.rb - About 1 hr to fix

                Method attach_volume_by_name has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def attach_volume_by_name(volume_name, droplet_id, region)
                                    response         = Excon::Response.new
                                    response.status  = 201
                                    response.body    = {
                                        "action" => {
                Severity: Minor
                Found in lib/fog/compute/digitalocean/requests/attach_volume.rb - About 1 hr to fix

                  Method detach_volume has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def detach_volume(volume_id, droplet_id, region)
                            response         = Excon::Response.new
                            response.status  = 201
                                      response.body    = {
                                          "action" => {
                  Severity: Minor
                  Found in lib/fog/compute/digitalocean/requests/detach_volume.rb - About 1 hr to fix

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

                            def create_server(name,
                                              size,
                                              image,
                                              region,
                                              options = {})
                    Severity: Minor
                    Found in lib/fog/compute/digitalocean/requests/create_server.rb - About 1 hr to fix

                      Method detach_volume_by_name has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def detach_volume_by_name(volume_name, droplet_id, region)
                                response         = Excon::Response.new
                                response.status  = 201
                                          response.body    = {
                                              "action" => {
                      Severity: Minor
                      Found in lib/fog/compute/digitalocean/requests/detach_volume.rb - About 1 hr to fix

                        Method attach_volume has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def attach_volume(volume_id, droplet_id, region)
                                            response         = Excon::Response.new
                                            response.status  = 201
                                            response.body    = {
                                                "action" => {
                        Severity: Minor
                        Found in lib/fog/compute/digitalocean/requests/attach_volume.rb - About 1 hr to fix

                          Method get_volume_details has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def get_volume_details(_)
                                    response        = Excon::Response.new
                                    response.status = 200
                          
                                    response.body = {
                          Severity: Minor
                          Found in lib/fog/compute/digitalocean/requests/get_volume_details.rb - About 1 hr to fix

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

                                    def list_images(filters = {})
                                      next_page = (filters[:page] || 1).to_i + 1
                            
                                      response        = Excon::Response.new
                                      response.status = 200
                            Severity: Minor
                            Found in lib/fog/compute/digitalocean/requests/list_images.rb - About 1 hr to fix

                              Method create_server has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      def create_server(name,
                                                        size,
                                                        image,
                                                        region,
                                                        options = {})
                              Severity: Minor
                              Found in lib/fog/compute/digitalocean/requests/create_server.rb - About 35 mins to fix

                                Method create_server has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        def create_server(name,
                                                          size,
                                                          image,
                                                          region,
                                                          options = {})
                                Severity: Minor
                                Found in lib/fog/compute/digitalocean/requests/create_server.rb - About 35 mins to fix

                                  Method request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                        def request(params, parse_json = true)
                                          first_attempt = true
                                          begin
                                            response = @connection.request(request_params(params))
                                          rescue Excon::Errors::Unauthorized => error
                                  Severity: Minor
                                  Found in lib/fog/digitalocean/service.rb - About 25 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 request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                          def request(params)
                                            params[:headers] ||= {}
                                            begin
                                              response = @connection.request(params)
                                            rescue Excon::Errors::HTTPStatusError => error
                                  Severity: Minor
                                  Found in lib/fog/compute/digitalocean.rb - About 25 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