goncalvesjoao/smooth_operator

View on GitHub

Showing 21 of 21 total issues

Method decode has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

      def self.decode(query)
        return nil if query == nil
        # Recursive helper lambda
        dehash = lambda do |hash|
          hash.each do |(key, value)|
Severity: Minor
Found in lib/smooth_operator/operators/faraday_encoder.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 encode has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.encode(params)
        return nil if params == nil

        if !params.is_a?(Array)
          if !params.respond_to?(:to_hash)
Severity: Minor
Found in lib/smooth_operator/operators/faraday_encoder.rb - About 1 hr to fix

    Method decode has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.decode(query)
            return nil if query == nil
            # Recursive helper lambda
            dehash = lambda do |hash|
              hash.each do |(key, value)|
    Severity: Minor
    Found in lib/smooth_operator/operators/faraday_encoder.rb - About 1 hr to fix

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

            def self.encode(params)
              return nil if params == nil
      
              if !params.is_a?(Array)
                if !params.respond_to?(:to_hash)
      Severity: Minor
      Found in lib/smooth_operator/operators/faraday_encoder.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 save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def save(relative_path = nil, data = {}, options = {})
              return false unless before_save
      
              clear_induced_errors
      
      
      Severity: Minor
      Found in lib/smooth_operator.rb - About 55 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 resource_data_for_server has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def resource_data_for_server(data, options)
            data ||= {}
            options ||= {}
      
            resource_data =
      Severity: Minor
      Found in lib/smooth_operator/persistence.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def initialize(class_name, options)
              options = options.is_a?(Hash) ? options : {}
      
              @name, @options = class_name, options
      
      
      Severity: Minor
      Found in lib/smooth_operator/associations/reflection.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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def save(relative_path = nil, data = {}, options = {})
            resource_data = resource_data_for_server(data, options)
      
            method = new_record? ? :create : :update
      
      
      Severity: Minor
      Found in lib/smooth_operator/persistence.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 populate_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def populate_options(object, options)
              options ||= {}
      
              ClassMethods::OPTIONS.each do |option, default|
                options[option] ||= object.send(option)
      Severity: Minor
      Found in lib/smooth_operator/operator.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 typhoeus_request_args has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def typhoeus_request_args(http_verb, relative_path, params, body, options)
      Severity: Minor
      Found in lib/smooth_operator/operators/typhoeus.rb - About 35 mins to fix

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

              def request_configuration(request, request_options, options, params, body)
        Severity: Minor
        Found in lib/smooth_operator/operators/faraday.rb - About 35 mins to fix

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

                def make_the_call(http_verb, resource_path, params, body, options)
          Severity: Minor
          Found in lib/smooth_operator/operators/typhoeus.rb - About 35 mins to fix

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

                  def make_the_call(http_verb, resource_path, params, body, options)
            Severity: Minor
            Found in lib/smooth_operator/operators/faraday.rb - About 35 mins to fix

              Method cast_to_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def cast_to_type(name, value, parent_object)
                    type, known_attribute, unknown_hash_class = extract_args(parent_object.class, name)
              
                    return Helpers.duplicate(value) if known_attribute && type.nil?
              
              
              Severity: Minor
              Found in lib/smooth_operator/type_casting.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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def destroy(relative_path = nil, data = {}, options = {})
                    return false unless persisted?
              
                    resource_data = resource_data_for_server(data, options)
              
              
              Severity: Minor
              Found in lib/smooth_operator/persistence.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 assign_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def assign_attributes(attributes = {}, options = {})
                    attributes = _extract_attributes(attributes)
              
                    return nil unless attributes.is_a?(Hash)
              
              
              Severity: Minor
              Found in lib/smooth_operator/attribute_assignment.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

              Avoid too many return statements within this method.
              Open

                      return buffer.chop
              Severity: Major
              Found in lib/smooth_operator/operators/faraday_encoder.rb - About 30 mins to fix

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

                      def resource_path(relative_path, options)
                        resources_name = options[:resources_name] || self.resources_name
                
                        if Helpers.present?(resources_name)
                          Helpers.present?(relative_path) ? "#{resources_name}/#{relative_path}" : resources_name
                Severity: Minor
                Found in lib/smooth_operator/operator.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def find(relative_path, data = {}, options = {})
                      relative_path = '' if relative_path == :all
                
                      get(relative_path, data, options) do |remote_call|
                        if remote_call.ok?
                Severity: Minor
                Found in lib/smooth_operator/finder_methods.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 resource_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def resource_path(relative_path)
                      if Helpers.absolute_path?(relative_path)
                        Helpers.remove_initial_slash(relative_path)
                      elsif persisted?
                        id = Helpers.primary_key(self)
                Severity: Minor
                Found in lib/smooth_operator/operator.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