rubymotion/BubbleWrap

View on GitHub

Showing 41 of 50 total issues

Method buildMenu has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def buildMenu
    @mainMenu = NSMenu.new

    appName = NSBundle.mainBundle.infoDictionary['CFBundleName']
    addMenu(appName) do
Severity: Major
Found in samples/osx/app/menu.rb - About 3 hrs to fix

    Method handle_result has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          private def handle_result(result_data, error, handler)
            if result_data
              result = {
                data: result_data,
                attitude: result_data.attitude,
    Severity: Major
    Found in motion/motion/device_motion.rb - About 2 hrs to fix

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

            def set_deferred_status(status, *args)
              cancel_timeout
              @errbacks ||= nil
              @callbacks ||= nil
              @deferred_status = status
      Severity: Minor
      Found in motion/reactor/deferrable.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 play has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def play(content_url, options = {}, &block)
              options = {
                delay_play: false
              }.merge(options)
      
      
      Severity: Minor
      Found in motion/media/player.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 picture has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def picture(options = {}, presenting_controller = nil, &block)
              @callback = block
              @callback.weak! if @callback && BubbleWrap.use_weak_callbacks?
      
              @options = {
      Severity: Minor
      Found in motion/core/device/ios/camera.rb - About 2 hrs to fix

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

              private def handle_result(result_data, error, handler)
                if result_data
                  result = {
                    data: result_data,
                    attitude: result_data.attitude,
        Severity: Minor
        Found in motion/motion/device_motion.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 picture has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

              def picture(options = {}, presenting_controller = nil, &block)
                @callback = block
                @callback.weak! if @callback && BubbleWrap.use_weak_callbacks?
        
                @options = {
        Severity: Minor
        Found in motion/core/device/ios/camera.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 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(base, *values)
              if values.is_a? NSArray
                value = values.size == 1 ? values.first : values.flatten
              else
                value = values
        Severity: Minor
        Found in motion/util/constants.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 setup_gesture has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def setup_gesture
            @panned_recognizer = self.whenPanned do |recognizer|
              case(recognizer.state)
              when UIGestureRecognizerStateBegan
                @last_position = self.position
        Severity: Minor
        Found in samples/gesture/app/views/drawing/gesture_view.rb - About 1 hr to fix

          Method play has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def play(content_url, options = {}, &block)
                  options = {
                    delay_play: false
                  }.merge(options)
          
          
          Severity: Minor
          Found in motion/media/player.rb - About 1 hr to fix

            Method future has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def future arg, cb=nil, eb=nil, &blk
                    arg = arg.call if arg.respond_to?(:call)
            
                    if arg.respond_to?(:set_deferred_status)
                      if cb || eb
            Severity: Minor
            Found in motion/reactor/future.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 new has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def new(params = {}, *args)
                  if params.is_a?(UIFont)
                    return params
                  end
                  _font = nil
            Severity: Minor
            Found in motion/font/font.rb - About 1 hr to fix

              Method styled has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def styled(type, *objects, &block)
                      if block.nil?
                        action = nil
                      else
                        block.weak! if BubbleWrap.use_weak_callbacks?
              Severity: Minor
              Found in motion/ui/ui_bar_button_item.rb - About 1 hr to fix

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

                    def new(params = {}, *args)
                      if params.is_a?(UIFont)
                        return params
                      end
                      _font = nil
                Severity: Minor
                Found in motion/font/font.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 styled has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                      def styled(type, *objects, &block)
                        if block.nil?
                          action = nil
                        else
                          block.weak! if BubbleWrap.use_weak_callbacks?
                Severity: Minor
                Found in motion/ui/ui_bar_button_item.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 new has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                      def new(options = {}, presenting_controller = nil, &block)
                        options = {
                          activities: nil,
                          animated: true
                        }.merge(options)
                Severity: Minor
                Found in motion/ui/ui_activity_view_controller_wrapper.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 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get(options = {}, &block)
                      @callback = block
                      @callback.weak! if @callback && BubbleWrap.use_weak_callbacks?
                      @options = {
                        authorization_type: :always,
                Severity: Minor
                Found in motion/location/location.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 plain_text_input has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                      def plain_text_input(options = {}, &block)
                        options = {buttons: ["Cancel", "OK"],
                                   cancel_button_index: 0}.merge!(options)
                        options[:style] = :plain_text_input
                        new(options, &block).tap do |view|
                Severity: Minor
                Found in motion/ui/ui_alert_view.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 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def get(options = {}, &block)
                      @callback = block
                      @callback.weak! if @callback && BubbleWrap.use_weak_callbacks?
                      @options = {
                        authorization_type: :always,
                Severity: Minor
                Found in motion/location/location.rb - About 1 hr to fix

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

                        def initialize(interval, *args, &blk)
                          callback = args.first.respond_to?(:call) ? args.first : blk
                          raise ArgumentError, "No callback or block supplied to periodic timer" unless callback
                          callback.weak! if callback && BubbleWrap.use_weak_callbacks?
                  
                  
                  Severity: Minor
                  Found in motion/reactor/periodic_timer.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

                  Severity
                  Category
                  Status
                  Source
                  Language