inversify/InversifyJS

View on GitHub

Showing 71 of 80 total issues

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

  public inRequestScope(): interfaces.BindingWhenOnSyntax<T> {
    this._binding.scope = BindingScopeEnum.Request;
    return new BindingWhenOnSyntax<T>(this._binding);
  }
Severity: Major
Found in src/syntax/binding_in_syntax.ts and 2 other locations - About 1 hr to fix
src/syntax/binding_in_syntax.ts on lines 18..21
src/syntax/binding_in_syntax.ts on lines 23..26

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public whenAnyAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T> {
    return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint);
  }
Severity: Major
Found in src/syntax/binding_in_when_on_syntax.ts and 5 other locations - About 1 hr to fix
src/syntax/binding_in_when_on_syntax.ts on lines 32..34
src/syntax/binding_in_when_on_syntax.ts on lines 88..90
src/syntax/binding_when_on_syntax.ts on lines 17..19
src/syntax/binding_when_on_syntax.ts on lines 69..71
src/syntax/binding_when_on_syntax.ts on lines 73..75

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public inSingletonScope(): interfaces.BindingWhenOnSyntax<T> {
    this._binding.scope = BindingScopeEnum.Singleton;
    return new BindingWhenOnSyntax<T>(this._binding);
  }
Severity: Major
Found in src/syntax/binding_in_syntax.ts and 2 other locations - About 1 hr to fix
src/syntax/binding_in_syntax.ts on lines 13..16
src/syntax/binding_in_syntax.ts on lines 23..26

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public when(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T> {
    return this._bindingWhenSyntax.when(constraint);
  }
Severity: Major
Found in src/syntax/binding_in_when_on_syntax.ts and 5 other locations - About 1 hr to fix
src/syntax/binding_in_when_on_syntax.ts on lines 84..86
src/syntax/binding_in_when_on_syntax.ts on lines 88..90
src/syntax/binding_when_on_syntax.ts on lines 17..19
src/syntax/binding_when_on_syntax.ts on lines 69..71
src/syntax/binding_when_on_syntax.ts on lines 73..75

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public whenNoAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T> {
    return this._bindingWhenSyntax.whenNoAncestorMatches(constraint);
  }
Severity: Major
Found in src/syntax/binding_when_on_syntax.ts and 5 other locations - About 1 hr to fix
src/syntax/binding_in_when_on_syntax.ts on lines 32..34
src/syntax/binding_in_when_on_syntax.ts on lines 84..86
src/syntax/binding_in_when_on_syntax.ts on lines 88..90
src/syntax/binding_when_on_syntax.ts on lines 17..19
src/syntax/binding_when_on_syntax.ts on lines 69..71

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public whenNoAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T> {
    return this._bindingWhenSyntax.whenNoAncestorMatches(constraint);
  }
Severity: Major
Found in src/syntax/binding_in_when_on_syntax.ts and 5 other locations - About 1 hr to fix
src/syntax/binding_in_when_on_syntax.ts on lines 32..34
src/syntax/binding_in_when_on_syntax.ts on lines 84..86
src/syntax/binding_when_on_syntax.ts on lines 17..19
src/syntax/binding_when_on_syntax.ts on lines 69..71
src/syntax/binding_when_on_syntax.ts on lines 73..75

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public when(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T> {
    return this._bindingWhenSyntax.when(constraint);
  }
Severity: Major
Found in src/syntax/binding_when_on_syntax.ts and 5 other locations - About 1 hr to fix
src/syntax/binding_in_when_on_syntax.ts on lines 32..34
src/syntax/binding_in_when_on_syntax.ts on lines 84..86
src/syntax/binding_in_when_on_syntax.ts on lines 88..90
src/syntax/binding_when_on_syntax.ts on lines 69..71
src/syntax/binding_when_on_syntax.ts on lines 73..75

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public whenAnyAncestorMatches(constraint: (request: interfaces.Request) => boolean): interfaces.BindingOnSyntax<T> {
    return this._bindingWhenSyntax.whenAnyAncestorMatches(constraint);
  }
Severity: Major
Found in src/syntax/binding_when_on_syntax.ts and 5 other locations - About 1 hr to fix
src/syntax/binding_in_when_on_syntax.ts on lines 32..34
src/syntax/binding_in_when_on_syntax.ts on lines 84..86
src/syntax/binding_in_when_on_syntax.ts on lines 88..90
src/syntax/binding_when_on_syntax.ts on lines 17..19
src/syntax/binding_when_on_syntax.ts on lines 73..75

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

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

  public inTransientScope(): interfaces.BindingWhenOnSyntax<T> {
    this._binding.scope = BindingScopeEnum.Transient;
    return new BindingWhenOnSyntax<T>(this._binding);
  }
Severity: Major
Found in src/syntax/binding_in_syntax.ts and 2 other locations - About 1 hr to fix
src/syntax/binding_in_syntax.ts on lines 13..16
src/syntax/binding_in_syntax.ts on lines 18..21

Duplicated Code

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

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

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

Tuning

This issue has a mass of 60.

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

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

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

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

Refactorings

Further Reading

Function getConstructorArgsAsTarget has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getConstructorArgsAsTarget(
  index: number,
  isBaseClass: boolean,
  constructorName: string,
  serviceIdentifiers: interfaces.ServiceIdentifier[],
Severity: Minor
Found in src/planning/reflection_utils.ts - About 1 hr to fix

    Function getClassPropsAsTargets has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getClassPropsAsTargets(
      metadataReader: interfaces.MetadataReader,
      constructorFunc: NewableFunction,
      constructorName: string
    ) {
    Severity: Minor
    Found in src/planning/reflection_utils.ts - About 1 hr to fix

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

          const getRebindFunction = <T = unknown>(moduleId: interfaces.ContainerModuleBase['id']) =>
            (serviceIdentifier: interfaces.ServiceIdentifier) => {
              const bindingToSyntax = this.rebind(serviceIdentifier);
              setModuleId(bindingToSyntax, moduleId);
              return bindingToSyntax as BindingToSyntax<T>;
      Severity: Major
      Found in src/container/container.ts and 1 other location - About 1 hr to fix
      src/container/container.ts on lines 508..513

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 56.

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

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

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

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

      Refactorings

      Further Reading

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

          const getBindFunction = <T>(moduleId: interfaces.ContainerModuleBase['id']) =>
            (serviceIdentifier: interfaces.ServiceIdentifier) => {
              const bindingToSyntax = this.bind(serviceIdentifier);
              setModuleId(bindingToSyntax, moduleId);
              return bindingToSyntax as BindingToSyntax<T>;
      Severity: Major
      Found in src/container/container.ts and 1 other location - About 1 hr to fix
      src/container/container.ts on lines 530..535

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 56.

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

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

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

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

      Refactorings

      Further Reading

      Function _getActiveBindings has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function _getActiveBindings(
        metadataReader: interfaces.MetadataReader,
        avoidConstraints: boolean,
        context: interfaces.Context,
        parentRequest: interfaces.Request | null,
      Severity: Minor
      Found in src/planning/planner.ts - About 1 hr to fix

        Function plan has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          metadataReader: interfaces.MetadataReader,
          container: interfaces.Container,
          isMultiInject: boolean,
          targetType: interfaces.TargetType,
          serviceIdentifier: interfaces.ServiceIdentifier,
        Severity: Major
        Found in src/planning/planner.ts - About 1 hr to fix

          Function _resolveRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const _resolveRequest = <T>(requestScope: interfaces.RequestScope) =>
            (request: interfaces.Request): undefined | T | Promise<T> | (T | Promise<T>)[] => {
          
              request.parentContext.setCurrentRequest(request);
          
          
          Severity: Minor
          Found in src/resolution/resolver.ts - About 55 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

          Function constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            public constructor(containerOptions?: interfaces.ContainerOptions) {
              const options = containerOptions || {};
              if (typeof options !== 'object') {
                throw new Error(`${ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT}`);
              }
          Severity: Minor
          Found in src/container/container.ts - About 55 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

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

            public whenAnyAncestorIs(ancestor: (NewableFunction | string)): interfaces.BindingOnSyntax<T> {
              return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor);
            }
          Severity: Major
          Found in src/syntax/binding_when_on_syntax.ts and 5 other locations - About 50 mins to fix
          src/syntax/binding_in_when_on_syntax.ts on lines 48..50
          src/syntax/binding_in_when_on_syntax.ts on lines 60..62
          src/syntax/binding_in_when_on_syntax.ts on lines 64..66
          src/syntax/binding_when_on_syntax.ts on lines 33..35
          src/syntax/binding_when_on_syntax.ts on lines 49..51

          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

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

            public whenAnyAncestorIs(ancestor: (NewableFunction | string)): interfaces.BindingOnSyntax<T> {
              return this._bindingWhenSyntax.whenAnyAncestorIs(ancestor);
            }
          Severity: Major
          Found in src/syntax/binding_in_when_on_syntax.ts and 5 other locations - About 50 mins to fix
          src/syntax/binding_in_when_on_syntax.ts on lines 48..50
          src/syntax/binding_in_when_on_syntax.ts on lines 64..66
          src/syntax/binding_when_on_syntax.ts on lines 33..35
          src/syntax/binding_when_on_syntax.ts on lines 45..47
          src/syntax/binding_when_on_syntax.ts on lines 49..51

          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

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

            public whenNoAncestorIs(ancestor: (NewableFunction | string)): interfaces.BindingOnSyntax<T> {
              return this._bindingWhenSyntax.whenNoAncestorIs(ancestor);
            }
          Severity: Major
          Found in src/syntax/binding_in_when_on_syntax.ts and 5 other locations - About 50 mins to fix
          src/syntax/binding_in_when_on_syntax.ts on lines 48..50
          src/syntax/binding_in_when_on_syntax.ts on lines 60..62
          src/syntax/binding_when_on_syntax.ts on lines 33..35
          src/syntax/binding_when_on_syntax.ts on lines 45..47
          src/syntax/binding_when_on_syntax.ts on lines 49..51

          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

          Severity
          Category
          Status
          Source
          Language