hexlet-codebattle/codebattle

View on GitHub

Showing 200 of 693 total issues

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

const initGameChannel = (gameRoomService, waitingRoomService) => dispatch => {
  const onJoinFailure = payload => {
    gameRoomService.send('REJECT_LOADING_GAME', { payload });
    gameRoomService.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 EventWidget has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function EventWidget() {
          // const searchParams = useSearchParams();
          useEventWidgetModals();
        
          const {

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

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

              const iconRenderers = {
                clojure: className => <ClojureOriginalIcon className={className} size="1.125em" />,
                cpp: className => <CppOriginalIcon className={className} size="1.25em" />,
                csharp: className => <CsharpOriginalIcon className={className} size="1.25em" />,
                dart: className => <DartOriginalIcon className={className} size="1.125em" />,

                Function handleEditorDidMount has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const handleEditorDidMount = (currentEditor, currentMonaco) => {
                    setEditor(currentEditor);
                    setMonaco(currentMonaco);
                
                    const {
                Severity: Major
                Found in services/app/apps/codebattle/assets/js/widgets/utils/useEditor.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 SignUp has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function SignUp() {
                      const formik = useFormik({
                        initialValues: {
                          name: '',
                          email: '',

                      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 EditorContainer has a Cognitive Complexity of 17 (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 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

                        Function initInvites has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function SignIn has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function SignIn() {
                            const formik = useFormik({
                              initialValues: {
                                email: '',
                                password: '',

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

                                  const useEditor = props => {
                                    const [editor, setEditor] = useState();
                                    const [monaco, setMonaco] = useState();
                                    // const convertRemToPixels = rem => rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
                                    // this.statusBarHeight = lineHeight = current fontSize * 1.5
                                  Severity: Minor
                                  Found in services/app/apps/codebattle/assets/js/widgets/utils/useEditor.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language