Showing 187 of 662 total issues
Function ReplayerControlButton
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ReplayerControlButton() {
const dispatch = useDispatch();
const { mainService } = useContext(RoomContext);
const roomMachineState = useMachineStateSelector(mainService, roomStateSelector);
const isPreviewRoom = inPreviewRoomSelector(roomMachineState);
Function EventWidget
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EventWidget() {
// const searchParams = useSearchParams();
useEventWidgetModals();
const {
builder
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
reducers: {
setTask: (state, { payload: { task } }) => {
state.task = { ...state.task, ...task };
state.templates = getTaskTemplates(task);
File TournamentGameCreatePanel.jsx
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {
useState, useCallback, useEffect, useMemo,
} from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
Function SignIn
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SignIn() {
const formik = useFormik({
initialValues: {
email: '',
password: '',
Function ChatInput
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export default function ChatInput({ inputRef, disabled = false }) {
const [isPickerVisible, setPickerVisibility] = useState(false);
const [isMaxLengthExceeded, setMaxLengthExceeded] = useState(false);
const [isTooltipVisible, setTooltipVisibility] = useState(false);
const [text, setText] = useState('');
- 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 EditorContainer
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function EditorContainer({
id,
editorMachine,
type,
orientation,
- 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 editorsPanelOptionsSelector
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const editorsPanelOptionsSelector = (viewMode, roomMachineState) => state => {
const currentUserId = currentUserIdSelector(state);
const editorsMode = editorsModeSelector(state);
const theme = editorsThemeSelector(state);
Function initInvites
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const initInvites = currentUser => dispatch => {
const onJoinSuccess = () => {
channel.on(channelTopics.invitesInitTopic, data => {
if (data.invites.length > 0) {
const message = getSystemMessage({ text: `You have (${data.invites.length}) invites to battle. Check ` });
File PlayerStatsPanel.jsx
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {
memo, useMemo, useState,
} from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
Function ResetPassword
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ResetPassword() {
const [isSend, setIsSend] = useState(false);
const formik = useFormik({
initialValues: {
Function editorsPanelOptionsSelector
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const editorsPanelOptionsSelector = (viewMode, roomMachineState) => state => {
const currentUserId = currentUserIdSelector(state);
const editorsMode = editorsModeSelector(state);
const theme = editorsThemeSelector(state);
- 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 GameActionButton
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function GameActionButton({
type = 'table', game, currentUserId, isGuest, isOnline,
}) {
const gameUrl = makeGameUrl(game.id);
const gameUrlJoin = makeGameUrl(game.id, 'join');
- 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 CreateGameDialog.test.jsx
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import { configureStore, combineReducers } from '@reduxjs/toolkit';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
Function onJoinSuccess
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onJoinSuccess = () => {
channel.on(channelTopics.invitesInitTopic, data => {
if (data.invites.length > 0) {
const message = getSystemMessage({ text: `You have (${data.invites.length}) invites to battle. Check ` });
setTimeout(() => dispatch(actions.newChatMessage(message)), 100);
Consider simplifying this complex logical expression. Open
if (
player.score > opponent.score
|| (player.score === opponent.score
&& player.winMatches.length > opponent.winMatches.length)
|| (player.winMatches.length === opponent.winMatches.length
Function TournamentClanTable
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function TournamentClanTable() {
const currentUserClanId = useSelector(currentUserClanIdSelector);
const { clans, ranking } = useSelector(tournamentSelector);
if (!ranking || !ranking.entries || ranking.entries.length === 0) {
Consider simplifying this complex logical expression. Open
if (
player.score > opponent.score
|| (player.score === opponent.score
&& player.winMatches.length > opponent.winMatches.length)
|| (player.winMatches.length === opponent.winMatches.length
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { recordsCount, mainEvents, roomMachineState } = this.props;
const {
isEnabled, direction, handlerPosition, lastIntent, nextRecordId,
Function fetchState
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fetchState = currentUserId => dispatch => {
const camelizeKeysAndDispatch = actionCreator => data => dispatch(actionCreator(camelizeKeys(data)));
channel.join().receive('ok', camelizeKeysAndDispatch(actions.initGameList));