hexlet-codebattle/codebattle

View on GitHub

Showing 693 of 693 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const declineInvite = (id, opponentName) => dispatch => channel
  .push(channelMethods.invitesCancel, { id })
  .receive('ok', data => {
    const message = getSystemMessage({ text: `You decline battle invite [Opponent ${opponentName}]` });
    dispatch(actions.newChatMessage(message));
services/app/apps/codebattle/assets/js/widgets/middlewares/Invite.js on lines 130..141

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 164.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    <linearGradient
      id="ruby-original-d"
      gradientUnits="userSpaceOnUse"
      x1="74.817"
      y1="2435.622"
services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 65..80
services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 81..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    <linearGradient
      id="ruby-original-f"
      gradientUnits="userSpaceOnUse"
      x1="140.691"
      y1="2497.523"
services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 49..64
services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 65..80

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    <linearGradient
      id="ruby-original-e"
      gradientUnits="userSpaceOnUse"
      x1="109.719"
      y1="2466.413"
services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 49..64
services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 81..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

              const { findByText } = setup(
                <Provider store={store}>
                  <NiceModal.Provider>
                    <RootContainer
                      pageName="game"
            services/app/apps/codebattle/assets/js/__tests__/RootContainer.test.jsx on lines 227..239
            services/app/apps/codebattle/assets/js/__tests__/RootContainer.test.jsx on lines 259..271

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 138.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

              const { findByRole, user } = setup(
                <Provider store={store}>
                  <NiceModal.Provider>
                    <RootContainer
                      pageName="game"
            services/app/apps/codebattle/assets/js/__tests__/RootContainer.test.jsx on lines 204..216
            services/app/apps/codebattle/assets/js/__tests__/RootContainer.test.jsx on lines 259..271

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 138.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

              const { findByLabelText, findByTitle, user } = setup(
                <Provider store={store}>
                  <NiceModal.Provider>
                    <RootContainer
                      pageName="game"
            services/app/apps/codebattle/assets/js/__tests__/RootContainer.test.jsx on lines 204..216
            services/app/apps/codebattle/assets/js/__tests__/RootContainer.test.jsx on lines 227..239

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 138.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

              Similar blocks of code found in 6 locations. Consider refactoring.
              Open

                  <linearGradient
                    id="ruby-original-g"
                    gradientUnits="userSpaceOnUse"
                    x1="123.6"
                    y1="2506.018"
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 6..20
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 112..126
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 147..161
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 216..230
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 231..245

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 137.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 6 locations. Consider refactoring.
              Open

                  <linearGradient
                    id="ruby-original-j"
                    gradientUnits="userSpaceOnUse"
                    x1="111.507"
                    y1="2409.102"
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 6..20
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 97..111
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 112..126
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 216..230
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 231..245

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 137.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 6 locations. Consider refactoring.
              Open

                  <linearGradient
                    id="ruby-original-h"
                    gradientUnits="userSpaceOnUse"
                    x1="53.674"
                    y1="2444.028"
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 6..20
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 97..111
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 147..161
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 216..230
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 231..245

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 137.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 6 locations. Consider refactoring.
              Open

                  <linearGradient
                    id="ruby-original-a"
                    gradientUnits="userSpaceOnUse"
                    x1="157.08"
                    y1="2382.05"
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 97..111
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 112..126
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 147..161
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 216..230
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 231..245

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 137.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 6 locations. Consider refactoring.
              Open

                  <linearGradient
                    id="ruby-original-o"
                    gradientUnits="userSpaceOnUse"
                    x1="67.509"
                    y1="2393.115"
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 6..20
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 97..111
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 112..126
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 147..161
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 231..245

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 137.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 6 locations. Consider refactoring.
              Open

                  <linearGradient
                    id="ruby-original-p"
                    gradientUnits="userSpaceOnUse"
                    x1="145.272"
                    y1="2507.076"
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 6..20
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 97..111
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 112..126
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 147..161
              services/app/apps/codebattle/assets/js/widgets/components/icons/RubyOriginalIcon.jsx on lines 216..230

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 137.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  updateEditorLang: (state, { payload }) => {
                    state.activeGames = state.activeGames.map(game => {
                      if (game.id === payload.gameId) {
                        const newPlayers = game.players.map(player => (
                          player.id === payload.userId
              services/app/apps/codebattle/assets/js/widgets/slices/lobby.js on lines 55..67

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 135.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language