hexlet-codebattle/codebattle

View on GitHub
services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js

Summary

Maintainability
F
4 days
Test Coverage

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

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

  const oldChannel = channel;

    File TournamentAdmin.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import axios from 'axios';
    import Gon from 'gon';
    import { camelizeKeys, decamelizeKeys } from 'humps';
    import compact from 'lodash/compact';
    import groupBy from 'lodash/groupBy';

      Function connectToTournament has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

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

      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

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

      export const uploadPlayers = playerIds => (dispatch, getState) => {
        const state = getState();
      
        const { isLive, id } = state.tournament;
      
      
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 186..213

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

      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 2 locations. Consider refactoring.
      Open

        const handleUpdate = response => {
          dispatch(actions.updateTournamentData(response.tournament));
          dispatch(actions.updateTournamentPlayers(compact(response.players || [])));
          dispatch(actions.updateTournamentMatches(compact(response.matches || [])));
          if (response.tasksInfo) {
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 72..79

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

      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 2 locations. Consider refactoring.
      Open

      export const requestMatchesByPlayerId = userId => dispatch => {
        channel
          .push('tournament:matches:request', { player_id: userId })
          .receive('ok', data => {
            dispatch(actions.updateTournamentMatches(data.matches));
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 215..223

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

      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 2 locations. Consider refactoring.
      Open

        const handleRoundFinished = response => {
          dispatch(
            actions.updateTournamentData({
              ...response.tournament,
              topPlayerIds: response.topPlayerIds,
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 93..105

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

      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 2 locations. Consider refactoring.
      Open

        const handleTournamentRestarted = response => {
          dispatch(
            actions.setTournamentData({
              ...response.tournament,
              channel: { online: true },
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 107..118

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

      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 2 locations. Consider refactoring.
      Open

        const handleMatchUpserted = response => {
          dispatch(actions.updateTournamentMatches(compact([response.match])));
          dispatch(actions.updateTournamentPlayers(compact(response.players)));
        };
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 130..133

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

      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

      export const sendMatchGameOver = matchId => {
        channel
          .push('tournament:match:game_over', { match_id: matchId })
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 263..267

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

      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

      export const toggleVisibleGameResult = gameId => {
        channel
          .push('tournament:toggle_match_visible', { game_id: gameId })
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 281..285

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

      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

      export const startRoundTournament = () => {
        channel
          .push('tournament:start_round', {})
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 230..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 245..249
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 257..261
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 269..273
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 275..279

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

      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

      export const restartTournament = () => {
        channel
          .push('tournament:restart', {})
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 230..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 251..255
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 257..261
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 269..273
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 275..279

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

      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

      export const finishRoundTournament = () => {
        channel
          .push('tournament:finish_round', {})
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 230..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 245..249
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 251..255
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 269..273
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 275..279

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

      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

      export const startTournament = () => {
        channel
          .push('tournament:start', {})
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 245..249
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 251..255
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 257..261
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 269..273
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 275..279

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

      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

      export const openUpTournament = () => {
        channel
          .push('tournament:open_up', {})
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 230..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 245..249
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 251..255
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 257..261
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 275..279

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

      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

      export const showTournamentResults = () => {
        channel
          .push('tournament:toggle_show_results', {})
          .receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 230..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 245..249
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 251..255
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 257..261
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 269..273

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

      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 4 locations. Consider refactoring.
      Open

        const handlePlayerLeft = response => {
          dispatch(actions.removeTournamentPlayer(response));
          dispatch(actions.updateTournamentData(response.tournament));
        };
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 120..123
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 125..128
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 111..114

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

      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 4 locations. Consider refactoring.
      Open

        const handlePlayerJoined = response => {
          dispatch(actions.addTournamentPlayer(response));
          dispatch(actions.updateTournamentData(response.tournament));
        };
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 120..123
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 125..128
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 116..119

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

      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

      export const updateTournamentChannel = newTournamentId => {
        const newChannelName = `tournament_admin:${newTournamentId}`;
        channel = socket.channel(newChannelName);
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 16..19

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

      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

      There are no issues that match your filters.

      Category
      Status