hexlet-codebattle/codebattle

View on GitHub

Showing 200 of 693 total issues

File Room.js has 1065 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import axios from 'axios';
import Gon from 'gon';
import { camelizeKeys, decamelizeKeys } from 'humps';
import debounce from 'lodash/debounce';
import find from 'lodash/find';
Severity: Major
Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js - About 2 days to fix

    Function BuilderExampleForm has 276 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function BuilderExampleForm() {
      const dispatch = useDispatch();
      const { taskService } = useContext(RoomContext);
    
      const argumentsTabRef = useRef(null);

      Function BuilderEditorsWidget has 202 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function BuilderEditorsWidget() {
        const dispatch = useDispatch();
        const { taskService } = useContext(RoomContext);
      
        const [assertsPanelShowing, setAssertsPanelShowing] = useState(false);

        Function UserProfile has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function UserProfile() {
          const [userData, setUserData] = useState(null);
          const dispatch = useDispatch();
        
          useEffect(() => {

          File LobbyWidget.jsx has 414 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, {
            useState,
            useRef,
            useEffect,
            useCallback,

            Function UsersRating has 146 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function UsersRating() {
              const usersRatingPage = useSelector(usersListSelector);
              const dispatch = useDispatch();
            
              const {

              Function reduceOriginalRecords has 138 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const reduceOriginalRecords = (acc, record, index) => {
                const {
                  players, records, chat: chatState, type: playbookType,
                } = acc;
                const { messages, users } = chatState;
              Severity: Major
              Found in services/app/apps/codebattle/assets/js/widgets/lib/player.js - About 5 hrs to fix

                File index.js has 387 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { createDraftSafeSelector } from '@reduxjs/toolkit';
                import find from 'lodash/find';
                import get from 'lodash/get';
                import isUndefined from 'lodash/isUndefined';
                import pick from 'lodash/pick';
                Severity: Minor
                Found in services/app/apps/codebattle/assets/js/widgets/selectors/index.js - About 5 hrs to fix

                  File game.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { assign, actions } from 'xstate';
                  
                  import { channelTopics } from '../../socket';
                  import GameStateCodes from '../config/gameStateCodes';
                  import speedModes from '../config/speedModes';
                  Severity: Minor
                  Found in services/app/apps/codebattle/assets/js/widgets/machines/game.js - About 5 hrs to fix

                    File EventRatingPanel.jsx has 369 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, {
                      useState,
                      useEffect,
                      useCallback,
                    } from 'react';

                      Function Leaderboard has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function Leaderboard() {
                        const dispatch = useDispatch();
                      
                        const { users, period } = useSelector(leaderboardSelector);
                      
                      

                        File TournamentHeader.jsx has 359 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, { memo, useContext, useMemo } from 'react';
                        
                        import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
                        import cn from 'classnames';
                        import i18next from 'i18next';

                          File Tournament.jsx has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, {
                           useState, useCallback, useEffect, useMemo,
                          } from 'react';
                          
                          import { useInterpret } from '@xstate/react';

                            Function ChatContextMenu has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function ChatContextMenu({
                              request = {
                                user: {
                                  name: null,
                                  userId: null,

                            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 LobbyWidget has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const LobbyWidget = () => {
                              const currentOpponent = Gon.getAsset('opponent');
                            
                              const dispatch = useDispatch();
                            
                            

                              Function BuilderStatus has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function BuilderStatus() {
                                const { taskService } = useContext(RoomContext);
                              
                                const taskMachineState = useMachineStateSelector(taskService, taskStateSelector);
                              
                              

                                File initial.js has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import Gon from 'gon';
                                import { camelizeKeys } from 'humps';
                                
                                import GameRoomModes from '../config/gameModes';
                                import GameStateCodes from '../config/gameStateCodes';
                                Severity: Minor
                                Found in services/app/apps/codebattle/assets/js/widgets/slices/initial.js - About 3 hrs to fix

                                  Function InvitesContainer has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function InvitesContainer() {
                                    const dispatch = useDispatch();
                                  
                                    const followId = useSelector(state => state.gameUI.followId);
                                    const followPaused = useSelector(state => state.gameUI.followPaused);

                                    Function TournamentStatisticsModal has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const TournamentStatisticsModal = NiceModal.create(() => {
                                      const modal = useModal(ModalCodes.tournamentStatisticsModal);
                                    
                                      const gameId = useSelector(gameIdSelector);
                                      const tournament = useSelector(tournamentSelector);

                                      File TaskParamsModal.jsx has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      import React, {
                                       useState, useCallback, memo, useMemo, useEffect, useRef,
                                      } from 'react';
                                      
                                      import NiceModal, { useModal } from '@ebay/nice-modal-react';
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language