droidlabs/motion-prime

View on GitHub

Showing 126 of 136 total issues

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

  class BaseFieldSection < Section
    include CellSectionMixin
    include BW::KVO

    attr_reader :form
Severity: Minor
Found in motion-prime/sections/form/base_field_section.rb - About 2 hrs to fix

    Method extract_attributed_string_options has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_attributed_string_options(options)
          attributes = {}
          line_height = options[:line_height]
          line_spacing = options[:line_spacing]
          text_alignment = options[:text_alignment]
    Severity: Minor
    Found in motion-prime/elements/_text_mixin.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 size_to_fit_if_needed has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def size_to_fit_if_needed
          if original_options[:size_to_fit]
            computed_options[:width] = cached_content_outer_width unless original_options[:width]
            computed_options[:height] = cached_content_outer_height unless original_options[:height]
            reset_computed_values
    Severity: Minor
    Found in motion-prime/elements/draw/label.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 fetch_image has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_image
          return unless computed_options[:url]
          unless computed_options[:default] === false
            raise "You must set default image for `#{name}`" unless computed_options[:default]
            view.setImage(computed_options[:default].uiimage)
    Severity: Minor
    Found in motion-prime/elements/image.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 focus has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def focus(begin_editing = false)
          # focus on text field
          elements.values.detect do |element|
            if element.view.is_a?(UITextField) || element.view.is_a?(UITextView)
              element.view.becomeFirstResponder
    Severity: Minor
    Found in motion-prime/sections/form/base_field_section.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 prepare_options! has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def prepare_options!
          if options[:size_to_fit]
            options[:line_break_mode] ||= :word_wrap
            options[:number_of_lines] ||= 0 if view.is_a?(UILabel)
          end
    Severity: Minor
    Found in motion-prime/views/view_styler.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 preload_sections_schedule_from has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def preload_sections_schedule_from(index, load_count)
          service = preloader_index_service
    
          @preloader_queue ||= []
    
    
    Severity: Minor
    Found in motion-prime/sections/_async_table_mixin.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 set_image_options has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def set_image_options(key, value)
            if key.end_with?('background_image') && ui_image = value.uiimage
              if view.is_a?(UIControl) || view.is_a?(UISearchBar)
                view.send :"set#{camelize_factory(key)}:forState", ui_image, UIControlStateNormal
              else
    Severity: Minor
    Found in motion-prime/views/view_styler.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 fetch_has_many_with_attributes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_has_many_with_attributes(key, data, sync_options = {})
          # TODO: should we skip add/delete/save unless should_save?
          should_save = sync_options[:save]
    
          models_to_add = []
    Severity: Minor
    Found in motion-prime/models/_sync_mixin.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 sum_index has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def sum_index(a, rows, crop_to_edges = true)
        row = a.row + rows
        section = a.section
    
        max_row = @count_in_sections[a.section] - 1
    Severity: Minor
    Found in motion-prime/services/table_data_indexes.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 fetch has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch(options = {}, &block)
          use_callback = block_given?
          method = options[:method] || :get
          url = sync_url(method, options)
    
    
    Severity: Minor
    Found in motion-prime/models/_sync_mixin.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 filter_array has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def filter_array(data, find_options = {}, sort_options = nil)
          data = data.select do |entity|
            find_options.all? do |field, value|
              if value.is_a?(Array)
                value.include?(entity.info[field].to_s)
    Severity: Minor
    Found in motion-prime/models/_filter_mixin.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 observe_model_errors has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def observe_model_errors
          prepare_table_data
          return unless observing_errors?
          on_error_change = proc { |old_value, new_value|
            next unless screen.weakref_alive?
    Severity: Minor
    Found in motion-prime/sections/form/base_field_section.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 prepare_frame_for has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def prepare_frame_for(parent_bounds)
          options[:frame] = calculate_frame_for(parent_bounds, options)
          if options.slice(:width, :height, :right, :bottom, :height_to_fit).values.any?
            mask = UIViewAutoresizingNone
            mask |= UIViewAutoresizingFlexibleTopMargin if options[:top].nil?
    Severity: Minor
    Found in motion-prime/views/view_styler.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 init_form_fields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def init_form_fields
            self.fields.values.each(&:clear_observers) if fields.present?
    
            self.fields = {}
            self.field_indexes = {}
    Severity: Minor
    Found in motion-prime/sections/form.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 fetch_has_one has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_has_one(key, options = {}, sync_options = {}, &block)
          use_callback = block_given?
          NSLog("SYNC: started sync for #{key} in #{self.class_name_without_kvo}")
          params = (options[:params] || {}).deep_merge(sync_options[:params] || {})
          api_client.get association_sync_url(key, options, sync_options), params do |response, status_code|
    Severity: Minor
    Found in motion-prime/models/_sync_mixin.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 find has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def find(*arg)
            if arg[0].is_a?(Hash)
              # hash style
              options = arg[0]
              if arg[1] && arg[1].is_a?(Hash)
    Severity: Minor
    Found in motion-prime/models/_finder_mixin.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 set_layer_options has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def set_layer_options(key, value)
            if key == 'rounded_corners'
              layer_bounds = bounds
              if value[:overlap]
                size = layer_bounds.size
    Severity: Minor
    Found in motion-prime/views/view_styler.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 filtered_updatable_attributes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def filtered_updatable_attributes(options = {})
          slice_attributes = options[:updatable_attributes].map(&:to_sym) if options.has_key?(:updatable_attributes)
          updatable_attributes = self.class.updatable_attributes
    
          if updatable_attributes.blank?
    Severity: Minor
    Found in motion-prime/models/_sync_mixin.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_many has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def has_many(association_name, options = {})
            bag_name = "#{association_name}_bag"
            self.bag bag_name.to_sym
    
            self._associations ||= {}
    Severity: Minor
    Found in motion-prime/models/_association_mixin.rb - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language