doppelganger9/babyfoot

View on GitHub

Showing 40 of 57 total issues

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

  private standardGameOKResponseWithAddedAttributes(
    res: Response,
    gameId: GameId,
    addThisToTheBody: any = {},
    context: string = '',
Severity: Major
Found in src/routes/games-routes.ts and 1 other location - About 3 hrs to fix
src/routes/player-routes.ts on lines 141..152

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

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

  public standardPlayerOKResponseWithAddedAttributes(
    res: Response,
    playerId: PlayerId,
    addThisToTheBody: any = {},
    context: string = '',
Severity: Major
Found in src/routes/player-routes.ts and 1 other location - About 3 hrs to fix
src/routes/games-routes.ts on lines 253..264

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

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

  public getAllEvents(playerId: PlayerId): Array<BFEvent> {
    const events: Array<BFEvent> = this.eventsStore.getEventsOfAggregate(playerId);
    if (!events.length) {
      throw new UnknownPlayerError(playerId);
    }
Severity: Major
Found in src/infrastructure/player-repository.ts and 1 other location - About 2 hrs to fix
src/infrastructure/game-repository.ts on lines 21..28

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

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

  public getAllEvents(gameId: GameId): Array<BFEvent> {
    const events: Array<BFEvent> = this.eventsStore.getEventsOfAggregate(gameId);
    if (!events.length) {
      throw new UnknownGameError(gameId);
    }
Severity: Major
Found in src/infrastructure/game-repository.ts and 1 other location - About 2 hrs to fix
src/infrastructure/player-repository.ts on lines 36..43

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

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

export class ReviewTooLongError extends Error {
  constructor(public gameId: GameId, public length: number) {
    super(`submitted review is too long (${length}) for "${gameId}"`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/review-too-long-error.ts and 1 other location - About 2 hrs to fix
src/domains/game/errors/incorrect-review-stars-error.ts on lines 8..13

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

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

export class IncorrectReviewStarsError extends Error {
  constructor(public gameId: GameId, public stars: number) {
    super(`incorrect number of stars ${stars} for review on "${gameId}"`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/incorrect-review-stars-error.ts and 1 other location - About 2 hrs to fix
src/domains/game/errors/review-too-long-error.ts on lines 8..13

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

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

export class GameIsDeletedError extends Error {
  constructor(public gameId: GameId) {
    super(`game is deleted "${gameId}"`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/game-is-deleted-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export class MissingAuthorForReviewError extends Error {
  constructor(public gameId: GameId) {
    super(`author is required to review "${gameId}"`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/missing-author-for-review-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export class GameNotStartedError extends Error {
  constructor(public gameId: GameId) {
    super(`"${gameId}" has not started`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/game-not-started-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export class GameAlreadyEndedError extends Error {
  constructor(public gameId: GameId) {
    super(`"${gameId}" has already ended`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/game-already-ended-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export class GameAlreadyStartedError extends Error {
  constructor(public gameId: GameId) {
    super(`"${gameId}" has already started`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/game-already-started-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export class GameNotEndedError extends Error {
  constructor(public gameId: GameId) {
    super(`"${gameId}" has not ended`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/game-not-ended-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export class UnknownPlayerError extends Error {
  constructor(public playerId: PlayerId) {
    super(`unknown player "${playerId}"`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/unknown-player-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export class PlayerIsDeletedError extends Error {
  constructor(public playerId: PlayerId) {
    super(`Player is deleted "${playerId}"`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/player/errors/player-is-deleted-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/missing-initial-date-time-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13

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

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

export class MissingInitialDateTimeError extends Error {
  constructor(public gameId: GameId) {
    super(`initialDateTime is required to update "${gameId}"`);
    Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
  }
Severity: Major
Found in src/domains/game/errors/missing-initial-date-time-error.ts and 8 other locations - About 1 hr to fix
src/domains/game/errors/game-already-ended-error.ts on lines 8..13
src/domains/game/errors/game-already-started-error.ts on lines 8..13
src/domains/game/errors/game-is-deleted-error.ts on lines 7..12
src/domains/game/errors/game-not-ended-error.ts on lines 8..13
src/domains/game/errors/game-not-started-error.ts on lines 8..13
src/domains/game/errors/missing-author-for-review-error.ts on lines 8..13
src/domains/game/errors/unknown-player-error.ts on lines 8..13
src/domains/player/errors/player-is-deleted-error.ts on lines 7..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 68.

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

export abstract class PlayerEvent implements BFEvent {
  constructor(public timestamp: Date = new Date(), public playerId: PlayerId) {}

  public getAggregateId(): PlayerId {
    return this.playerId;
Severity: Major
Found in src/domains/player/events/player-event.ts and 1 other location - About 1 hr to fix
src/domains/game/events/game-event.ts 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 67.

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

export abstract class GameEvent implements BFEvent {
  constructor(public timestamp: Date = new Date(), public gameId: GameId) {}

  public getAggregateId(): GameId {
    return this.gameId;
Severity: Major
Found in src/domains/game/events/game-event.ts and 1 other location - About 1 hr to fix
src/domains/player/events/player-event.ts 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 67.

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

    this.projection = new PlayerDecisionProjection()
      .register('PlayerCreated', PEA.applyPlayerCreated as DAF)
      .register('PlayerDeleted', PEA.applyPlayerDeleted as DAF)
      .register('PlayerUpdated', PEA.applyPlayerUpdated as DAF)
      .apply(events);
Severity: Major
Found in src/domains/player/player.ts and 1 other location - About 1 hr to fix
src/domains/game/game.ts on lines 42..46

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

    this.projection = new GameDecisionProjection()
      .register('GameCreated', GEA.applyGameCreated as DAF)
      .register('GameDeleted', GEA.applyGameDeleted as DAF)
      .register('GameStarted', GEA.applyGameStarted as DAF)
      .register('GameEnded', GEA.applyGameEnded as DAF)
Severity: Major
Found in src/domains/game/game.ts and 1 other location - About 1 hr to fix
src/domains/player/player.ts on lines 20..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 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

    this.standardPlayerOKResponseWithAddedAttributes(res, playerId, {
      isDeleted: found.projection.isDeleted,
      avatar: found.projection.avatar,
      displayName: found.projection.displayName,
      email: found.projection.email,
Severity: Major
Found in src/routes/player-routes.ts and 1 other location - About 1 hr to fix
src/routes/player-routes.ts on lines 133..138

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

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