aurelia/aurelia

View on GitHub
examples/realworld-advanced/src/api.ts

Summary

Maintainability
F
3 wks
Test Coverage

File api.ts has 594 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { IWindow } from '@aurelia/runtime-html';
import { DI, IHttpClient, ILogger } from 'aurelia';

// eslint-disable-next-line @typescript-eslint/ban-types
type FuncPropNames<T> = { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T];
Severity: Major
Found in examples/realworld-advanced/src/api.ts - About 1 day to fix

    ApiService has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class ApiService {
      constructor(
        @ILogger private readonly logger: ILogger,
        @IHttpClient private readonly http: IHttpClient,
        @IJwtService private readonly jwt: IJwtService,
    Severity: Minor
    Found in examples/realworld-advanced/src/api.ts - About 2 hrs to fix

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

      export class ApiService {
        constructor(
          @ILogger private readonly logger: ILogger,
          @IHttpClient private readonly http: IHttpClient,
          @IJwtService private readonly jwt: IJwtService,
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 1 other location - About 2 wks to fix
      examples/realworld/src/api.ts on lines 498..659

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class JwtService {
        constructor(
          @IWindow readonly w: IWindow,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 1 day to fix
      examples/realworld-conventions/src/api.ts on lines 462..491
      examples/realworld/src/api.ts on lines 463..492

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class ErrorRecordResponse {
        private constructor(
          public errors: ErrorRecord,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 7 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 225..240
      examples/realworld/src/api.ts on lines 227..242

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      function toQueryString(obj: PurifyQueryParams<ArticleQueryParams>): string {
        const keys = Object.keys(obj) as (keyof PurifyQueryParams<ArticleQueryParams>)[];
        const pairs: string[] = [];
        for (const key of keys) {
          const value = obj[key];
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 6 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 377..387
      examples/realworld/src/api.ts on lines 379..389

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class Comment {
        private constructor(
          public id: number,
          public body: string,
          public createdAt: string,
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 5 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 169..191
      examples/realworld/src/api.ts on lines 170..192

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class UserUpdate {
        private constructor(
          public email?: string,
          public token?: string,
          public username?: string,
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 3 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 289..307
      examples/realworld/src/api.ts on lines 291..309

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class ArticleUpdate {
        private constructor(
          public title?: string,
          public description?: string,
          public body?: string,
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 3 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 412..423
      examples/realworld/src/api.ts on lines 414..425

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class ArticleCreate {
        private constructor(
          public title: string,
          public description: string,
          public body: string,
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 3 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 389..400
      examples/realworld/src/api.ts on lines 391..402

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

      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

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

      export class ArticleListResponse {
        private constructor(
          public articles: Article[],
          public articlesCount: number,
        ) {}
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 1 other location - About 2 hrs to fix
      examples/realworld/src/api.ts on lines 158..168

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class UserRegistration {
        private constructor(
          public username: string,
          public email: string,
          public password: string,
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 2 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 267..277
      examples/realworld/src/api.ts on lines 269..279

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

      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

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

      export class CommentListResponse {
        private constructor(
          public comments: Comment[],
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 1 other location - About 2 hrs to fix
      examples/realworld/src/api.ts on lines 204..213

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class UserLogin {
        private constructor(
          public email: string,
          public password: string,
        ) {}
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 2 hrs to fix
      examples/realworld-conventions/src/api.ts on lines 246..255
      examples/realworld/src/api.ts on lines 248..257

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

      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.type === other.type &&
            this.limit === other.limit &&
            this.offset === other.offset &&
            this.tag === other.tag &&
            this.author === other.author &&
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 1 other location - About 2 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 50..54

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

      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.email === other.email &&
            this.token === other.token &&
            this.username === other.username &&
            this.bio === other.bio &&
            this.image === other.image
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 1 other location - About 2 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 375..379

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

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

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

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

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

      Refactorings

      Further Reading

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

      export class CommentResponse {
        private constructor(
          public comment: Comment,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 11 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 59..67
      examples/realworld-advanced/src/api.ts on lines 109..117
      examples/realworld-advanced/src/api.ts on lines 177..185
      examples/realworld-conventions/src/api.ts on lines 49..57
      examples/realworld-conventions/src/api.ts on lines 90..98
      examples/realworld-conventions/src/api.ts on lines 148..156
      examples/realworld-conventions/src/api.ts on lines 193..201
      examples/realworld/src/api.ts on lines 49..57
      examples/realworld/src/api.ts on lines 90..98
      examples/realworld/src/api.ts on lines 148..156
      examples/realworld/src/api.ts on lines 194..202

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

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

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

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

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

      Refactorings

      Further Reading

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

      export class UserResponse {
        private constructor(
          public user: User,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 11 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 109..117
      examples/realworld-advanced/src/api.ts on lines 177..185
      examples/realworld-advanced/src/api.ts on lines 223..231
      examples/realworld-conventions/src/api.ts on lines 49..57
      examples/realworld-conventions/src/api.ts on lines 90..98
      examples/realworld-conventions/src/api.ts on lines 148..156
      examples/realworld-conventions/src/api.ts on lines 193..201
      examples/realworld/src/api.ts on lines 49..57
      examples/realworld/src/api.ts on lines 90..98
      examples/realworld/src/api.ts on lines 148..156
      examples/realworld/src/api.ts on lines 194..202

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

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

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

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

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

      Refactorings

      Further Reading

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

      export class ArticleResponse {
        private constructor(
          public article: Article,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 11 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 59..67
      examples/realworld-advanced/src/api.ts on lines 109..117
      examples/realworld-advanced/src/api.ts on lines 223..231
      examples/realworld-conventions/src/api.ts on lines 49..57
      examples/realworld-conventions/src/api.ts on lines 90..98
      examples/realworld-conventions/src/api.ts on lines 148..156
      examples/realworld-conventions/src/api.ts on lines 193..201
      examples/realworld/src/api.ts on lines 49..57
      examples/realworld/src/api.ts on lines 90..98
      examples/realworld/src/api.ts on lines 148..156
      examples/realworld/src/api.ts on lines 194..202

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

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

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

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

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

      Refactorings

      Further Reading

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

      export class ProfileResponse {
        private constructor(
          public profile: Profile,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 11 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 59..67
      examples/realworld-advanced/src/api.ts on lines 177..185
      examples/realworld-advanced/src/api.ts on lines 223..231
      examples/realworld-conventions/src/api.ts on lines 49..57
      examples/realworld-conventions/src/api.ts on lines 90..98
      examples/realworld-conventions/src/api.ts on lines 148..156
      examples/realworld-conventions/src/api.ts on lines 193..201
      examples/realworld/src/api.ts on lines 49..57
      examples/realworld/src/api.ts on lines 90..98
      examples/realworld/src/api.ts on lines 148..156
      examples/realworld/src/api.ts on lines 194..202

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class CommentCreateRequest {
        private constructor(
          public comment: CommentCreate,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-conventions/src/api.ts on lines 445..453
      examples/realworld/src/api.ts on lines 447..455

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

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

      export class ArticleCreateRequest {
        private constructor(
          public article: ArticleCreate,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 14 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 288..296
      examples/realworld-advanced/src/api.ts on lines 310..318
      examples/realworld-advanced/src/api.ts on lines 340..348
      examples/realworld-advanced/src/api.ts on lines 475..483
      examples/realworld-conventions/src/api.ts on lines 257..265
      examples/realworld-conventions/src/api.ts on lines 279..287
      examples/realworld-conventions/src/api.ts on lines 309..317
      examples/realworld-conventions/src/api.ts on lines 402..410
      examples/realworld-conventions/src/api.ts on lines 425..433
      examples/realworld/src/api.ts on lines 259..267
      examples/realworld/src/api.ts on lines 281..289
      examples/realworld/src/api.ts on lines 311..319
      examples/realworld/src/api.ts on lines 404..412
      examples/realworld/src/api.ts on lines 427..435

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

      export class UserUpdateRequest {
        private constructor(
          public user: UserUpdate,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 14 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 288..296
      examples/realworld-advanced/src/api.ts on lines 310..318
      examples/realworld-advanced/src/api.ts on lines 452..460
      examples/realworld-advanced/src/api.ts on lines 475..483
      examples/realworld-conventions/src/api.ts on lines 257..265
      examples/realworld-conventions/src/api.ts on lines 279..287
      examples/realworld-conventions/src/api.ts on lines 309..317
      examples/realworld-conventions/src/api.ts on lines 402..410
      examples/realworld-conventions/src/api.ts on lines 425..433
      examples/realworld/src/api.ts on lines 259..267
      examples/realworld/src/api.ts on lines 281..289
      examples/realworld/src/api.ts on lines 311..319
      examples/realworld/src/api.ts on lines 404..412
      examples/realworld/src/api.ts on lines 427..435

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

      export class UserRegistrationRequest {
        private constructor(
          public user: UserRegistration,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 14 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 288..296
      examples/realworld-advanced/src/api.ts on lines 340..348
      examples/realworld-advanced/src/api.ts on lines 452..460
      examples/realworld-advanced/src/api.ts on lines 475..483
      examples/realworld-conventions/src/api.ts on lines 257..265
      examples/realworld-conventions/src/api.ts on lines 279..287
      examples/realworld-conventions/src/api.ts on lines 309..317
      examples/realworld-conventions/src/api.ts on lines 402..410
      examples/realworld-conventions/src/api.ts on lines 425..433
      examples/realworld/src/api.ts on lines 259..267
      examples/realworld/src/api.ts on lines 281..289
      examples/realworld/src/api.ts on lines 311..319
      examples/realworld/src/api.ts on lines 404..412
      examples/realworld/src/api.ts on lines 427..435

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

      export class UserLoginRequest {
        private constructor(
          public user: UserLogin,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 14 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 310..318
      examples/realworld-advanced/src/api.ts on lines 340..348
      examples/realworld-advanced/src/api.ts on lines 452..460
      examples/realworld-advanced/src/api.ts on lines 475..483
      examples/realworld-conventions/src/api.ts on lines 257..265
      examples/realworld-conventions/src/api.ts on lines 279..287
      examples/realworld-conventions/src/api.ts on lines 309..317
      examples/realworld-conventions/src/api.ts on lines 402..410
      examples/realworld-conventions/src/api.ts on lines 425..433
      examples/realworld/src/api.ts on lines 259..267
      examples/realworld/src/api.ts on lines 281..289
      examples/realworld/src/api.ts on lines 311..319
      examples/realworld/src/api.ts on lines 404..412
      examples/realworld/src/api.ts on lines 427..435

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

      export class ArticleUpdateRequest {
        private constructor(
          public article: ArticleUpdate,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 14 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 288..296
      examples/realworld-advanced/src/api.ts on lines 310..318
      examples/realworld-advanced/src/api.ts on lines 340..348
      examples/realworld-advanced/src/api.ts on lines 452..460
      examples/realworld-conventions/src/api.ts on lines 257..265
      examples/realworld-conventions/src/api.ts on lines 279..287
      examples/realworld-conventions/src/api.ts on lines 309..317
      examples/realworld-conventions/src/api.ts on lines 402..410
      examples/realworld-conventions/src/api.ts on lines 425..433
      examples/realworld/src/api.ts on lines 259..267
      examples/realworld/src/api.ts on lines 281..289
      examples/realworld/src/api.ts on lines 311..319
      examples/realworld/src/api.ts on lines 404..412
      examples/realworld/src/api.ts on lines 427..435

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class TagListResponse {
        private constructor(
          public tags: string[],
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-conventions/src/api.ts on lines 213..221
      examples/realworld/src/api.ts on lines 215..223

      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

          return (
            this.username === other.username &&
            this.bio === other.bio &&
            this.image === other.image &&
            this.following === other.following
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 1 other location - About 1 hr to fix
      packages/ui-virtualization/src/scroller-observer.ts on lines 123..126

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class CommentCreate {
        private constructor(
          public body: string,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-conventions/src/api.ts on lines 435..443
      examples/realworld/src/api.ts on lines 437..445

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      export class HttpError extends Error {
        constructor(public readonly response: Response) {
          super(`HTTP error code ${response.status} (${response.statusText})`);
        }
      }
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-conventions/src/api.ts on lines 670..674
      examples/realworld/src/api.ts on lines 671..675

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

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      type FuncPropNames<T> = { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T];
      Severity: Major
      Found in examples/realworld-advanced/src/api.ts and 2 other locations - About 50 mins to fix
      examples/realworld-conventions/src/api.ts on lines 5..5
      examples/realworld/src/api.ts on lines 5..5

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 51.

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

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

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

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

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status