TheCorrespondingSquares/chess-app

View on GitHub

Showing 927 of 927 total issues

Block has too many lines. [36/25]
Open

  describe "king#valid_move?" do
    subject(:king_valid_move?) { king.valid_move?(destination_x, destination_y) }

    let(:king) { FactoryGirl.create(:king, color: "Black", x_pos: 4, y_pos: 0, game_id: game.id) }
Severity: Minor
Found in spec/models/king_spec.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [36/25]
Open

  describe "#stalemate?" do
    let(:black_player) { FactoryGirl.create(:user) }
    let(:game_stalemate) { FactoryGirl.create(:game, white_player_id: user.id, black_player_id: black_player.id) } 
    before(:each) { game_stalemate.update_attributes(turn: 43) }
    before(:each) { game_stalemate.pieces.destroy_all }
Severity: Minor
Found in spec/models/game_spec.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [36/25]
Open

    context 'for valid move' do
      context 'there is another piece (same color) on destination square' do
        let!(:pawn2) { FactoryGirl.create(:pawn, color: "White", x_pos: 3, y_pos: 3, game_id: game.id) }
        let(:to_x) { 3 }
        let(:to_y) { 3 }
Severity: Minor
Found in spec/models/pawn_spec.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [34/25]
Open

  describe 'games#show action' do
      let!(:user) { FactoryGirl.create(:user) }
    let!(:user2) { FactoryGirl.create(:user) }
      let!(:game) { FactoryGirl.create(:game, white_player_id: user.id, black_player_id: user2.id) }
      

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Method move_if_possible has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def move_if_possible
    piece = current_piece
    if !@game.game_full?
      redirect_to game_path(piece.game)
    elsif piece.valid_move?(@new_x_pos, @new_y_pos)
Severity: Minor
Found in app/controllers/pieces_controller.rb - About 1 hr to fix

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

      def king_can_be_blocked?
    
        obstruction_path = []
        starting_x = @piece_making_check.x_pos
        starting_y = @piece_making_check.y_pos
    Severity: Minor
    Found in app/services/check_mate.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

    Block has too many lines. [32/25]
    Open

    RSpec.describe Piece, type: :model do
      let(:user) { FactoryGirl.create(:user) }
      let(:game) { FactoryGirl.create(:game, black_player_id: user.id)}
      before(:each) { game.pieces.destroy_all }
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [32/25]
    Open

    RSpec.describe Rook, type: :model do
        let!(:user) { FactoryGirl.create :user }
        let!(:game) { FactoryGirl.create :game, white_player_id: user.id }
        before(:each) {game.pieces.destroy_all}
    
    
    Severity: Minor
    Found in spec/models/rook_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [32/25]
    Open

      describe "queen#valid_move?" do
        subject(:queen_valid_move?) { queen.valid_move?(destination_x, destination_y) }
    
        let!(:queen) { FactoryGirl.create(:queen, color: "White", x_pos: 3, y_pos: 0, game_id: game.id) }
    
    Severity: Minor
    Found in spec/models/queen_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [31/25]
    Open

        context 'When there is a check condition' do
          before(:each) { game.pieces.destroy_all } 
          let!(:white_bishop) { FactoryGirl.create(:bishop, color: "White", x_pos: 4, y_pos: 4, game_id: game.id) }
          let!(:black_bishop) { FactoryGirl.create(:bishop, color: "Black", x_pos: 6, y_pos: 4, game_id: game.id) }
          let!(:black_king) { FactoryGirl.create(:king, color: "Black", x_pos: 7, y_pos: 7, game_id: game.id) }

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [29/25]
    Open

        context 'move and capture' do
          let(:other_piece) { FactoryGirl.create(:knight, color: other_color, x_pos: destination_x, y_pos: destination_y, game_id: game.id) }
    
          context 'capture opponent\'s piece' do
            let(:other_color) { "White" }
    Severity: Minor
    Found in spec/models/piece_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [29/25]
    Open

        context 'not valid move' do
          context '2 squares other than first move' do
            let(:pawn) { FactoryGirl.create(:pawn, color: "White", x_pos: 3, y_pos: 2, game_id: game.id) }
            let(:to_x) { pawn.x_pos }
            let(:to_y) { 4 }
    Severity: Minor
    Found in spec/models/pawn_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [28/25]
    Open

      describe '.available' do
          let!(:user2) { FactoryGirl.create(:user) }
    
        context 'when some games are not available' do
              let!(:game1) { FactoryGirl.create(:game, white_player_id: user.id) }
    Severity: Minor
    Found in spec/models/game_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [27/25]
    Open

    RSpec.describe Bishop, type: :model do
      let(:user) { FactoryGirl.create(:user) }
      let(:game) { FactoryGirl.create(:game, white_player_id: user.id)}
      before(:each) { game.pieces.destroy_all }
    
    
    Severity: Minor
    Found in spec/models/bishop_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [27/25]
    Open

      describe "direction" do
        let(:rook) { FactoryGirl.create(:rook, color: "Black", x_pos: 3, y_pos: 3, game_id: game.id) }
        
        describe "#right_or_left" do
          subject(:right_or_left) { rook.right_or_left(destination_x) }

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [27/25]
    Open

        describe "rook#valid_move?" do
          subject(:rook_valid_move?) { rook.valid_move?(to_x, to_y) }
          let(:rook) { FactoryGirl.create(:rook, x_pos: 0, y_pos: 0, color: 'White', game_id: game.id) }
    
            context "for valid move" do
    Severity: Minor
    Found in spec/models/rook_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [27/25]
    Open

      describe "#can_enpassant?" do
        subject(:enpassant) {pawn.can_enpassant?(to_x, to_y)}
        
        let!(:pawn) {FactoryGirl.create(:pawn, color: "Black", x_pos: 3, y_pos: 3, game_id: game.id)}
        let(:to_x) { 2 }
    Severity: Minor
    Found in spec/models/pawn_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [27/25]
    Open

      describe "#move_leaves_king_in_check?" do
    
        context "for a move that leaves your King in check" do
          it "should return true and leave game unchanged" do
            white_rook = FactoryGirl.create(:rook, color: "White", x_pos: 3, y_pos: 1, game_id: game.id)
    Severity: Minor
    Found in spec/models/piece_spec.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [27/25]
    Open

    FactoryGirl.define do
      # A default queen piece, due to her range of movement (useful for tests)
      factory :piece do
        captured false
      end
    Severity: Minor
    Found in spec/factories/pieces.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    rails-html-sanitizer 1.0.3 is vulnerable (CVE-2018-3741). Upgrade to 1.0.4
    Open

        rails-html-sanitizer (1.0.3)
    Severity: Minor
    Found in Gemfile.lock by brakeman
    Severity
    Category
    Status
    Source
    Language