droidlabs/motion-prime

View on GitHub

Showing 126 of 136 total issues

Method draw_background_in_context has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    def draw_background_in_context(context = nil)
      context ||= UIGraphicsGetCurrentContext()
      options = draw_options
      rect, background_color, border_width, border_color, border_sides, corner_radius, dashes_array, rounded_corners = options.slice(:rect, :background_color, :border_width, :border_color, :border_sides, :corner_radius, :dashes, :rounded_corners).values

Severity: Minor
Found in motion-prime/elements/draw/_draw_background_mixin.rb - About 1 day 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 calculate_frame_for has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

    def calculate_frame_for(parent_bounds, options)
      width   = options[:width]
      height  = options[:height]
      top     = options[:top]
      right   = options[:right]
Severity: Minor
Found in motion-prime/views/_frame_calculator_mixin.rb - About 7 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 Section has 53 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Section
    # MotionPrime::Section is container for Elements.
    # Sections are located inside Screen and can contain multiple Elements.
    # On render, each element will be added to parent screen.

Severity: Major
Found in motion-prime/sections/base_section.rb - About 7 hrs to fix

    Class AbstractCollectionSection has 48 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class AbstractCollectionSection < Section
        include HasStyleChainBuilder
    
        attr_accessor :collection_element, :did_appear
        attr_reader :decelerating
    Severity: Minor
    Found in motion-prime/sections/abstract_collection.rb - About 6 hrs to fix

      File _sync_mixin.rb has 337 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module MotionPrime
        module ModelSyncMixin
          extend ::MotionSupport::Concern
      
          def self.included(base)
      Severity: Minor
      Found in motion-prime/models/_sync_mixin.rb - About 4 hrs to fix

        Method preload_sections_after has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            def preload_sections_after(from_index, load_limit = nil)
              return unless async_data?
              service = preloader_index_service
              load_limit ||= self.class.async_data_options.try(:[], :preload_cells_count)
        
        
        Severity: Minor
        Found in motion-prime/sections/_async_table_mixin.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

        Class FormSection has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class FormSection < TableSection
            # MotionPrime::FormSection is container for Field Sections.
            # Forms are located inside Screen and can contain multiple Field Sections.
            # On render, each field will be added to parent screen.
        
        
        Severity: Minor
        Found in motion-prime/sections/form.rb - About 3 hrs to fix

          Class TableSection has 30 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class TableSection < AbstractCollectionSection
              include TableSectionRefreshMixin
              include HasSearchBar
          
              class_attribute :group_header_options, :pull_to_refresh_block, :pull_to_refresh_options
          Severity: Minor
          Found in motion-prime/sections/table.rb - About 3 hrs to fix

            File base_section.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            motion_require '../helpers/has_authorization'
            module MotionPrime
              class Section
                # MotionPrime::Section is container for Elements.
                # Sections are located inside Screen and can contain multiple Elements.
            Severity: Minor
            Found in motion-prime/sections/base_section.rb - About 3 hrs to fix

              Method draw_background_in_context has 79 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def draw_background_in_context(context = nil)
                    context ||= UIGraphicsGetCurrentContext()
                    options = draw_options
                    rect, background_color, border_width, border_color, border_sides, corner_radius, dashes_array, rounded_corners = options.slice(:rect, :background_color, :border_width, :border_color, :border_sides, :corner_radius, :dashes, :rounded_corners).values
              
              
              Severity: Major
              Found in motion-prime/elements/draw/_draw_background_mixin.rb - About 3 hrs to fix

                Method calculate_frame_for has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def calculate_frame_for(parent_bounds, options)
                      width   = options[:width]
                      height  = options[:height]
                      top     = options[:top]
                      right   = options[:right]
                Severity: Major
                Found in motion-prime/views/_frame_calculator_mixin.rb - About 3 hrs to fix

                  Class DrawElement has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class DrawElement < BaseElement
                      # MotionPrime::DrawElement is container for drawRect method options.
                      # Elements are located inside Sections
                  
                      include FrameCalculatorMixin
                  Severity: Minor
                  Found in motion-prime/elements/draw.rb - About 2 hrs to fix

                    Class BaseElement has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class BaseElement
                        # MotionPrime::BaseElement is container for UIView class elements with options.
                        # Elements are located inside Sections
                    
                        include ::MotionSupport::Callbacks
                    Severity: Minor
                    Found in motion-prime/elements/base_element.rb - About 2 hrs to fix

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

                          def load_image
                            return if @loading || image_data || !computed_options[:url]
                            @loading = true
                      
                            refs = strong_references
                      Severity: Minor
                      Found in motion-prime/elements/draw/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

                      Class TableDelegate has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class TableDelegate
                          include DelegateMixin
                          attr_accessor :table_section
                      
                          def initialize(options)
                      Severity: Minor
                      Found in motion-prime/sections/table/table_delegate.rb - About 2 hrs to fix

                        Class ApiClient has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class ApiClient
                          attr_accessor :access_token
                        
                          def initialize(options = {})
                            self.access_token = options[:access_token]
                        Severity: Minor
                        Found in motion-prime/api_client.rb - About 2 hrs to fix

                          File view_styler.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          module MotionPrime
                            class ViewStyler
                              include FrameCalculatorMixin
                              include HasStyles
                              include HasClassFactory
                          Severity: Minor
                          Found in motion-prime/views/view_styler.rb - About 2 hrs to fix

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

                              def request!(method, path, data, files = nil, options = {}, &block)
                                use_callback = block_given?
                                path_with_base = path_with_base(path, config.api_namespace)
                                client_method = files.present? ? :"multipart_#{method}" : method
                                AFMotion::Client.shared.send client_method, path_with_base, data do |response, form_data, progress|
                            Severity: Minor
                            Found in motion-prime/api_client.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 style has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def style(*args, &block)
                                  names = Array.wrap(args)
                                  options = names.pop if args.last.is_a?(Hash)
                            
                                  if options.present?
                            Severity: Minor
                            Found in motion-prime/views/styles.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 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def fetch_has_many(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] || {})
                            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

                            Severity
                            Category
                            Status
                            Source
                            Language