Lambda-School-Labs/Labs26-StorySquad-BE-TeamB

View on GitHub

Showing 61 of 124 total issues

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

exports.down = function (knex) {
  return knex.schema.table('Votes', (t) => {
    t.dropUnique(['MemberID', 'FaceoffID']);
  });
};
Severity: Minor
Found in data/migrations/20201019142221_votes-unique-constraint.js and 1 other location - About 55 mins to fix
data/migrations/20201019142221_votes-unique-constraint.js on lines 1..5

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

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

      const emojis2 = Object.values(await trx(faceoffType).select('Emoji').where({ SubmissionID: faceoff.SubmissionID2 }).first());
Severity: Minor
Found in api/game/gameModel.js and 1 other location - About 55 mins to fix
api/game/gameModel.js on lines 214..214

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

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

      const emojis1 = Object.values(await trx(faceoffType).select('Emoji').where({ SubmissionID: faceoff.SubmissionID1 }).first());
Severity: Minor
Found in api/game/gameModel.js and 1 other location - About 55 mins to fix
api/game/gameModel.js on lines 215..215

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

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

exports.up = function (knex) {
  return knex.schema.table('Votes', (t) => {
    t.unique(['MemberID', 'FaceoffID']);
  });
};
Severity: Minor
Found in data/migrations/20201019142221_votes-unique-constraint.js and 1 other location - About 55 mins to fix
data/migrations/20201019142221_votes-unique-constraint.js on lines 7..11

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

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

exports.down = function (knex) {
    return knex.schema.table('Faceoffs', table => {
        table.dropColumn('Winner')
    });
};
Severity: Major
Found in data/migrations/20201210170755__add-new-winner-column.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

exports.down = function(knex) {
  return knex.schema
    .table('Children', table =>{
        table.dropColumn('Achievements');
    })
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12

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

exports.down = function (knex) {
    return knex.schema.table('Children', table => {
        table.dropColumn('Total_Points')
    });
};
Severity: Major
Found in data/migrations/20201210171347__children-score-column.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

exports.down = function(knex) {
    return knex.schema.table('Votes', table => {
        table.dropColumn('Vote');
    });
};
Severity: Major
Found in data/migrations/20201216175900_add_back_vote_as_int.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

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

const submitVote = (vote) => {
  // return db('Votes').insert(vote).returning('ID');
  return db.transaction(async (trx) => {
    try {
      const { Vote, MemberID, FaceoffID, subEmojis1, subEmojis2 } = vote;
Severity: Minor
Found in api/game/gameModel.js - About 45 mins to fix

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

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

exports.down = function (knex) {
    return knex.schema.table('Faceoffs', table => {
        table.dropColumn('Winner')
    });
};
Severity: Major
Found in data/migrations/20201210170451__edit-winner-column.js.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

exports.up = function(knex) {
    return knex.schema.table('Votes', table => {
        table.dropColumn('Vote');
    })
};
Severity: Major
Found in data/migrations/20201216145909_change_vote_to_integer.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

exports.down = function(knex) {
    return knex.schema.table('Votes', table => {
        table.dropColumn('Vote');
    });
};
Severity: Major
Found in data/migrations/20201216145909_change_vote_to_integer.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

exports.down = function(knex) {
    return knex.schema.table('Faceoffs', table => {
        table.dropColumn('Date');
    });
};
Severity: Major
Found in data/migrations/20201215165436__date_column_in_faceoffs.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

exports.up = function (knex) {
    return knex.schema.table('Faceoffs', table => {
        table.dropColumn('Winner')
    });
};
Severity: Major
Found in data/migrations/20201210170451__edit-winner-column.js.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 2..6
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

exports.up = function(knex) {
    return knex.schema.table('Votes', table => {
        table.integer('Vote');
    })
};
Severity: Major
Found in data/migrations/20201216175900_add_back_vote_as_int.js and 11 other locations - About 45 mins to fix
data/migrations/20201006122148_low-confidence.js on lines 1..5
data/migrations/20201006122148_low-confidence.js on lines 7..11
data/migrations/20201210170451__edit-winner-column.js.js on lines 1..5
data/migrations/20201210170451__edit-winner-column.js.js on lines 7..11
data/migrations/20201210170755__add-new-winner-column.js on lines 7..11
data/migrations/20201210171347__children-score-column.js on lines 7..11
data/migrations/20201215165436__date_column_in_faceoffs.js on lines 8..12
data/migrations/20201216145909_change_vote_to_integer.js on lines 2..6
data/migrations/20201216145909_change_vote_to_integer.js on lines 8..12
data/migrations/20201216175900_add_back_vote_as_int.js on lines 8..12
data/migrations/20210131130814_add_achievements_to_child_table.js on lines 9..14

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

const updateFaceoffWinner = (conn, ID, Winner) => {
  return conn('Faceoffs').update({ Winner }).where({ ID });
};
Severity: Minor
Found in api/mod/modHelpers/resultCalulation.js and 1 other location - About 40 mins to fix
api/mod/modHelpers/resultCalulation.js on lines 148..150

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

const updateWinningTeamInSquad = (conn, ID, Winner) => {
  return conn('Squads').where({ ID }).update({ Winner });
};
Severity: Minor
Found in api/mod/modHelpers/resultCalulation.js and 1 other location - About 40 mins to fix
api/mod/modHelpers/resultCalulation.js on lines 112..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 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 2 locations. Consider refactoring.
Open

router.post('/votes', authRequired, emojiValidation, (req, res) => {
  const vote = req.body;

  crudOperationsManager.post(res, Game.submitVote, 'Vote', vote);
});
Severity: Minor
Found in api/game/gameRouter.js and 1 other location - About 40 mins to fix
api/gradeLevel/gradeLevelRouter.js on lines 101..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 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 2 locations. Consider refactoring.
Open

router.post('/', authRequired, gradeLevelValidation, (req, res) => {
  const newGrades = req.body;

  crudOperationsManager.postMult(res, GradeLevels.add, 'GradeLevel', newGrades);
});
Severity: Minor
Found in api/gradeLevel/gradeLevelRouter.js and 1 other location - About 40 mins to fix
api/game/gameRouter.js on lines 459..463

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

const moderatePost = (ID, changes) => {
  return db('Submissions').where({ ID }).update(changes);
};
Severity: Major
Found in api/mod/modModel.js and 4 other locations - About 35 mins to fix
api/Achievements/achieveModel.js on lines 86..88
api/child/childModel.js on lines 87..89
api/parent/parentModel.js on lines 58..60
api/stories/storyModel.js on lines 47..49

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

Severity
Category
Status
Source
Language