inversify/inversify-express-utils

View on GitHub
src/decorators.ts

Summary

Maintainability
C
7 hrs
Test Coverage

Function params has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function params(type: PARAMETER_TYPE, parameterName?: string) {
  return (
    target: unknown | Controller,
    methodName: string | symbol,
    index: number
Severity: Minor
Found in src/decorators.ts - About 1 hr to fix

    Function httpMethod has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function httpMethod(
      method: keyof typeof HTTP_VERBS_ENUM,
      path: string,
      ...middleware: Array<Middleware>
    ): HandlerDecorator {
    Severity: Minor
    Found in src/decorators.ts - About 1 hr to fix

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

      export function httpGet(
        path: string,
        ...middleware: Array<Middleware>
      ): HandlerDecorator {
        return httpMethod('get', path, ...middleware);
      Severity: Major
      Found in src/decorators.ts and 6 other locations - About 40 mins to fix
      src/decorators.ts on lines 40..45
      src/decorators.ts on lines 54..59
      src/decorators.ts on lines 61..66
      src/decorators.ts on lines 68..73
      src/decorators.ts on lines 75..80
      src/decorators.ts on lines 82..87

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

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

      export function httpHead(
        path: string,
        ...middleware: Array<Middleware>
      ): HandlerDecorator {
        return httpMethod('head', path, ...middleware);
      Severity: Major
      Found in src/decorators.ts and 6 other locations - About 40 mins to fix
      src/decorators.ts on lines 40..45
      src/decorators.ts on lines 47..52
      src/decorators.ts on lines 54..59
      src/decorators.ts on lines 61..66
      src/decorators.ts on lines 68..73
      src/decorators.ts on lines 82..87

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

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

      export function httpPut(
        path: string,
        ...middleware: Array<Middleware>
      ): HandlerDecorator {
        return httpMethod('put', path, ...middleware);
      Severity: Major
      Found in src/decorators.ts and 6 other locations - About 40 mins to fix
      src/decorators.ts on lines 40..45
      src/decorators.ts on lines 47..52
      src/decorators.ts on lines 54..59
      src/decorators.ts on lines 68..73
      src/decorators.ts on lines 75..80
      src/decorators.ts on lines 82..87

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

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

      export function httpDelete(
        path: string,
        ...middleware: Array<Middleware>
      ): HandlerDecorator {
        return httpMethod('delete', path, ...middleware);
      Severity: Major
      Found in src/decorators.ts and 6 other locations - About 40 mins to fix
      src/decorators.ts on lines 40..45
      src/decorators.ts on lines 47..52
      src/decorators.ts on lines 54..59
      src/decorators.ts on lines 61..66
      src/decorators.ts on lines 68..73
      src/decorators.ts on lines 75..80

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

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

      export function httpPost(
        path: string,
        ...middleware: Array<Middleware>
      ): HandlerDecorator {
        return httpMethod('post', path, ...middleware);
      Severity: Major
      Found in src/decorators.ts and 6 other locations - About 40 mins to fix
      src/decorators.ts on lines 40..45
      src/decorators.ts on lines 47..52
      src/decorators.ts on lines 61..66
      src/decorators.ts on lines 68..73
      src/decorators.ts on lines 75..80
      src/decorators.ts on lines 82..87

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

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

      export function httpPatch(
        path: string,
        ...middleware: Array<Middleware>
      ): HandlerDecorator {
        return httpMethod('patch', path, ...middleware);
      Severity: Major
      Found in src/decorators.ts and 6 other locations - About 40 mins to fix
      src/decorators.ts on lines 40..45
      src/decorators.ts on lines 47..52
      src/decorators.ts on lines 54..59
      src/decorators.ts on lines 61..66
      src/decorators.ts on lines 75..80
      src/decorators.ts on lines 82..87

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

      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

          const previousMetadata: Array<ControllerMetadata> = Reflect.getMetadata(
            METADATA_KEY.controller,
            Reflect,
          ) as Array<ControllerMetadata> || [];
      Severity: Minor
      Found in src/decorators.ts and 1 other location - About 40 mins to fix
      src/utils.ts on lines 19..23

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

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

      export function all(
        path: string,
        ...middleware: Array<Middleware>
      ): HandlerDecorator {
        return httpMethod('all', path, ...middleware);
      Severity: Major
      Found in src/decorators.ts and 6 other locations - About 40 mins to fix
      src/decorators.ts on lines 47..52
      src/decorators.ts on lines 54..59
      src/decorators.ts on lines 61..66
      src/decorators.ts on lines 68..73
      src/decorators.ts on lines 75..80
      src/decorators.ts on lines 82..87

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

      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