hexlet-codebattle/codebattle

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

Summary

Maintainability
F
5 days
Test Coverage

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

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

  const oldChannel = channel;

    Function initTournamentChannel has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const initTournamentChannel = dispatch => {
      const onJoinFailure = () => {
        window.location.reload();
      };
    
    

      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 169..195

      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 68..75

      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));
            dispatch(actions.updateTournamentPlayers(data.players));
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 197..204

      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 refs = [
          oldChannel.on('tournament:update', handleUpdate),
          oldChannel.on('tournament:matches:update', handleMatchesUpdate),
          oldChannel.on('tournament:players:update', handlePlayersUpdate),
          oldChannel.on('tournament:round_created', handleTournamentRoundCreated),
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 137..148

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

      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,
            playersPageNumber: 1,
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 89..99

      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

          dispatch(actions.setTournamentData({
            ...response.tournament,
            topPlayerIds: response.topPlayerIds || [],
            matches: {},
            players: {},
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 27..36

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

      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 },
            playersPageNumber: 1,
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 101..110

      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 126..129

      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 11 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/Room.js on lines 999..1001
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 1003..1005
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 239..241
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 243..245
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 224..226
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 228..230
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 232..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 236..238
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 244..246
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 248..250

      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 11 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/Room.js on lines 999..1001
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 1003..1005
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 239..241
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 243..245
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 220..222
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 224..226
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 232..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 236..238
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 244..246
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 248..250

      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 11 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/Room.js on lines 999..1001
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 1003..1005
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 239..241
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 243..245
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 220..222
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 224..226
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 228..230
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 236..238
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 244..246
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 248..250

      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 11 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/Room.js on lines 999..1001
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 1003..1005
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 239..241
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 243..245
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 220..222
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 224..226
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 228..230
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 232..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 236..238
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 244..246

      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 11 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/Room.js on lines 999..1001
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 1003..1005
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 239..241
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 243..245
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 220..222
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 224..226
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 228..230
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 232..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 244..246
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 248..250

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

      export const cancelTournament = () => {
        channel.push('tournament:cancel', {}).receive('error', error => console.error(error));
      };
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 999..1001
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 1003..1005
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 239..241
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 243..245
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 220..222
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 228..230
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 232..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 236..238
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 244..246
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 248..250

      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 11 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/Room.js on lines 999..1001
      services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js on lines 1003..1005
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 239..241
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 243..245
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 220..222
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 224..226
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 228..230
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 232..234
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 236..238
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 248..250

      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 handlePlayerJoined = response => {
          dispatch(actions.addTournamentPlayer(response));
          dispatch(actions.updateTournamentData(
            response.tournament,
          ));
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 112..117
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 119..124
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 111..116

      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 handlePlayerLeft = response => {
          dispatch(actions.removeTournamentPlayer(response));
          dispatch(actions.updateTournamentData(
            response.tournament,
          ));
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 112..117
      services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js on lines 119..124
      services/app/apps/codebattle/assets/js/widgets/middlewares/TournamentAdmin.js on lines 104..109

      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