hexlet-codebattle/codebattle

View on GitHub

Showing 200 of 693 total issues

Function StairwayGameContainer has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function StairwayGameContainer() {
  const dispatch = useDispatch();

  const meta = useSelector(state => state.tournament?.tournament?.meta);
  const activeMatch = useSelector(state => state.tournament?.activeMatch);

    Function BuilderSettingsWidget has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function BuilderSettingsWidget() {
      const dispatch = useDispatch();
    
      const task = useSelector(selectors.builderTaskSelector);
      const {

      Function PremiumRestrictionModal has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const PremiumRestrictionModal = NiceModal.create(() => {
        const dispatch = useDispatch();
      
        const [sended, setSended] = useState(false);
        const modal = useModal(ModalCodes.premiumRestrictionModal);

        Function useMatchesStatistics has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function useMatchesStatistics(playerId, matches) {
          return useMemo(() => {
            if (!matches || (matches.length === 0 && playerId)) {
              return [emptyStats, emptyStats];
            }

          Function buildTaskAsserts has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const buildTaskAsserts = taskService => (dispatch, getState) => {
            const state = getState();
          
            if (state.builder.templates.state !== taskTemplatesStates.init) {
              dispatch(
          Severity: Major
          Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js - About 3 hrs to fix

            Function useEditor has 81 lines of code (exceeds 25 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: Major
            Found in services/app/apps/codebattle/assets/js/widgets/utils/useEditor.js - About 3 hrs to fix

              Function TournamentClanTable has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function TournamentClanTable() {
                const currentUserClanId = useSelector(currentUserClanIdSelector);
                const { clans, ranking, rankingType } = useSelector(tournamentSelector);
              
                const items = Array.isArray(ranking) ? ranking : ranking?.entries;

                File TournamentAdminWidget.jsx has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  File BuilderExampleForm.jsx has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, {
                    useRef,
                    useState,
                    useCallback,
                    memo,

                    File player.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import find from 'lodash/find';
                    import partition from 'lodash/partition';
                    import Delta from 'quill-delta';
                    
                    import PlaybookStatusCodes from '../config/playbookStatusCodes';
                    Severity: Minor
                    Found in services/app/apps/codebattle/assets/js/widgets/lib/player.js - About 3 hrs to fix

                      File Registration.jsx has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import React, { useState } from 'react';
                      
                      import axios from 'axios';
                      import cn from 'classnames';
                      import { useFormik } from 'formik';

                        Function connectToTournament has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const connectToTournament = (waitingRoomMachine, newTournamentId) => dispatch => {
                          setTournamentChannel(newTournamentId);
                          initTournamentChannel(waitingRoomMachine, channel)(dispatch);
                        
                          const handleUpdate = response => {

                          Function useCursorUpdates has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const useCursorUpdates = (editor, monaco, props) => {
                            const params = useMemo(
                              () => pick(props, ['userId', 'roomMode']),
                          
                              // eslint-disable-next-line react-hooks/exhaustive-deps

                            Function connectToTournament has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const connectToTournament = (_machine, newTournamentId) => dispatch => {
                              setTournamentChannel(newTournamentId);
                              initTournamentChannel(dispatch);
                            
                              const handleUpdate = response => {

                              Function run has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              exports.run = function run(args = [], count) {
                                let output = '';
                                let oldConsole = console;
                              
                                const fakeStream = new Writable();
                              Severity: Major
                              Found in services/app/apps/runner/dockers/js/assertsRunner.js - About 2 hrs to fix

                                Function run has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const run = function run(args = []) {
                                  let output = '';
                                  const fakeStream = new Writable();
                                  const myConsole = new Console(fakeStream);
                                
                                
                                Severity: Major
                                Found in services/app/apps/runner/dockers/js/checker.js - About 2 hrs to fix

                                  File RubyOriginalIcon.jsx has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  /* eslint-disable max-len */
                                  import React from 'react';
                                  
                                  const RubyOriginalIcon = ({ className, size = '1em' }) => (
                                    <svg viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg" className={className} style={{ width: size, height: size }}>

                                    File BuilderEditorsWidget.jsx has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import React, {
                                      useState,
                                      useContext,
                                      useCallback,
                                      memo,

                                      Function RatingPanel has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function RatingPanel({
                                        searchedUser,
                                        roundsLimit,
                                        currentRoundPosition,
                                        matches,

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

                                      function ChatWidget() {
                                        const { mainService } = useContext(RoomContext);
                                      
                                        const users = useSelector(selectors.chatUsersSelector);
                                        const messages = useSelector(selectors.chatMessagesSelector);
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language