api/src/__tests__/taskMutations.test.ts

Summary

Maintainability
F
5 days
Test Coverage

File taskMutations.test.ts has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { graphqlRequest } from '../db/connection';
import {
  boardFactory,
  checklistFactory,
  checklistItemFactory,
Severity: Minor
Found in api/src/__tests__/taskMutations.test.ts - About 4 hrs to fix

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

      test('Task archive', async () => {
        const mutation = `
          mutation tasksArchive($stageId: String!) {
            tasksArchive(stageId: $stageId)
          }
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 3 other locations - About 7 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 443..464
    api/src/__tests__/growthHackMutations.test.ts on lines 410..433
    api/src/__tests__/ticketMutations.test.ts on lines 367..390

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

    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

      test('Update task move to pipeline stage', async () => {
        const mutation = `
          mutation tasksEdit($_id: String!, ${commonTaskParamDefs}) {
            tasksEdit(_id: $_id, ${commonTaskParams}) {
              _id
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 3 other locations - About 7 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 298..325
    api/src/__tests__/growthHackMutations.test.ts on lines 244..275
    api/src/__tests__/ticketMutations.test.ts on lines 214..241

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

    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

      test('Change task if move to another stage', async () => {
        const anotherStage = await stageFactory({ pipelineId: pipeline._id });
    
        const args = {
          proccessId: Math.random().toString(),
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 2 other locations - About 5 hrs to fix
    api/src/__tests__/growthHackMutations.test.ts on lines 217..242
    api/src/__tests__/ticketMutations.test.ts on lines 187..212

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

    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

      test('Change task', async () => {
        const args = {
          proccessId: Math.random().toString(),
          itemId: task._id,
          aboveItemId: '',
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 1 other location - About 4 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 235..258

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

    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

      test('Watch task', async () => {
        const mutation = `
          mutation tasksWatch($_id: String!, $isAdd: Boolean!) {
            tasksWatch(_id: $_id, isAdd: $isAdd) {
              _id
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 1 other location - About 4 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 341..364

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

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

      afterEach(async () => {
        // Clearing test data
        await Boards.deleteMany({});
        await Pipelines.deleteMany({});
        await Stages.deleteMany({});
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 9 other locations - About 2 hrs to fix
    api/src/__tests__/boardMutations.test.ts on lines 75..82
    api/src/__tests__/engageMessageQueries.test.ts on lines 49..56
    api/src/__tests__/growthHackMutations.test.ts on lines 89..96
    api/src/__tests__/integrationMutations.test.ts on lines 76..83
    api/src/__tests__/knowledgeBaseMutations.test.ts on lines 65..72
    api/src/__tests__/scriptMutations.test.ts on lines 36..43
    api/src/__tests__/structureMutations.test.ts on lines 32..39
    api/src/__tests__/ticketMutations.test.ts on lines 87..94
    api/src/__tests__/widgetMutations.test.ts on lines 1141..1148

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

    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

      test('Remove task', async () => {
        const mutation = `
          mutation tasksRemove($_id: String!) {
            tasksRemove(_id: $_id) {
              _id
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 2 other locations - About 2 hrs to fix
    api/src/__tests__/boardMutations.test.ts on lines 569..579
    api/src/__tests__/dealMutations.test.ts on lines 327..339

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

    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

        if (clonedTaskChecklist) {
          const clonedTaskChecklistItems = await ChecklistItems.find({
            checklistId: clonedTaskChecklist._id
          });
    
    
    Severity: Major
    Found in api/src/__tests__/taskMutations.test.ts and 3 other locations - About 2 hrs to fix
    api/src/__tests__/dealMutations.test.ts on lines 426..433
    api/src/__tests__/growthHackMutations.test.ts on lines 397..404
    api/src/__tests__/ticketMutations.test.ts on lines 351..358

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

    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