hexlet-codebattle/codebattle

View on GitHub

Showing 187 of 662 total issues

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

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

  const task = useSelector(selectors.builderTaskSelector);
  const {

    File TaskParamsModal.jsx has 312 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';

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

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

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

        import React, {
          useState,
          useCallback,
          useEffect,
          useMemo,

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

          export const connectToTournament = () => dispatch => {
            initTournamentChannel(dispatch);
          
            const oldChannel = channel;
          
          

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

              export const buildTaskAsserts = taskMachine => (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 useMatchesStatistics has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

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

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

                    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

                        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 BuilderEditorsWidget.jsx has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

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

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

                              function InvitesContainer() {
                                const currentUserId = useSelector(selectors.currentUserIdSelector);
                                const checkInvitePlayers = ({ creatorId, recipientId }) => creatorId === currentUserId || recipientId === currentUserId;
                                const filterInvites = invite => invite.state === 'pending' && checkInvitePlayers(invite);
                                const invites = useSelector(invitesSelectors.selectAll).filter(filterInvites);

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

                                  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 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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language