cloudfoundry/cfoundry

View on GitHub

Showing 40 of 46 total issues

Method request_uri has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def request_uri(method, uri, options = {})
      uri = URI.parse(uri)

      unless uri.is_a?(URI::HTTP)
        raise InvalidTarget.new(@target)
Severity: Minor
Found in lib/cfoundry/rest_client.rb - About 6 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 succeed_to_load has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

      def succeed_to_load(options={})
        response_body = Helper.load_fixtures(options[:fixture] || "fake_cc_user")
        response_body["metadata"]["guid"] = options[:id] || "user-id-1"

        if options[:no_organizations]
Severity: Minor
Found in lib/cc_api_stub/users.rb - About 5 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 to_many has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def to_many(plural, opts = {})
      to_many_relations[plural] = opts

      singular = plural.to_s.sub(/s$/, "").to_sym

Severity: Minor
Found in lib/cfoundry/v2/model_magic/to_many.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 add_client_methods has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def add_client_methods(klass)
          singular = klass.object_name
          plural = klass.plural_object_name

          define_base_client_methods do
Severity: Major
Found in lib/cfoundry/v2/model_magic/client_extensions.rb - About 3 hrs to fix

    Class App has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class App < Model
        include CFoundry::UploadHelpers
    
        attribute :name,             :string
        to_one    :space
    Severity: Minor
    Found in lib/cfoundry/v2/app.rb - About 3 hrs to fix

      Method to_one has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_one(name, opts = {})
            to_one_relations[name] = opts
      
            association_name = opts[:as] || name
            default = opts[:default]
      Severity: Minor
      Found in lib/cfoundry/v2/model_magic/to_one.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 to_many has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def to_many(plural, opts = {})
            to_many_relations[plural] = opts
      
            singular = plural.to_s.sub(/s$/, "").to_sym
      
      
      Severity: Major
      Found in lib/cfoundry/v2/model_magic/to_many.rb - About 3 hrs to fix

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

          class Model
            include ActiveModel::Validations
        
            @@objects = {}
        
        
        Severity: Minor
        Found in lib/cfoundry/v2/model.rb - About 3 hrs to fix

          Method request_uri has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def request_uri(method, uri, options = {})
                uri = URI.parse(uri)
          
                unless uri.is_a?(URI::HTTP)
                  raise InvalidTarget.new(@target)
          Severity: Major
          Found in lib/cfoundry/rest_client.rb - About 2 hrs to fix

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

                    def add_client_methods(klass)
                      singular = klass.object_name
                      plural = klass.plural_object_name
            
                      define_base_client_methods do
            Severity: Minor
            Found in lib/cfoundry/v2/model_magic/client_extensions.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 attribute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                def attribute(name, type, opts = {})
                  attributes[name] = opts
                  json_name = opts[:at] || name
            
                  default = opts[:default]
            Severity: Minor
            Found in lib/cfoundry/v2/model_magic/attribute.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

            Class BaseClient has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class BaseClient # :nodoc:
                include CFoundry::ProxyOptions
            
                extend Forwardable
            
            
            Severity: Minor
            Found in lib/cfoundry/baseclient.rb - About 2 hrs to fix

              Method to_one has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def to_one(name, opts = {})
                    to_one_relations[name] = opts
              
                    association_name = opts[:as] || name
                    default = opts[:default]
              Severity: Minor
              Found in lib/cfoundry/v2/model_magic/to_one.rb - About 1 hr to fix

                Method health has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def health
                      if state == "STARTED"
                        healthy_count = running_instances
                        expected = total_instances
                
                
                Severity: Minor
                Found in lib/cfoundry/v2/app.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 create! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def create!
                      payload = {}
                
                      @manifest ||= {}
                      @manifest[:entity] ||= {}
                Severity: Minor
                Found in lib/cfoundry/v2/model.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 log_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def log_request(time, request, response)
                      return unless @log
                
                      data = log_data(time, request, response)
                
                
                Severity: Minor
                Found in lib/cfoundry/rest_client.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 create! has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def create!
                      payload = {}
                
                      @manifest ||= {}
                      @manifest[:entity] ||= {}
                Severity: Minor
                Found in lib/cfoundry/v2/model.rb - About 1 hr to fix

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

                      def attribute(name, type, opts = {})
                        attributes[name] = opts
                        json_name = opts[:at] || name
                  
                        default = opts[:default]
                  Severity: Minor
                  Found in lib/cfoundry/v2/model_magic/attribute.rb - About 1 hr to fix

                    Method upload_app has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def upload_app(guid, zipfile = nil, resources = [])
                          payload = {}
                          payload[:resources] = MultiJson.dump(resources)
                    
                          if zipfile
                    Severity: Minor
                    Found in lib/cfoundry/v2/base.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 has_summary has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def has_summary(actions = {})
                          #
                          # def summary
                          #
                          define_method(:summary) do
                    Severity: Minor
                    Found in lib/cfoundry/v2/model_magic/has_summary.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language