rubymotion/BubbleWrap

View on GitHub

Showing 41 of 50 total issues

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

    def add_gesture_recognizer_helper(recognizer, enableInteraction, proc)
      setUserInteractionEnabled true if enableInteraction && !isUserInteractionEnabled
      self.addGestureRecognizer(recognizer)

      @recognizers = {} unless @recognizers
Severity: Minor
Found in motion/ui/ui_view_wrapper.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 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

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

      def once(options={}, &blk)
        raise "A block is required" unless blk
        blk.weak! if BubbleWrap.use_weak_callbacks?

        @called_once = false
Severity: Minor
Found in motion/motion/motion.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 iso8601 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.iso8601(time)
    if time.include?(".")
      # Fractional Seconds
      if time.include?('Z')
        iso8601_with_fractional_seconds(time)
Severity: Minor
Found in motion/core/time.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 orientation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def orientation(device_orientation=UIDevice.currentDevice.orientation, fallback=true)
        case device_orientation
        when UIDeviceOrientationPortrait then :portrait
        when UIDeviceOrientationPortraitUpsideDown then :portrait_upside_down
        when UIDeviceOrientationLandscapeLeft then :landscape_left
Severity: Minor
Found in motion/core/device/ios/screen.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 errback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def errback(&blk)
        return unless blk
        @deferred_status ||= :unknown
        if @deferred_status == :failed
          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