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

View on GitHub
data/migrations/20200902161643_new_schema.js

Summary

Maintainability
A
1 hr
Test Coverage

Function up has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.up = function (knex) {
  return knex.schema
    .createTable('Parents', (t) => {
      t.increments('ID');
      t.string('Name').notNullable();
Severity: Minor
Found in data/migrations/20200902161643_new_schema.js - About 1 hr to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Invalid

    exports.down = function (knex) {
      return knex.schema
        .dropTableIfExists('Stories')
        .dropTableIfExists('Children')
        .dropTableIfExists('Avatars')
    Severity: Major
    Found in data/migrations/20200902161643_new_schema.js and 2 other locations - About 1 hr to fix
    data/migrations/20201012093856_gamification-1.js on lines 46..52
    data/migrations/20201012104127_gamification-3.js on lines 55..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 56.

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

          t.integer('AvatarID')
            .notNullable()
            .unsigned()
            .references('Avatars.ID')
            .onUpdate('CASCADE')
    Severity: Major
    Found in data/migrations/20200902161643_new_schema.js and 18 other locations - About 40 mins to fix
    data/migrations/20200902161643_new_schema.js on lines 23..28
    data/migrations/20200914121455_child_updates.js on lines 8..13
    data/migrations/20200928102812_child_submissions.js on lines 5..10
    data/migrations/20200928102812_child_submissions.js on lines 11..16
    data/migrations/20200928102812_child_submissions.js on lines 27..32
    data/migrations/20201007143802_cohorts.js on lines 4..9
    data/migrations/20201007152023_moderation-tables.js on lines 4..9
    data/migrations/20201012093856_gamification-1.js on lines 6..11
    data/migrations/20201012093856_gamification-1.js on lines 21..26
    data/migrations/20201012093856_gamification-1.js on lines 31..36
    data/migrations/20201012093856_gamification-1.js on lines 37..42
    data/migrations/20201012103144_gamification-2.js on lines 6..11
    data/migrations/20201012103144_gamification-2.js on lines 12..17
    data/migrations/20201012104127_gamification-3.js on lines 14..19
    data/migrations/20201012104127_gamification-3.js on lines 20..25
    data/migrations/20201012104127_gamification-3.js on lines 26..31
    data/migrations/20201012104127_gamification-3.js on lines 40..45
    data/migrations/20201012104127_gamification-3.js on lines 46..51

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

          t.integer('ParentID')
            .notNullable()
            .unsigned()
            .references('Parents.ID')
            .onUpdate('CASCADE')
    Severity: Major
    Found in data/migrations/20200902161643_new_schema.js and 18 other locations - About 40 mins to fix
    data/migrations/20200902161643_new_schema.js on lines 17..22
    data/migrations/20200914121455_child_updates.js on lines 8..13
    data/migrations/20200928102812_child_submissions.js on lines 5..10
    data/migrations/20200928102812_child_submissions.js on lines 11..16
    data/migrations/20200928102812_child_submissions.js on lines 27..32
    data/migrations/20201007143802_cohorts.js on lines 4..9
    data/migrations/20201007152023_moderation-tables.js on lines 4..9
    data/migrations/20201012093856_gamification-1.js on lines 6..11
    data/migrations/20201012093856_gamification-1.js on lines 21..26
    data/migrations/20201012093856_gamification-1.js on lines 31..36
    data/migrations/20201012093856_gamification-1.js on lines 37..42
    data/migrations/20201012103144_gamification-2.js on lines 6..11
    data/migrations/20201012103144_gamification-2.js on lines 12..17
    data/migrations/20201012104127_gamification-3.js on lines 14..19
    data/migrations/20201012104127_gamification-3.js on lines 20..25
    data/migrations/20201012104127_gamification-3.js on lines 26..31
    data/migrations/20201012104127_gamification-3.js on lines 40..45
    data/migrations/20201012104127_gamification-3.js on lines 46..51

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

      return knex.schema
        .createTable('Parents', (t) => {
          t.increments('ID');
          t.string('Name').notNullable();
          t.string('Email').notNullable().unique().index();
    Severity: Minor
    Found in data/migrations/20200902161643_new_schema.js and 1 other location - About 30 mins to fix
    data/migrations/20200914121455_child_updates.js on lines 2..6

    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