Lambda-School-Labs/allay-be

View on GitHub

Showing 85 of 85 total issues

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

  return db('reviews as r')
    .select(
      'r.id as review_id',
      'u.id as user_id',
      'u.first_name as user_first_name',
Severity: Major
Found in helpers/reviews-model.js and 1 other location - About 4 hrs to fix
helpers/reviews-model.js on lines 14..57

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

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.delete(
  '/:userId/reviews/:revId',
  validateUserId,
  validateReviewId,
  async (req, res) => {
Severity: Major
Found in routers/users-router.js and 1 other location - About 4 hrs to fix
routers/companies-router.js on lines 92..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 115.

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.delete(
  '/:companyId',
  checkForAdmin,
  validateCompanyId,
  async (req, res) => {
Severity: Major
Found in routers/companies-router.js and 1 other location - About 4 hrs to fix
routers/users-router.js on lines 209..222

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

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

  describe('findReviewById()', () => {
    it('Returns user when review found', async () => {
      const foundReview = await Review.findReviewsById(review.id);
      expect(foundReview.review_id).toBe(review.id);
    });
Severity: Major
Found in __tests__/reviews-model_find_review_by_id.spec.js and 1 other location - About 3 hrs to fix
__tests__/companies-model_find_company_by_id.spec.js on lines 13..24

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

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

  describe('findCompaniesById()', () => {
    it('Returns user when review found', async () => {
      const foundReview = await Company.findCompanyById(company.id);
      expect(foundReview.id).toEqual(company.id);
    });
Severity: Major
Found in __tests__/companies-model_find_company_by_id.spec.js and 1 other location - About 3 hrs to fix
__tests__/reviews-model_find_review_by_id.spec.js on lines 22..33

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

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.get('/', async (req, res) => {
  try {
    const reviews = await Revs.findReviews();
    res.json(reviews);
  } catch (e) {
Severity: Major
Found in routers/reviews-router.js and 1 other location - About 3 hrs to fix
routers/companies-router.js on lines 26..34

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

router.get('/', async (req, res) => {
  try {
    const companies = await Co.findCompanies();
    res.json(companies);
  } catch (e) {
Severity: Major
Found in routers/companies-router.js and 1 other location - About 3 hrs to fix
routers/reviews-router.js on lines 10..18

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

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

exports.up = function (knex) {
  return knex.schema.createTable('reviews', tbl => {
    tbl.increments();
    tbl.string('job_title').notNullable();
    tbl.integer('start_date');
Severity: Major
Found in data/migrations/20200312161741_reviews_table.js - About 2 hrs to fix

    Function seed has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.seed = function (knex) {
      // Deletes ALL existing entries
      return knex('users')
        .del()
        .then(function () {
    Severity: Major
    Found in data/seeds/008-users.js - About 2 hrs to fix

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

        beforeAll(async () => {
          await resetTable('reviews', 'companies', 'users');
          await db('companies').insert(company);
          await db('users').insert(user);
          await db('reviews').insert(review);
      Severity: Major
      Found in __tests__/companies-model_find_company_reviews.spec.js and 5 other locations - About 1 hr to fix
      __tests__/reviews-model_delete_review.spec.js on lines 15..20
      __tests__/reviews-model_find_review_by_id.spec.js on lines 15..20
      __tests__/reviews-model_update_review.spec.js on lines 15..20
      __tests__/reviews-router_find_all_reviews.spec.js on lines 19..24
      __tests__/reviews-router_find_review_by_id.spec.js on lines 19..24

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

      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

      exports.up = function (knex) {
        return knex.schema.createTable('states', tbl => {
          tbl.increments();
          tbl.string('state_name').notNullable().unique();
        });
      Severity: Major
      Found in data/migrations/20200312152523_states_table.js and 3 other locations - About 1 hr to fix
      data/migrations/20200219174528_tracks_table.js on lines 1..6
      data/migrations/20200312152402_work_status_table.js on lines 1..6
      data/migrations/20200312152501_offer_status_table.js on lines 1..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 74.

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

        beforeAll(async () => {
          await resetTable('reviews', 'users', 'companies');
          await db('companies').insert(company);
          await db('users').insert(user);
          await db('reviews').insert(review);
      Severity: Major
      Found in __tests__/reviews-model_find_review_by_id.spec.js and 5 other locations - About 1 hr to fix
      __tests__/companies-model_find_company_reviews.spec.js on lines 15..20
      __tests__/reviews-model_delete_review.spec.js on lines 15..20
      __tests__/reviews-model_update_review.spec.js on lines 15..20
      __tests__/reviews-router_find_all_reviews.spec.js on lines 19..24
      __tests__/reviews-router_find_review_by_id.spec.js on lines 19..24

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

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

        beforeAll(async () => {
          await resetTable('reviews', 'users', 'companies');
          await db('companies').insert(company);
          await db('users').insert(user);
          await db('reviews').insert(review);
      Severity: Major
      Found in __tests__/reviews-router_find_review_by_id.spec.js and 5 other locations - About 1 hr to fix
      __tests__/companies-model_find_company_reviews.spec.js on lines 15..20
      __tests__/reviews-model_delete_review.spec.js on lines 15..20
      __tests__/reviews-model_find_review_by_id.spec.js on lines 15..20
      __tests__/reviews-model_update_review.spec.js on lines 15..20
      __tests__/reviews-router_find_all_reviews.spec.js on lines 19..24

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

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

        beforeAll(async () => {
          await resetTable('reviews', 'users', 'companies');
          await db('companies').insert(company);
          await db('users').insert(user);
          await db('reviews').insert(review);
      Severity: Major
      Found in __tests__/reviews-model_update_review.spec.js and 5 other locations - About 1 hr to fix
      __tests__/companies-model_find_company_reviews.spec.js on lines 15..20
      __tests__/reviews-model_delete_review.spec.js on lines 15..20
      __tests__/reviews-model_find_review_by_id.spec.js on lines 15..20
      __tests__/reviews-router_find_all_reviews.spec.js on lines 19..24
      __tests__/reviews-router_find_review_by_id.spec.js on lines 19..24

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

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

        beforeAll(async () => {
          await resetTable('reviews', 'users', 'companies');
          await db('companies').insert(company);
          await db('users').insert(user);
          await db('reviews').insert(review);
      Severity: Major
      Found in __tests__/reviews-router_find_all_reviews.spec.js and 5 other locations - About 1 hr to fix
      __tests__/companies-model_find_company_reviews.spec.js on lines 15..20
      __tests__/reviews-model_delete_review.spec.js on lines 15..20
      __tests__/reviews-model_find_review_by_id.spec.js on lines 15..20
      __tests__/reviews-model_update_review.spec.js on lines 15..20
      __tests__/reviews-router_find_review_by_id.spec.js on lines 19..24

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

      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

      exports.up = function (knex) {
        return knex.schema.createTable('tracks', tbl => {
          tbl.increments();
          tbl.string('track_name').notNullable().unique();
        });
      Severity: Major
      Found in data/migrations/20200219174528_tracks_table.js and 3 other locations - About 1 hr to fix
      data/migrations/20200312152402_work_status_table.js on lines 1..6
      data/migrations/20200312152501_offer_status_table.js on lines 1..6
      data/migrations/20200312152523_states_table.js on lines 1..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 74.

      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

      exports.up = function (knex) {
        return knex.schema.createTable('work_status', tbl => {
          tbl.increments();
          tbl.string('work_status').notNullable().unique();
        });
      Severity: Major
      Found in data/migrations/20200312152402_work_status_table.js and 3 other locations - About 1 hr to fix
      data/migrations/20200219174528_tracks_table.js on lines 1..6
      data/migrations/20200312152501_offer_status_table.js on lines 1..6
      data/migrations/20200312152523_states_table.js on lines 1..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 74.

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

        beforeAll(async () => {
          await resetTable('reviews', 'users', 'companies');
          await db('companies').insert(company);
          await db('users').insert(user);
          await db('reviews').insert(review);
      Severity: Major
      Found in __tests__/reviews-model_delete_review.spec.js and 5 other locations - About 1 hr to fix
      __tests__/companies-model_find_company_reviews.spec.js on lines 15..20
      __tests__/reviews-model_find_review_by_id.spec.js on lines 15..20
      __tests__/reviews-model_update_review.spec.js on lines 15..20
      __tests__/reviews-router_find_all_reviews.spec.js on lines 19..24
      __tests__/reviews-router_find_review_by_id.spec.js on lines 19..24

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

      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

      exports.up = function (knex) {
        return knex.schema.createTable('offer_status', tbl => {
          tbl.increments();
          tbl.string('offer_status').notNullable().unique();
        });
      Severity: Major
      Found in data/migrations/20200312152501_offer_status_table.js and 3 other locations - About 1 hr to fix
      data/migrations/20200219174528_tracks_table.js on lines 1..6
      data/migrations/20200312152402_work_status_table.js on lines 1..6
      data/migrations/20200312152523_states_table.js on lines 1..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 74.

      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 findReviewsById has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function findReviewsById(revId) {
        return db('reviews as r')
          .select(
            'r.id as review_id',
            'u.id as user_id',
      Severity: Minor
      Found in helpers/reviews-model.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language