clearsightstudio/ProMotion

View on GitHub

Showing 41 of 51 total issues

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

    def delete_row(index_paths, animation = nil)
      deletable_index_paths = []
      index_paths = [index_paths] if index_paths.kind_of?(NSIndexPath)
      index_paths.each do |index_path|
        delete_cell = false
Severity: Minor
Found in lib/ProMotion/table/table.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 create_collection_cell has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def create_collection_cell(data_cell, index_path)
      cell = collection_view.dequeueReusableCellWithReuseIdentifier(data_cell[:cell_identifier].to_s, forIndexPath: index_path)
      cell.extend(PM::CollectionViewCellModule) unless cell.is_a?(PM::CollectionViewCellModule)
      cell.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin
      cell.clipsToBounds    = true
Severity: Minor
Found in lib/ProMotion/collection/collection_builder.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 set_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_image
      return unless data_cell[:image]
      cell_image = data_cell[:image].is_a?(Hash) ? data_cell[:image][:image] : data_cell[:image]
      cell_image = UIImage.imageNamed(cell_image) if cell_image.is_a?(String)
      self.imageView.layer.masksToBounds = true
Severity: Minor
Found in lib/ProMotion/table/cell/table_view_cell_module.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 on_long_press has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def on_long_press(gesture)
        return unless gesture.state == UIGestureRecognizerStateBegan
        gesture_point = gesture.locationInView(pressed_table_view)
        index_path = pressed_table_view.indexPathForRowAtPoint(gesture_point)
        return unless index_path
Severity: Minor
Found in lib/ProMotion/table/extensions/longpressable.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 set_data_cell_defaults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_data_cell_defaults(data_cell)
      data_cell[:cell_style] ||= begin
        data_cell[:subtitle] ? UITableViewCellStyleSubtitle : UITableViewCellStyleDefault
      end
      data_cell[:cell_class] ||= PM::TableViewCell
Severity: Minor
Found in lib/ProMotion/table/data/table_data_builder.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 set_accessory_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_accessory_view
      return self.accessoryView = nil unless data_cell[:accessory] && data_cell[:accessory][:view]
      if data_cell[:accessory][:view] == :switch
        self.accessoryView = switch_view
      else
Severity: Minor
Found in lib/ProMotion/table/cell/table_view_cell_module.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 make_searchable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def make_searchable(params = nil) # params argument is deprecated. No longer need to use it.
        params = get_searchable_params

        self.definesPresentationContext = true
        search_controller.delegate = params[:delegate]
Severity: Minor
Found in lib/ProMotion/table/extensions/searchable.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 set_up_screen_for_open has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_up_screen_for_open(screen, args={})
      # Instantiate screen if given a class
      screen = screen.new(args) if screen.respond_to?(:new)

      # Store screen options
Severity: Minor
Found in lib/ProMotion/screen/screen_navigation.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 set_nav_bar_button has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_nav_bar_button(side, args={})
      button = (args.is_a?(UIBarButtonItem)) ? args : create_toolbar_button(args)
      button.setTintColor args[:tint_color] if args.is_a?(Hash) && args[:tint_color]

      self.navigationItem.leftBarButtonItem = button if side == :left
Severity: Minor
Found in lib/ProMotion/screen/nav_bar_module.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 bar_button_item_string(button_type, args) if button_type.is_a?(String)
Severity: Major
Found in lib/ProMotion/screen/nav_bar_module.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return bar_button_item_custom(button_type) if button_type.is_a?(UIView)
    Severity: Major
    Found in lib/ProMotion/screen/nav_bar_module.rb - About 30 mins to fix

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

          def self.new(*screens)
            tab_bar_controller = alloc.init
      
            screens = screens.flatten.map { |s| s.respond_to?(:new) ? s.new : s } # Initialize any classes
      
      
      Severity: Minor
      Found in lib/ProMotion/cocoatouch/tab_bar_controller.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 collection_layout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def collection_layout(klass, options={})
          @layout                         = klass.new
          @layout.scrollDirection         = map_layout_direction(options.fetch(:direction, :vertical))
      
          @layout.minimumLineSpacing      = options[:minimum_line_spacing] if options.has_key?(:minimum_line_spacing)
      Severity: Minor
      Found in lib/ProMotion/collection/collection_class_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 add_nav_bar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_nav_bar(args = {})
            args = self.class.get_nav_bar.merge(args)
            return unless args[:nav_bar] || args[:nav_controller]
            self.navigationController ||= begin
              self.first_screen = true if self.respond_to?(:first_screen=)
      Severity: Minor
      Found in lib/ProMotion/screen/nav_bar_module.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 set_up_screen_for_open has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_up_screen_for_open(screen, args={})
            # Instantiate screen if given a class
            screen = screen.new(args) if screen.respond_to?(:new)
      
            # Store screen options
      Severity: Minor
      Found in lib/ProMotion/delegate/delegate_module.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 set_initial_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_initial_content
            return unless self.respond_to?(:content) && self.content
            if self.content.is_a?(NSURL) 
              open_url(self.content) 
            elsif self.content.is_a?(NSMutableURLRequest)
      Severity: Minor
      Found in lib/ProMotion/web/web_screen_module.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 open_tab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def open_tab(tab)
            if tab.is_a? String
              selected_tab_vc = find_tab(tab)
            elsif tab.is_a? Numeric
              selected_tab_vc = viewControllers[tab]
      Severity: Minor
      Found in lib/ProMotion/cocoatouch/tab_bar_controller.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 layoutSubviews has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def layoutSubviews
            super
            return unless data_cell
      
            # Support changing sizes of the image view
      Severity: Minor
      Found in lib/ProMotion/table/cell/table_view_cell_module.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 set_toolbar_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_toolbar_items(buttons = [], animated = true)
            if buttons
              self.toolbarItems = Array(buttons).map{|b| b.is_a?(UIBarButtonItem) ? b : create_toolbar_button(b) }
              navigationController.setToolbarHidden(false, animated:animated)
            else
      Severity: Minor
      Found in lib/ProMotion/screen/nav_bar_module.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 set_up_header_footer_views has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_up_header_footer_views
            [:header, :footer].each do |hf_view|
              if self.respond_to?("table_#{hf_view}_view".to_sym)
                view = self.send("table_#{hf_view}_view")
                if view.is_a? UIView
      Severity: Minor
      Found in lib/ProMotion/table/table.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