rubymotion/BubbleWrap

View on GitHub

Showing 50 of 50 total issues

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 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 set_player_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def set_player_options(options)
            self.media_player.allowsAirPlay = options[:allows_air_play] if options.has_key? :allows_air_play
            self.media_player.controlStyle = options[:control_style] if options.has_key? :control_style
            self.media_player.endPlaybackTime = options[:end_playback_time] if options.has_key? :end_playback_time
            self.media_player.initialPlaybackTime = options[:initial_playback_time] if options.has_key? :initial_playback_time
    Severity: Minor
    Found in motion/media/player.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 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

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

        def locationManager(manager, didUpdateLocations:locations)
          if @options[:once]
            @callback && @callback.call(locations.last)
            @callback = proc { |result| }
            stop
    Severity: Minor
    Found in motion/location/location.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 start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def start(options={}, &handler)
            if options.key?(:interval)
              @manager.deviceMotionUpdateInterval = options[:interval]
            end
    
    
    Severity: Minor
    Found in motion/motion/device_motion.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(input, data=false)
          if data
            data_to_parse = input.respond_to?(:to_data) ? input.to_data : input
            @source = data_to_parse
            @source_type = :data
    Severity: Minor
    Found in motion/rss_parser.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

    Method deprecated has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def deprecated(method_sym, version)
          unless method_sym.kind_of?(Symbol)
            raise ArgumentError, "deprecated() requires symbols for its first argument."
          end
    
    
    Severity: Minor
    Found in motion/util/deprecated.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

    Method depends_on has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def depends_on(file_or_paths)
          paths = file_or_paths.respond_to?(:each) ? file_or_paths : [ file_or_paths ]
          self.file_dependencies += paths.map do |f|
            f = self.class.file(f) unless f.is_a? Requirement
            f unless f.file == file
    Severity: Minor
    Found in lib/bubble-wrap/requirement.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

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

        def self.parse(str_data, &block)
          return nil unless str_data
          data = str_data.respond_to?('dataUsingEncoding:') ? str_data.dataUsingEncoding(NSUTF8StringEncoding) : str_data
          opts = NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves | NSJSONReadingAllowFragments
          error = Pointer.new(:id)
    Severity: Minor
    Found in motion/core/json.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 hide has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def hide
          if Dispatch::Queue.current.to_s == 'com.apple.main-thread'
            @counter = [self.counter - 1, 0].max
            if self.counter == 0
              if @hide_indicator_timer
    Severity: Minor
    Found in motion/network-indicator/network-indicator.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 after_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def after_config(config)
          return unless ::BubbleWrap::Requirement.frameworks.include?("CoreLocation")
          BubbleWrap.require_ios do
            ios8_files = 'motion/ios/8/location_constants.rb'
            if config.send(:deployment_target).to_f >= 8.0
    Severity: Minor
    Found in lib/bubble-wrap/loader.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 locationManager has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def locationManager(manager, didFailWithError:error)
          if error.domain == KCLErrorDomain
            case error.code
            when KCLErrorDenied
              error(Error::PERMISSION_DENIED)
    Severity: Minor
    Found in motion/location/location.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 to_url_decoded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_url_decoded(encoding = nil, legacy = false)
          if legacy
            stringByReplacingPercentEscapesUsingEncoding(encoding || NSUTF8StringEncoding)
          else
            if encoding
    Severity: Minor
    Found in motion/core/string.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 strip_up_to_last_lib has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def strip_up_to_last_lib(path)
            if path =~ /\/lib$/
              path = path.gsub(/\/lib$/, "")
            else
              path = path.split('lib')
    Severity: Minor
    Found in lib/bubble-wrap/requirement/path_manipulation.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 to_color has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_color
          # First check if it is a color keyword
          keyword_selector = "#{self.camelize(:lower)}Color"
          color_klass = App.osx? ? NSColor : UIColor
          return color_klass.send(keyword_selector) if color_klass.respond_to? keyword_selector
    Severity: Minor
    Found in motion/core/string.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 to_url_encoded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_url_encoded(encoding = nil, legacy = false)
          if legacy
            stringByAddingPercentEscapesUsingEncoding(encoding || NSUTF8StringEncoding)
          else
            encoding ||= KCFStringEncodingUTF8
    Severity: Minor
    Found in motion/core/string.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 callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def callback(&blk)
            return unless blk
            @deferred_status ||= :unknown
            if @deferred_status == :succeeded
              execute_block(&blk)
    Severity: Minor
    Found in motion/reactor/deferrable.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