rubymotion/BubbleWrap

View on GitHub
motion/media/player.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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 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 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

    There are no issues that match your filters.

    Category
    Status