Showing 40 of 76 total issues
Function parse
has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring. Open
def parse(input_str, shogi):
"""
parse input text and get (from, to) Coordinate.
"""
is_first_turn = shogi.first
- 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 movable
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def movable(self, from_x, from_y, to_x, to_y, promote):
board = self.board
from_koma = board[from_y][from_x]
to_koma = board[to_y][to_x]
- 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 droppable
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def droppable(self, koma, to_x, to_y):
if self.first:
tegoma = self.first_tegoma
else:
tegoma = self.second_tegoma
- 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 shogi.py
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
from enum import IntEnum
class Koma(IntEnum):
empty = 0
Function make_board_info_text
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def make_board_info_text(board_info, reverse=False):
return_text = ""
x_labels = [1, 2, 3, 4, 5, 6, 7, 8, 9]
y_labels = [9, 8, 7, 6, 5, 4, 3, 2, 1]
- 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 make_user_text
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def make_user_text(user_name, motigoma,
is_first=True, is_turn=True, reverse=False):
return_text = ""
if is_turn:
return_text = "[手番]"
- 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 koma_move
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def koma_move(channel, message, position, dou, koma, sub_position=None, promote=None):
Function add
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add(self, from_x, from_y, to_x, to_y, promote, koma):
Function checkObstacle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def checkObstacle(self, from_x, from_y, to_x, to_y):
if self.board[from_y][from_x].is_keima():
return True
while True:
to_x = _approach(from_x, to_x)
- 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
Consider simplifying this complex logical expression. Open
if (turn and t[0] > to_x and t[1] < to_y) or \
(not turn and t[0] < to_x and t[1] > to_y):
from_x, from_y = t
from_flag = 0
break
Consider simplifying this complex logical expression. Open
if (turn and t[0] > to_x and t[1] > to_y) or \
(not turn and t[0] < to_x and t[1] < to_y):
from_x, from_y = t
from_flag = 0
break
Consider simplifying this complex logical expression. Open
if (turn and t[0] < to_x and t[1] < to_y) or \
(not turn and t[0] > to_x and t[1] > to_y):
from_x, from_y = t
from_flag = 0
break
Consider simplifying this complex logical expression. Open
if (turn and t[0] < to_x and t[1] > to_y) or \
(not turn and t[0] > to_x and t[1] < to_y):
from_x, from_y = t
from_flag = 0
break
Function input_emojis
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def input_emojis(id_, password, team_id, two_factor, force_update=False):
Function make_user_text
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_user_text(user_name, motigoma,
Function move
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def move(self, from_x, from_y, to_x, to_y, promote):
Function basic_move
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def basic_move(channel_id, from_x, from_y, to_x, to_y, promote):
Function movable
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def movable(self, from_x, from_y, to_x, to_y, promote):
Function move
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def move(self, from_x, from_y, to_x, to_y, promote):
Function koma_is_movable
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def koma_is_movable(channel_id, user_id, position, koma, sub_position, promote):