Showing 200 of 693 total issues
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 ResetPassword
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ResetPassword() {
const [isSend, setIsSend] = useState(false);
const formik = useFormik({
initialValues: {
Function onJoinSuccess
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onJoinSuccess = () => {
channel.addListener(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 render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { recordsCount, mainEvents, roomMachineState } = this.props;
const {
isEnabled, direction, handlerPosition, lastIntent, nextRecordId,
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 AnimationModal
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AnimationModal = NiceModal.create(() => {
const modal = useModal(ModalCodes.gameResultModal);
const players = useSelector(state => gamePlayersSelector(state));
const currentUserId = useSelector(state => currentUserIdSelector(state));
Function onJoinSuccess
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onJoinSuccess = response => {
if (response.error) {
console.error(response.error);
return;
}
Function addCursorListeners
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addCursorListeners = (params, onChangePosition, onChangeSelection) => {
const {
roomMode,
userId,
} = params;
Function handleUserJoined
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleUserJoined = data => {
const {
state, startsAt, timeoutSeconds, langs, players, task,
} = data;
Function fetchState
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fetchState = currentUserId => dispatch => {
const channelName = 'lobby';
channel.setupChannel(channelName);
const camelizeKeysAndDispatch = actionCreator => data => dispatch(actionCreator(camelizeKeys(data)));
Function TournamentChat
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function TournamentChat() {
const currentUserIsAdmin = useSelector(selectors.currentUserIsAdminSelector);
const messages = useSelector(selectors.chatMessagesSelector);
const users = useSelector(selectors.chatUsersSelector);
const isOnline = useSelector(selectors.chatChannelStateSelector);
Method Test
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void Test(bool success)
{
TextWriter oldOut = Console.Out;
StringBuilder sb = new StringBuilder();
TextWriter newOut = new StringWriter(sb);
Function TournamentGameCreatePanel
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function TournamentGameCreatePanel({
players,
matches,
taskList = [],
currentRoundPosition,
- 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 TournamentMatchBadge
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function TournamentMatchBadge({ matchState, isWinner, currentUserIsPlayer }) {
const title = useMemo(() => {
switch (matchState) {
case MatchStatesCodes.pending:
return 'Next';
- 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 run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const run = function run(args = []) {
let output = '';
const fakeStream = new Writable();
const myConsole = new Console(fakeStream);
- 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 GameRoomLockPanel
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function GameRoomLockPanel() {
const dispatch = useDispatch();
const inputRef = useRef(null);
Function GameResult
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function GameResult() {
const currentUserId = useSelector(state => selectors.currentUserIdSelector(state));
const players = useSelector(state => selectors.gamePlayersSelector(state));
const isCurrentUserPlayer = hasIn(players, currentUserId);
const gameStatus = useSelector(state => selectors.gameStatusSelector(state));