awilliams/RTanque

View on GitHub

Showing 6 of 6 total issues

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

  def tick!
    command.radar_heading = sensors.radar_heading + (RTanque::Heading::ONE_DEGREE * 30)

    if sensors.button_down?(Gosu::KbLeft)
      command.turret_heading = sensors.turret_heading - (RTanque::Heading::ONE_DEGREE * 10)
Severity: Minor
Found in sample_bots/keyboard.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 tick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def tick
        self.delete_if do |member|
          if member.dead?
            true
          else
Severity: Minor
Found in lib/rtanque/match/tick_group.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 button_down? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def button_down?(button_id)
        if self.class.const_defined?(:Gosu)
          button_id = Gosu::Window.char_to_button_id(button_id) unless button_id.kind_of?(Integer)
          @gui_window && @gui_window.button_down?(button_id)
        else
Severity: Minor
Found in lib/rtanque/bot/sensors.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 destroy_lock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy_lock(reflection)
    command.heading = reflection.heading
    command.radar_heading = reflection.heading
    command.turret_heading = reflection.heading
    command.speed = reflection.distance > 200 ? MAX_BOT_SPEED : MAX_BOT_SPEED / 2.0
Severity: Minor
Found in sample_bots/seek_and_destroy.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 hits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def hits(bots, &on_hit)
      bots.each do |hit_bot|
        if hit_bot.position.within_radius?(self.position, Bot::RADIUS)
          self.dead!
          on_hit.call(self.bot, hit_bot) if on_hit
Severity: Minor
Found in lib/rtanque/shell.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 bind_to_arena has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def bind_to_arena
      if self.x < 0
        self.x = 0.0
      elsif self.x > self.arena.width
        self.x = self.arena.width.to_f
Severity: Minor
Found in lib/rtanque/point.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