LordDarkula/chess_py

View on GitHub

Showing 43 of 71 total issues

Function _one_diagonal_capture_square has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _one_diagonal_capture_square(self, capture_square, position):
        """
        Adds specified diagonal as a capture move if it is one
        """
        if self.contains_opposite_color_piece(capture_square, position):
Severity: Minor
Found in chess_py/pieces/pawn.py - About 35 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

Function __str__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __str__(self):
        board_string = ""
        for i, row in enumerate(self.position):
            board_string += str(8 - i) + " "
            for j, square in enumerate(row):
Severity: Minor
Found in chess_py/core/board.py - About 35 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

Function make_legal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def make_legal(move, position):
    """
    Converts an incomplete move (initial ``Location`` not specified)
    and the corresponding position into the a complete move
    with the most likely starting point specified. If no moves match, ``None``
Severity: Minor
Found in chess_py/core/algebraic/converter.py - About 35 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

Function __eq__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __eq__(self, other):
        if not isinstance(other, self.__class__):
            raise TypeError("Cannot compare other type to Board")

        for i, row in enumerate(self.position):
Severity: Minor
Found in chess_py/core/board.py - About 35 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

Function moves_in_direction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def moves_in_direction(self, direction, position):
        """
        Finds moves in a given direction

        :type: direction: lambda
Severity: Minor
Found in chess_py/pieces/rook.py - About 35 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

Avoid too many return statements within this function.
Open

            return self.KING_VALUE * const
Severity: Major
Found in chess_py/pieces/piece_const.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return 0
    Severity: Major
    Found in chess_py/pieces/piece_const.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return Move(end_loc=end_location,
      Severity: Major
      Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return Move(end_loc=end_location,
        Severity: Major
        Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return self.ROOK_VALUE * const
          Severity: Major
          Found in chess_py/pieces/piece_const.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return self.KNIGHT_VALUE * const
            Severity: Major
            Found in chess_py/pieces/piece_const.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return Move(end_loc=end_location,
              Severity: Major
              Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return Move(end_loc=promote_capture_end_loc,
                Severity: Major
                Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return Move(end_loc=end_location,
                  Severity: Major
                  Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return Move(end_loc=end_location,
                    Severity: Major
                    Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return Move(end_loc=end_location,
                      Severity: Major
                      Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return Move(end_loc=end_location,
                        Severity: Major
                        Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                  return Move(end_loc=end_location,
                          Severity: Major
                          Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return Move(end_loc=end_location,
                            Severity: Major
                            Found in chess_py/core/algebraic/converter.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return Move(end_loc=promote_end_loc,
                              Severity: Major
                              Found in chess_py/core/algebraic/converter.py - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language