aurelia/aurelia

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

Summary

Maintainability
F
2 wks
Test Coverage

File api.ts has 551 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-conventions/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-conventions/src/api.ts - About 2 hrs to fix

      Function handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        private async handle<T extends ResponseConstructor>(p: Promise<Response>, Type?: T, handleValidationErrors?: true): Promise<ReturnType<T['create']> | ErrorRecordResponse | void> {
          const response = await p;
          if (response.status >= 200 && response.status < 400) {
            if (Type === undefined) {
              this.logger.trace(`handle() - ignoring response body`, response);
      Severity: Minor
      Found in examples/realworld-conventions/src/api.ts - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      export class Article {
        static get NONE(): Article {
          return Article.create({
            slug: '',
            title: '',
      Severity: Major
      Found in examples/realworld-conventions/src/api.ts and 1 other location - About 1 day to fix
      examples/realworld/src/api.ts on lines 100..146

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

      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-conventions/src/api.ts and 2 other locations - About 1 day to fix
      examples/realworld-advanced/src/api.ts on lines 511..540
      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 2 locations. Consider refactoring.
      Open

      export class ArticleListQueryParams {
        get type(): 'all' { return 'all'; }
      
        private constructor(
          public limit: number,
      Severity: Major
      Found in examples/realworld-conventions/src/api.ts and 1 other location - About 1 day to fix
      examples/realworld/src/api.ts on lines 323..351

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

      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 User {
        static get NONE(): User {
          return User.create({
            email: '',
            token: '',
      Severity: Major
      Found in examples/realworld-conventions/src/api.ts and 1 other location - About 7 hrs to fix
      examples/realworld/src/api.ts on lines 15..47

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

      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-conventions/src/api.ts and 2 other locations - About 7 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 256..271
      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-conventions/src/api.ts and 2 other locations - About 6 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 427..437
      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 2 locations. Consider refactoring.
      Open

      export class Profile {
        static get NONE(): Profile {
          return Profile.create({
            username: '',
            bio: '',
      Severity: Major
      Found in examples/realworld-conventions/src/api.ts and 1 other location - About 6 hrs to fix
      examples/realworld/src/api.ts on lines 59..88

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

      export class FeedArticleListQueryParams {
        get type(): 'feed' { return 'feed'; }
      
        private constructor(
          public limit: number,
      Severity: Major
      Found in examples/realworld-conventions/src/api.ts and 1 other location - About 6 hrs to fix
      examples/realworld/src/api.ts on lines 353..372

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

      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-conventions/src/api.ts and 2 other locations - About 5 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 199..221
      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-conventions/src/api.ts and 2 other locations - About 3 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 320..338
      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-conventions/src/api.ts and 2 other locations - About 3 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 462..473
      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-conventions/src/api.ts and 2 other locations - About 3 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 439..450
      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 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-conventions/src/api.ts and 2 other locations - About 2 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 298..308
      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 3 locations. Consider refactoring.
      Open

      export class UserLogin {
        private constructor(
          public email: string,
          public password: string,
        ) {}
      Severity: Major
      Found in examples/realworld-conventions/src/api.ts and 2 other locations - About 2 hrs to fix
      examples/realworld-advanced/src/api.ts on lines 277..286
      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 12 locations. Consider refactoring.
      Open

      export class ArticleResponse {
        private constructor(
          public article: Article,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-conventions/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-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 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-conventions/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-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 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-conventions/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-advanced/src/api.ts on lines 223..231
      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 CommentResponse {
        private constructor(
          public comment: Comment,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-conventions/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-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/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-conventions/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 495..503
      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 UserLoginRequest {
        private constructor(
          public user: UserLogin,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-conventions/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-advanced/src/api.ts on lines 475..483
      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 ArticleCreateRequest {
        private constructor(
          public article: ArticleCreate,
        ) {}
      
      
      Severity: Major
      Found in examples/realworld-conventions/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-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 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-conventions/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-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 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-conventions/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-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 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-conventions/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-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/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-conventions/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 244..252
      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

      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-conventions/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 485..493
      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-conventions/src/api.ts and 2 other locations - About 1 hr to fix
      examples/realworld-advanced/src/api.ts on lines 719..723
      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-conventions/src/api.ts and 2 other locations - About 50 mins to fix
      examples/realworld-advanced/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