fog/fog-ecloud

View on GitHub
lib/fog/compute/ecloud/models/server.rb

Summary

Maintainability
D
1 day
Test Coverage

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

      class Server < Fog::Ecloud::Model
        extend Forwardable

        identity :href

Severity: Minor
Found in lib/fog/compute/ecloud/models/server.rb - About 5 hrs to fix

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

    module Fog
      module Compute
        class Ecloud
          class Server < Fog::Ecloud::Model
            extend Forwardable
    Severity: Minor
    Found in lib/fog/compute/ecloud/models/server.rb - About 2 hrs to fix

      Method copy has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

              def copy(options = {})
                options = { :type => :copy }.merge(options)
                options[:source] ||= href
                if options[:type] == :copy
                  options[:cpus] ||= 1
      Severity: Minor
      Found in lib/fog/compute/ecloud/models/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

      Method delete_ip has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def delete_ip(options)
                slice_ips = begin
                              ips
                            rescue
                              []
      Severity: Minor
      Found in lib/fog/compute/ecloud/models/server.rb - About 1 hr to fix

        Method rnats has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def rnats
                  rnats = Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "#{service.base_path}/rnats/environments/#{environment_id}")
                  associations = nil
                  rnats.each do |rnat|
                    if rnats.index(rnat) == 0
        Severity: Minor
        Found in lib/fog/compute/ecloud/models/server.rb - About 45 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 add_ip has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def add_ip(options)
                  slice_ips = begin
                                ips
                              rescue
                                []
        Severity: Minor
        Found in lib/fog/compute/ecloud/models/server.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

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

                def delete_ip(options)
                  slice_ips = begin
                                ips
                              rescue
                                []
        Severity: Minor
        Found in lib/fog/compute/ecloud/models/server.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

        There are no issues that match your filters.

        Category
        Status