hexlet-codebattle/codebattle

View on GitHub

Showing 197 of 680 total issues

Function initGameChannel has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const initGameChannel = (gameRoomMachine, waitingRoomMachine, currentChannel) => dispatch => {
  const onJoinFailure = payload => {
    gameRoomMachine.send('REJECT_LOADING_GAME', { payload });
    gameRoomMachine.send('FAILURE_JOIN', { payload });
    window.location.reload();
Severity: Major
Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js - About 2 hrs to fix

    Function TaskConfigurationModal has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const TaskConfigurationModal = NiceModal.create(() => {
      const dispatch = useDispatch();
    
      const visibilityInputRef = useRef(null);
    
    

      Method main has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public static void main(String... _args) {
          PrintStream _oldOut = System.out;
          List<AssertResult> executionResults_ = new ArrayList<AssertResult>();
      
          try {
      Severity: Major
      Found in services/app/apps/runner/dockers/java/check/Checker.java - About 2 hrs to fix

        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 EditorContainer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          function EditorContainer({
            id,
            editorMachine,
            type,
            orientation,

          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 TournamentHeader has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          function TournamentHeader({
            id: tournamentId,
            state,
            streamMode,
            breakState,

          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

          builder has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

            reducers: {
              setTask: (state, { payload: { task } }) => {
                state.task = { ...state.task, ...task };
          
                state.templates = getTaskTemplates(task);
          Severity: Minor
          Found in services/app/apps/codebattle/assets/js/widgets/slices/builder.js - About 2 hrs to fix

            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('');

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

                export const initInvites = currentUserId => 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 ` });
                Severity: Major
                Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Invite.js - About 2 hrs to fix

                  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);
                  
                  
                  Severity: Major
                  Found in services/app/apps/codebattle/assets/js/widgets/selectors/index.js - About 2 hrs to fix

                    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';

                      File BuilderActions.jsx has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { useCallback, useContext } from 'react';
                      
                      import NiceModal from '@ebay/nice-modal-react';
                      import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
                      import { useDispatch, useSelector } from 'react-redux';

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

                          const TournamentAwardModal = NiceModal.create(params => {
                            const onlyShowAward = params?.onlyShowAward || false;
                          
                            const gameStatus = useSelector(gameStatusSelector);
                            const award = useSelector(gameAwardSelector);

                            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);
                            
                            
                            Severity: Minor
                            Found in services/app/apps/codebattle/assets/js/widgets/selectors/index.js - About 2 hrs to fix

                            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');

                            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);
                              Severity: Major
                              Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Invite.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language