Function Board
has a Cognitive Complexity of 28 (exceeds 10 allowed). Consider refactoring.
const Board = () => {
const { G, ctx, moves, players, player, playerID } = useBoardGame();
const [selectedCard, setSelectedCard] = useState(null);
const [availableBonuses, setAvailableBonuses] = useState(null);
const [loading, setLoading] = useState(null);
Function Board
has a Cognitive Complexity of 26 (exceeds 10 allowed). Consider refactoring.
const Board = () => {
const {
G,
ctx: { phase, gameover },
players,
Function Board
has 195 lines of code (exceeds 150 allowed). Consider refactoring.
const Board = () => {
const { G, ctx, moves, players, player, playerID } = useBoardGame();
const [selectedCard, setSelectedCard] = useState(null);
const [availableBonuses, setAvailableBonuses] = useState(null);
const [loading, setLoading] = useState(null);
Function TokensShop
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
const TokensShop = ({ tokens, active, loading, onTakeTokens, playerTokensCount }) => {
const [selected, setSelected] = useState({ ...emptyTokens });
const tooMuchTokens = sum(Object.values(selected)) + playerTokensCount >= 10;
Consider simplifying this complex logical expression.
if (user && user.displayName) {
return <Redirect to={from || routes.lobby()} />;
} else {
return (
<>
Function StartGame
has 7 arguments (exceeds 5 allowed). Consider refactoring.
function StartGame(G, ctx, gameMode, maxPoints, language, category, timePerTurn) {
Function leaveGame
has 6 arguments (exceeds 5 allowed). Consider refactoring.
function leaveGame(gameName, matchID, playerID, playerUID, credentials, history) {
Function DrawArea
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
const DrawArea = ({ lines, onLinesUpdate }) => {
const [isDrawing, setIsDrawing] = useState(false);
const [penColor, setPenColor] = useState("#1b1c1d");
const [penSize, setPenSize] = useState(3);
const {
Function FilterBox
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
const FilterBox = ({ games, filters, onChange }) => {
const { t } = useTranslation("lobby");
const [open, setOpen] = useState(false);
const searchRef = useRef();