Showing 43 of 71 total issues
Function incomplete_alg
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def incomplete_alg(alg_str, input_color, position):
"""
Converts a string written in short algebraic form into an incomplete move.
These incomplete moves do not have the initial location specified and
therefore cannot be used to update the board. IN order to fully utilize
- Read upRead up
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
File board.py
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
Constructs board object which stores the get_location of all the pieces.
File converter.py
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
Methods that take external input and attempt
to turn them into usable commands.
Function in_check
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def in_check(self, position, location=None):
"""
Finds if the king is in check or if both kings are touching.
:type: position: Board
- Read upRead up
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
Board
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Board:
"""
Standard starting position in a chess game.
Initialized upon startup and is used when init_default constructor is used
Function _get_piece_start_location
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _get_piece_start_location(end_location,
input_color,
piece_in_move,
position,
start_rank=None,
- Read upRead up
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
Function _calc_all_possible_moves
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _calc_all_possible_moves(self, input_color):
"""
Returns list of all possible moves
:type: input_color: Color
- Read upRead up
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
Location
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Location:
def __init__(self, rank, file):
"""
Creates a location on a chessboard given x and y coordinates.
Function update
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update(self, move):
"""
Updates position by applying selected move
:type: move: Move
- Read upRead up
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
Function no_moves
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def no_moves(self, input_color):
# Loops through columns
for piece in self:
- Read upRead up
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
Function possible_moves
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def possible_moves(self, position):
"""
Finds all possible knight moves
:type: position Board
:rtype: list
- Read upRead up
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
Function forward_moves
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def forward_moves(self, position):
"""
Finds possible moves one step and two steps in front
of Pawn.
- Read upRead up
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
Function val
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def val(self, piece, ref_color):
"""
Finds value of ``Piece``
:type: piece: Piece
- Read upRead up
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
Function play
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def play(self):
"""
Starts game and returns one of 3 results .
Iterates between methods ``white_move()`` and
``black_move()`` until game ends. Each
- Read upRead up
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
Function _get_piece_start_location
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_piece_start_location(end_location,
Avoid deeply nested control flow statements. Open
if type(en_passant_pawn) is Pawn and \
en_passant_pawn.color != input_color and \
position.is_square_empty(end_location):
return Move(end_loc=end_location,
piece=position.piece_at_square(pawn_location),
Function init_manual
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def init_manual(cls, pawn_value, knight_value, bishop_value, rook_value, queen_value, king_value):
Function add_castle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_castle(self, position):
"""
Adds kingside and queenside castling moves if legal
:type: position: Board
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if move.end_loc == location:
return True
else:
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,