TheCorrespondingSquares/chess-app

View on GitHub
app/models/knight.rb

Summary

Maintainability
A
0 mins
Test Coverage

Final newline missing.
Open

end
Severity: Minor
Found in app/models/knight.rb by rubocop

Inconsistent indentation detected.
Open

  def knight_move_wide?(to_x, to_y)
    (starting_point_x - to_x).abs == 2 && (starting_point_y - to_y).abs == 1
  end
Severity: Minor
Found in app/models/knight.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Extra empty line detected at class body end.
Open


end
Severity: Minor
Found in app/models/knight.rb by rubocop

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Inconsistent indentation detected.
Open

  def valid_move?(to_x, to_y)    
    return false if friendly_piece_on_square?(to_x, to_y)
    knight_move_wide?(to_x, to_y) || knight_move_tall?(to_x, to_y)
  end
Severity: Minor
Found in app/models/knight.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Trailing whitespace detected.
Open

  def valid_move?(to_x, to_y)    
Severity: Minor
Found in app/models/knight.rb by rubocop

Use 2 (not 0) spaces for indentation.
Open

after_create :icon
Severity: Minor
Found in app/models/knight.rb by rubocop

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Inconsistent indentation detected.
Open

  def knight_move_tall?(to_x, to_y)
    (starting_point_x - to_x).abs == 1 && (starting_point_y - to_y).abs == 2
  end
Severity: Minor
Found in app/models/knight.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Missing top-level class documentation comment.
Open

class Knight < Piece
Severity: Minor
Found in app/models/knight.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Inconsistent indentation detected.
Open

  def icon
    # if color == "White"
    #   '&#9816;'
    # else
    #   '&#9822;'
Severity: Minor
Found in app/models/knight.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

There are no issues that match your filters.

Category
Status