believer/movies-graphql-postgres

View on GitHub

Showing 83 of 83 total issues

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

    preparedMovie.production_companies.forEach(async name => {
      const id = await upsert('production_companies', name)

      await addToMovieTable('movie_production_companies', {
        movie_id: insertedMovie.id,
Severity: Major
Found in lib/graphql/resolvers/mutations/insertMovie.js and 3 other locations - About 1 hr to fix
lib/graphql/resolvers/mutations/insertMovie.js on lines 88..95
lib/graphql/resolvers/mutations/insertMovie.js on lines 99..106
lib/graphql/resolvers/mutations/insertMovie.js on lines 121..128

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

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

    preparedMovie.genres.forEach(async name => {
      const id = await upsert('genres', name)

      await addToMovieTable('movie_genres', {
        movie_id: insertedMovie.id,
Severity: Major
Found in lib/graphql/resolvers/mutations/insertMovie.js and 3 other locations - About 1 hr to fix
lib/graphql/resolvers/mutations/insertMovie.js on lines 99..106
lib/graphql/resolvers/mutations/insertMovie.js on lines 110..117
lib/graphql/resolvers/mutations/insertMovie.js on lines 121..128

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  it('should get movie information', async () => {
    try {
      await insertMovie(null, { input }, context)

      expect(movieService).toHaveBeenCalledWith('tt1337')
lib/graphql/resolvers/mutations/__tests__/insertMovie.spec.js on lines 157..165

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

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

    preparedMovie.production_countries.forEach(async name => {
      const id = await upsert('countries', name)

      await addToMovieTable('movie_countries', {
        movie_id: insertedMovie.id,
Severity: Major
Found in lib/graphql/resolvers/mutations/insertMovie.js and 3 other locations - About 1 hr to fix
lib/graphql/resolvers/mutations/insertMovie.js on lines 88..95
lib/graphql/resolvers/mutations/insertMovie.js on lines 99..106
lib/graphql/resolvers/mutations/insertMovie.js on lines 110..117

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

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

    preparedMovie.spoken_languages.forEach(async name => {
      const id = await upsert('languages', name)

      await addToMovieTable('movie_languages', {
        movie_id: insertedMovie.id,
Severity: Major
Found in lib/graphql/resolvers/mutations/insertMovie.js and 3 other locations - About 1 hr to fix
lib/graphql/resolvers/mutations/insertMovie.js on lines 88..95
lib/graphql/resolvers/mutations/insertMovie.js on lines 110..117
lib/graphql/resolvers/mutations/insertMovie.js on lines 121..128

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

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

      jest.mock('moviedb', () =>
        jest.fn().mockImplementation(() => ({
          movieCredits: jest
            .fn()
            .mockImplementationOnce((_, cb) => cb('err', false)),
Severity: Major
Found in lib/services/__tests__/tmdb.spec.js and 1 other location - About 1 hr to fix
lib/services/__tests__/tmdb.spec.js on lines 64..70

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

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

      jest.mock('moviedb', () =>
        jest.fn().mockImplementation(() => ({
          movieInfo: jest
            .fn()
            .mockImplementationOnce((_, cb) => cb('err', false)),
Severity: Major
Found in lib/services/__tests__/tmdb.spec.js and 1 other location - About 1 hr to fix
lib/services/__tests__/tmdb.spec.js on lines 26..32

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

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

  it('should get ratings for a movie', () => {
    ratings(null, { movieId: '1' })

    expect(db.query.mock.calls[0][0]).toMatchSnapshot()
  })
Severity: Major
Found in lib/graphql/resolvers/queries/__tests__/ratings.spec.js and 4 other locations - About 1 hr to fix
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 15..19
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/moviesPerYear.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/users.spec.js on lines 21..25

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

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

  it('should get total movies for a specific year', () => {
    moviesPerYear(null, { year: '2017' })

    expect(db.query.mock.calls[0][0]).toMatchSnapshot()
  })
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 15..19
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/ratings.spec.js on lines 15..19
lib/graphql/resolvers/queries/__tests__/users.spec.js on lines 21..25

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

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

  it('should query for movie using id', () => {
    movie(null, { id: '1' })

    expect(db.one.mock.calls[0][0]).toMatchSnapshot()
  })
Severity: Major
Found in lib/graphql/resolvers/queries/__tests__/movie.spec.js and 4 other locations - About 1 hr to fix
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/moviesPerYear.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/ratings.spec.js on lines 15..19
lib/graphql/resolvers/queries/__tests__/users.spec.js on lines 21..25

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

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

  it('should get a specific user', () => {
    users(null, { id: '1' })

    expect(db.query.mock.calls[0][0]).toMatchSnapshot()
  })
Severity: Major
Found in lib/graphql/resolvers/queries/__tests__/users.spec.js and 4 other locations - About 1 hr to fix
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 15..19
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/moviesPerYear.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/ratings.spec.js on lines 15..19

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

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

  it('should one for movie using IMDb id', () => {
    movie(null, { id: 'tt1234567' })

    expect(db.one.mock.calls[0][0]).toMatchSnapshot()
  })
Severity: Major
Found in lib/graphql/resolvers/queries/__tests__/movie.spec.js and 4 other locations - About 1 hr to fix
lib/graphql/resolvers/queries/__tests__/movie.spec.js on lines 15..19
lib/graphql/resolvers/queries/__tests__/moviesPerYear.spec.js on lines 21..25
lib/graphql/resolvers/queries/__tests__/ratings.spec.js on lines 15..19
lib/graphql/resolvers/queries/__tests__/users.spec.js on lines 21..25

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it('returns false if password match', () => {
      crypto.createHmac().digest.mockReturnValue('hashedDbPassword')

      expect(
        login.invalidPassword('robin4ever', 'hashedDbPassword', 'thisissalt')
Severity: Major
Found in lib/services/__tests__/login.spec.js and 1 other location - About 1 hr to fix
lib/services/__tests__/login.spec.js on lines 39..45

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it('returns true if password dont match', () => {
      crypto.createHmac().digest.mockReturnValue('nope')

      expect(
        login.invalidPassword('robin4ever', 'hashedDbPassword', 'thisissalt')
Severity: Major
Found in lib/services/__tests__/login.spec.js and 1 other location - About 1 hr to fix
lib/services/__tests__/login.spec.js on lines 47..53

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  it('should return database data', async () => {
    const response = await views(null, { offset: 0, limit: 10 }, { db })

    expect(response).toEqual('dbData')
  })
Severity: Major
Found in lib/graphql/resolvers/queries/__tests__/views.spec.js and 1 other location - About 1 hr to fix
lib/graphql/resolvers/queries/__tests__/top250.spec.js on lines 18..22

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  it('should return database data', async () => {
    const response = await top250(null, { limit: 200, offset: 0 }, { db })

    expect(response).toEqual('dbData')
  })
Severity: Major
Found in lib/graphql/resolvers/queries/__tests__/top250.spec.js and 1 other location - About 1 hr to fix
lib/graphql/resolvers/queries/__tests__/views.spec.js on lines 33..37

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

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

module.exports = async function movie (imdbId) {
  imdbId = imdbId.match(/tt\d+/)

  if (!imdbId || !imdbId[0]) {
    throw new Error('No IMDb ID')
Severity: Minor
Found in lib/services/movie.js - About 1 hr to fix

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

      it('should get users', () => {
        users(null, {})
    
        expect(db.query.mock.calls[0][0]).toMatchSnapshot()
      })
    Severity: Major
    Found in lib/graphql/resolvers/queries/__tests__/users.spec.js and 1 other location - About 1 hr to fix
    lib/graphql/resolvers/queries/__tests__/moviesPerYear.spec.js on lines 15..19

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

      it('should get total movies per year', () => {
        moviesPerYear(null, {})
    
        expect(db.query.mock.calls[0][0]).toMatchSnapshot()
      })
    lib/graphql/resolvers/queries/__tests__/users.spec.js on lines 15..19

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

    jest.mock('../../../../services/token', () => ({
      verifyToken: jest.fn().mockImplementation(() =>
        Promise.resolve({
          id: 2,
        })
    Severity: Major
    Found in lib/graphql/resolvers/queries/__tests__/feed.spec.js and 10 other locations - About 55 mins to fix
    lib/graphql/resolvers/mutations/__tests__/insertMovie.spec.js on lines 19..25
    lib/graphql/resolvers/mutations/__tests__/updateRating.spec.js on lines 13..19
    lib/graphql/resolvers/queries/__tests__/bestForYears.spec.js on lines 4..10
    lib/graphql/resolvers/queries/__tests__/friends.spec.js on lines 4..10
    lib/graphql/resolvers/queries/__tests__/totalByPerson.spec.js on lines 4..10
    lib/graphql/resolvers/queries/__tests__/totalByRole.spec.js on lines 4..10
    lib/graphql/resolvers/queries/__tests__/userMoviesPerYear.spec.js on lines 4..10
    lib/graphql/resolvers/queries/__tests__/userRuntime.spec.js on lines 4..10
    lib/graphql/resolvers/queries/__tests__/views.spec.js on lines 4..10
    lib/graphql/resolvers/queries/__tests__/watches.spec.js on lines 4..10

    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

    Severity
    Category
    Status
    Source
    Language