droidlabs/motion-prime

View on GitHub

Showing 126 of 136 total issues

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

  def request(method, path, params = {}, options = {}, &block)
    files = params.delete(:_files)
    data = request_params(params.merge(access_token: access_token))

    if !options.has_key?(:allow_queue) && config.default_methods_queue.include?(method.to_sym)
Severity: Minor
Found in motion-prime/api_client.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 cached_request! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def cached_request!(method, path, data, files = nil, options = {}, &block)
    use_callback = block_given?
    params = data.map { |key, value| "#{key}=#{value}" }.join('&')
    cache_key = [method, path, params].join(' ')
    response = read_cache(cache_key)
Severity: Minor
Found in motion-prime/api_client.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 attribute_convert_in has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def attribute_convert_in(value, type)
        return value if value.nil? || type.blank?
        case type.to_s
        when 'integer'
          value.to_i
Severity: Minor
Found in motion-prime/models/_base_mixin.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 normalize_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def normalize_value(object, receiver = nil)
      receiver ||= self
      if element?
        receiver.send(:instance_exec, section || screen, self, &object)
      else
Severity: Minor
Found in motion-prime/helpers/has_normalizer.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse(str_data, &block)
      return nil unless str_data
      data = str_data.respond_to?(:to_data) ? str_data.to_data : str_data
      if data.respond_to?(:dataUsingEncoding)
        data = data.dataUsingEncoding(NSUTF8StringEncoding)
Severity: Minor
Found in motion-prime/models/json.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 draw_in has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def draw_in(rect, state = :normal)
      if cached_draw_image[state]
        context = UIGraphicsGetCurrentContext()
        CGContextDrawImage(context, container_bounds, cached_draw_image[state])
        render_image_elements
Severity: Minor
Found in motion-prime/sections/_draw_section_mixin.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