HabitRPG/habitrpg

View on GitHub
test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js

Summary

Maintainability
F
1 wk
Test Coverage

File POST-tasks_id_score_direction.test.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { v4 as generateUUID } from 'uuid';
import { apiError } from '../../../../../website/server/libs/apiError';
import {
  generateUser,
  sleep,
Severity: Minor
Found in test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js - About 4 hrs to fix

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

        context('user stats when direction is down', () => {
          let updatedUser; let
            initialUser;
    
          beforeEach(async () => {
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 225..247

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

    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

        context('user stats when direction is down', () => {
          let updatedUser; let
            initialUser;
    
          beforeEach(async () => {
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 328..350

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

    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

        context('user stats when direction is up', () => {
          let updatedUser;
    
          beforeEach(async () => {
            await user.post(`/tasks/${todo._id}/score/up`);
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 307..326

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

    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

        context('user stats when direction is up', () => {
          let updatedUser;
    
          beforeEach(async () => {
            await user.post(`/tasks/${daily._id}/score/up`);
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 204..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 229.

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

        it('doesn\'t let a daily be completed twice', async () => {
          await user.post(`/tasks/${daily._id}/score/up`);
          await expect(user.post(`/tasks/${daily._id}/score/up`)).to.eventually.be.rejected.and.eql({
            code: 401,
            error: 'NotAuthorized',
    test/api/v3/integration/challenges/POST-challenge_flag.test.js on lines 54..63
    test/api/v3/integration/challenges/POST-challenges_challengeId_join.test.js on lines 102..110
    test/api/v3/integration/tasks/DELETE-tasks_id.test.js on lines 29..36
    test/api/v3/integration/tasks/DELETE-tasks_id.test.js on lines 38..46
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 186..194
    test/api/v3/integration/tasks/challenges/DELETE-tasks_id_challenge_challengeId.test.js on lines 48..56
    test/api/v3/integration/tasks/groups/DELETE-group_tasks_id.test.js on lines 36..45

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

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

        it('doesn\'t let a todo be completed twice', async () => {
          await user.post(`/tasks/${todo._id}/score/up`);
          await expect(user.post(`/tasks/${todo._id}/score/up`))
            .to.eventually.be.rejected.and.eql({
              code: 401,
    test/api/v3/integration/challenges/POST-challenge_flag.test.js on lines 54..63
    test/api/v3/integration/challenges/POST-challenges_challengeId_join.test.js on lines 102..110
    test/api/v3/integration/tasks/DELETE-tasks_id.test.js on lines 29..36
    test/api/v3/integration/tasks/DELETE-tasks_id.test.js on lines 38..46
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 290..297
    test/api/v3/integration/tasks/challenges/DELETE-tasks_id_challenge_challengeId.test.js on lines 48..56
    test/api/v3/integration/tasks/groups/DELETE-group_tasks_id.test.js on lines 36..45

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

    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

        it('can use an id to identify the task', async () => {
          const todo = await user.post('/tasks/user', {
            text: 'test todo',
            type: 'todo',
            alias: 'alias',
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 32..42

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

    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

        it('can use a alias in place of the id', async () => {
          const todo = await user.post('/tasks/user', {
            text: 'test todo',
            type: 'todo',
            alias: 'alias',
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 20..30

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

    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

        it('increases user\'s exp when direction is up', async () => {
          await user.post(`/tasks/${habit._id}/score/up`);
          const updatedUser = await user.get('/user');
    
          expect(updatedUser.stats.exp).to.be.greaterThan(user.stats.exp);
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 382..387

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

    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

        it('decreases user\'s mp when direction is down', async () => {
          await user.post(`/tasks/${habit._id}/score/down`);
          const updatedUser = await user.get('/user');
    
          expect(updatedUser.stats.mp).to.be.lessThan(user.stats.mp);
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 389..394

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

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

        it('requires a task direction', async () => {
          await expect(user.post(`/tasks/${generateUUID()}/score/tt`)).to.eventually.be.rejected.and.eql({
            code: 400,
            error: 'BadRequest',
            message: apiError('directionUpDown'),
    test/api/v3/integration/challenges/GET-challenges_challengeId_members.test.js on lines 17..23
    test/api/v3/integration/challenges/GET-challenges_challengeId_members.test.js on lines 25..31
    test/api/v3/integration/challenges/GET-challenges_challengeId_members_memberId.test.js on lines 16..22
    test/api/v3/integration/challenges/GET-challenges_challengeId_members_memberId.test.js on lines 24..30
    test/api/v3/integration/challenges/POST-challenge_flag.test.js on lines 29..36
    test/api/v3/integration/challenges/POST-challenge_flag_clear.test.js on lines 32..39
    test/api/v3/integration/challenges/POST-challenge_flag_clear.test.js on lines 41..48
    test/api/v3/integration/groups/GET-groups_groupId_invites.test.js on lines 24..30
    test/api/v3/integration/groups/GET-groups_groupId_members.test.js on lines 33..39
    test/api/v3/integration/tasks/GET-tasks_challenge_challengeId.test.js on lines 46..52
    test/api/v3/integration/tasks/POST-tasks_move_taskId_to_position.test.js on lines 14..20
    test/api/v3/integration/tasks/POST-tasks_move_taskId_to_position.test.js on lines 22..28
    test/api/v3/integration/tasks/POST-tasks_unlink-one_taskId.test.js on lines 63..70
    test/api/v3/integration/tasks/challenges/DELETE-tasks_id_challenge_challengeId.test.js on lines 30..36
    test/api/v4/inbox/DELETE-inbox_messages_messageId.test.js on lines 37..44
    test/api/v4/news/DELETE-news.test.js on lines 31..37
    test/api/v4/news/GET-news_id.test.js on lines 22..28
    test/api/v4/news/PUT-news_newsId.test.js on lines 33..39

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

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

          await user.post('/user/webhook', {
            url: `http://localhost:${server.port}/webhooks/${uuid}`,
            type: 'taskActivity',
            enabled: true,
            options: {
    test/api/v3/integration/tasks/DELETE-tasks_id.test.js on lines 66..74
    test/api/v3/integration/tasks/DELETE-tasks_id.test.js on lines 96..104
    test/api/v3/integration/tasks/PUT-tasks_id.test.js on lines 173..181
    test/api/v3/integration/tasks/PUT-tasks_id.test.js on lines 210..218
    test/api/v3/integration/tasks/checklists/POST-tasks_taskId_checklist_itemId_score.test.js on lines 112..120
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 53..61

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

    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

          expect(body.user.stats).to.have.all.keys('hp', 'mp', 'exp', 'gp', 'lvl', 'class', 'points', 'str', 'con', 'int', 'per', 'buffs', 'training', 'maxHealth', 'maxMP', 'toNextLevel');
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 77..77

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

    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

        it('does not change user\'s exp', () => {
          expect(user.stats.exp).to.equal(updatedUser.stats.exp);
        });
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 452..454
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 460..462

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

    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

        it('does not allow a down direction', () => {
          expect(user.stats.mp).to.equal(updatedUser.stats.mp);
        });
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 452..454
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 456..458

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

    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

        it('does not change user\'s mp', () => {
          expect(user.stats.mp).to.equal(updatedUser.stats.mp);
        });
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 456..458
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 460..462

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

    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

          expect(updatedUser.tasksOrder.todos.indexOf(todo._id)).not.to.equal(-1);
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 223..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 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 7 locations. Consider refactoring.
    Open

          expect(getUser.tasksOrder.todos.indexOf(todo._id)).to.not.equal(-1);
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 150..150
    test/api/v3/integration/tasks/challenges/POST-tasks_challenge_id.test.js on lines 120..120
    test/api/v3/integration/tasks/challenges/POST-tasks_challenge_id.test.js on lines 142..142
    test/api/v3/integration/tasks/challenges/POST-tasks_challenge_id.test.js on lines 166..166
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 201..201
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 213..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 45.

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

          expect(getUser.tasksOrder.todos.indexOf(todo._id)).to.not.equal(-1);
    test/api/v3/integration/tasks/POST-tasks_id_score_direction.test.js on lines 162..162
    test/api/v3/integration/tasks/challenges/POST-tasks_challenge_id.test.js on lines 120..120
    test/api/v3/integration/tasks/challenges/POST-tasks_challenge_id.test.js on lines 142..142
    test/api/v3/integration/tasks/challenges/POST-tasks_challenge_id.test.js on lines 166..166
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 201..201
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 213..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 45.

    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

          expect(updatedUser.tasksOrder.todos.indexOf(todo._id)).to.equal(l - 1);
    test/api/v4/tasks/POST-tasks-bulk-score.test.js on lines 225..225

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

    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