clearsightstudio/ProMotion

View on GitHub

Showing 41 of 51 total issues

File table.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ProMotion
  module Table
    include ProMotion::Styling
    include ProMotion::Table::Searchable
    include ProMotion::Table::Refreshable
Severity: Minor
Found in lib/ProMotion/table/table.rb - About 3 hrs to fix

    Method set_remote_image has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_remote_image
          return unless data_cell[:remote_image] && (sd_web_image? || jm_image_cache?)
    
          self.imageView.image = remote_placeholder
    
    
    Severity: Minor
    Found in lib/ProMotion/table/cell/table_view_cell_module.rb - About 3 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 table_data has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def table_data
        @data ||= [{
          title: "Your Account",
          cells: [
            { title: "Increment", action: :increment_counter_by, arguments: {number: 3} },
    Severity: Major
    Found in app/screens/test_table_screen.rb - About 2 hrs to fix

      Method set_attribute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_attribute(element, k, v)
            return unless element
      
            if !element.is_a?(CALayer) && v.is_a?(Hash) && element.respond_to?("#{k}=")
              element.send("#{k}=", v)
      Severity: Minor
      Found in lib/ProMotion/styling/styling.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 open_screen has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def open_screen(screen, args = {})
            args = { animated: true }.merge(args)
      
            # Apply properties to instance
            screen = set_up_screen_for_open(screen, args)
      Severity: Minor
      Found in lib/ProMotion/screen/screen_navigation.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 search has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def search(search_string)
            @filtered = true
            @search_string = search_string
            self.filtered_data = []
      
      
      Severity: Minor
      Found in lib/ProMotion/table/data/table_data.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 create_tab_bar_item has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_tab_bar_item(tab={})
            if tab[:system_icon]
              mp("`system_icon:` no longer supported. Use `system_item:` instead.", force_color: :yellow)
              tab[:system_item] ||= tab[:system_icon]
            end
      Severity: Minor
      Found in lib/ProMotion/tabs/tabs.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_remote_image has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def set_remote_image
            return unless data_cell[:remote_image] && (sd_web_image? || jm_image_cache?)
      
            self.imageView.image = remote_placeholder
      
      
      Severity: Minor
      Found in lib/ProMotion/table/cell/table_view_cell_module.rb - About 1 hr to fix

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

            def webView(view, decidePolicyForNavigationAction: navigationAction, decisionHandler: decisionHandler)
              request = navigationAction.request
              nav_type = navigationAction.navigationType
              
              if %w(http https).include?(request.URL.scheme)
        Severity: Minor
        Found in lib/ProMotion/web/wk_web_screen_module.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 collection_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def collection_data
            cells = (1..10).to_a.map do |i|
              (1..10).to_a.map do |o|
                {
                    cell_identifier:  :custom_cell,
        Severity: Minor
        Found in app/screens/test_collection_screen.rb - About 1 hr to fix

          Method tableView has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def tableView(_, heightForHeaderInSection: index)
                section = promotion_table_data.section(index)
                if section[:title_view] || section[:title].to_s.length > 0
                  if section[:title_view_height]
                    section[:title_view_height]
          Severity: Minor
          Found in lib/ProMotion/table/table.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 tableView has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def tableView(_, heightForFooterInSection: index)
                section = promotion_table_data.section(index)
                if section[:footer_view] || section[:footer].to_s.length > 0
                  if section[:footer_view_height]
                    section[:footer_view_height]
          Severity: Minor
          Found in lib/ProMotion/table/table.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 close_screen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def close_screen(args = {})
                args ||= {}
                args = { sender: args } unless args.is_a?(Hash)
                args[:animated] = true unless args.has_key?(:animated)
          
          
          Severity: Minor
          Found in lib/ProMotion/screen/screen_navigation.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 get_searchable_params has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_searchable_params
                  params = self.class.get_searchable_params.dup
          
                  # support camelCase params
                  params[:search_results_updater] ||= params[:searchResultsUpdater]
          Severity: Minor
          Found in lib/ProMotion/table/extensions/searchable.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 map_bar_button_system_item has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def map_bar_button_system_item(symbol)
                mp("Nav bar button stytem item `:page_curl` has been deprecated.", force_color: :yellow) if symbol == :page_curl
                {
                  done:         UIBarButtonSystemItemDone,
                  cancel:       UIBarButtonSystemItemCancel,
          Severity: Minor
          Found in lib/ProMotion/screen/nav_bar_module.rb - About 1 hr to fix

            Method webView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def webView(in_web, shouldStartLoadWithRequest:in_request, navigationType:in_type)
                  if %w(http https).include?(in_request.URL.scheme)
                    if self.external_links == true && in_type == UIWebViewNavigationTypeLinkClicked
                      if defined?(OpenInChromeController)
                        open_in_chrome in_request
            Severity: Minor
            Found in lib/ProMotion/web/ui_web_screen_module.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 bar_button_item has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def bar_button_item(button_type, args)
                  return mp("`system_icon:` no longer supported. Use `system_item:` instead.", force_color: :yellow) if args[:system_icon]
                  return button_type if button_type.is_a?(UIBarButtonItem)
                  if args[:system_item]
                    mp("Nav bar button specified both `system_item:` and `title:`. Title will be ignored.", force_color: :yellow) if args[:title]
            Severity: Minor
            Found in lib/ProMotion/screen/nav_bar_module.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 row_height has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def row_height(height, args={})
                if height == :auto
                  if UIDevice.currentDevice.systemVersion.to_f < 8.0
                    height = args[:estimated] || 44.0
                    mp "Using `row_height :auto` is not supported in iOS 7 apps. Setting to #{height}.", force_color: :yellow
            Severity: Minor
            Found in lib/ProMotion/table/table_class_methods.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 ensure_wrapper_controller_in_place has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def ensure_wrapper_controller_in_place(screen, args={})
                  unless args[:close_all] || args[:modal] || args[:in_detail] || args[:in_master]
                    screen.navigationController ||= self.navigationController if screen.respond_to?("navigationController=")
                    screen.tab_bar ||= self.tab_bar if screen.respond_to?("tab_bar=")
                  end
            Severity: Minor
            Found in lib/ProMotion/screen/screen_navigation.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 send_on_return has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def send_on_return(args = {})
                  return unless self.parent_screen
                  if self.parent_screen.respond_to?(:on_return)
                    if args && self.parent_screen.method(:on_return).arity != 0
                      self.parent_screen.send(:on_return, args)
            Severity: Minor
            Found in lib/ProMotion/screen/screen_navigation.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

            Severity
            Category
            Status
            Source
            Language