maxgherman/TypeIOC

View on GitHub

Showing 52 of 52 total issues

RegistrationBase has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

export class RegistrationBase implements IRegistrationBase {
    private _id: string
    private _factory?: Factory<{}>
    private _factoryType?: {}
    private _factoryValue?: {}
Severity: Minor
Found in src/registration/base.ts - About 4 hrs to fix

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

            result[propertyType.getter] = (strategyInfo : IStrategyInfo) => {
    
                const { configurable, enumerable } = strategyInfo.descriptor ?
                    strategyInfo.descriptor : { configurable: true, enumerable: true }
    
    Severity: Major
    Found in src/interceptors/decorator.ts and 1 other location - About 4 hrs to fix
    src/interceptors/decorator.ts on lines 47..57

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

    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

            result[propertyType.setter] = (strategyInfo : IStrategyInfo) => {
    
                const { configurable, enumerable } = strategyInfo.descriptor ?
                    strategyInfo.descriptor : { configurable: true, enumerable: true }
    
    Severity: Major
    Found in src/interceptors/decorator.ts and 1 other location - About 4 hrs to fix
    src/interceptors/decorator.ts on lines 35..45

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

    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

    File internal-container.ts has 327 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { IRegistrationBase, IDynamicDependency } from '../registration'
    import { ResolutionError, CircularDependencyError } from '../exceptions/index.js'
    import { owner, scope } from '../common/index.js'
    import {
        IRegistrationStorageService,
    Severity: Minor
    Found in src/build/internal-container.ts - About 3 hrs to fix

      Function container has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const container = (_container: IInternalContainer) => {
          const result: IContainer = {
              get cache(): ICache {
                  return _container.cache
              },
      Severity: Major
      Found in src/build/container.ts - About 3 hrs to fix

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

                    const getter = strategyInfo.substitute!.type === callInfo.any ||
                                strategyInfo.substitute!.type === callInfo.getterSetter ||
                                strategyInfo.substitute!.type === callInfo.getter  ||
                                strategyInfo.substitute!.type === callInfo.field ?
                                defineWrapGetter(strategyInfo) : defineGetter(strategyInfo)
        Severity: Major
        Found in src/interceptors/decorator.ts and 1 other location - About 3 hrs to fix
        src/interceptors/decorator.ts on lines 136..140

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

        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

        InternalContainer has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class InternalContainer implements IInternalContainer {
        
            private _parent: InternalContainer | undefined
            private _children: InternalContainer [] = []
            private _pendingResolutions: IndexedCollection<boolean>
        Severity: Minor
        Found in src/build/internal-container.ts - About 3 hrs to fix

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

                      const setter = strategyInfo.substitute!.type === callInfo.any ||
                                  strategyInfo.substitute!.type === callInfo.getterSetter ||
                                  strategyInfo.substitute!.type === callInfo.setter ||
                                  strategyInfo.substitute!.type === callInfo.field ?
                                  defineWrapSetter(strategyInfo) : defineSetter(strategyInfo)
          Severity: Major
          Found in src/interceptors/decorator.ts and 1 other location - About 3 hrs to fix
          src/interceptors/decorator.ts on lines 130..134

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

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

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

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

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

          Refactorings

          Further Reading

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

              public interceptInstance<R extends Object>(
                  subject: R, substitutes?: ISubstituteInfo | ISubstituteInfo[]): R {
          
                  this.assertObject(subject)
          
          Severity: Major
          Found in src/interceptors/interceptor.ts and 1 other location - About 2 hrs to fix
          src/interceptors/interceptor.ts on lines 14..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 92.

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

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

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

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

          Refactorings

          Further Reading

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

              public interceptPrototype<R extends Function>(
                  subject: R, substitutes?: ISubstituteInfo | ISubstituteInfo[]): R {
          
                  this.assertPrototype(subject)
          
          Severity: Major
          Found in src/interceptors/interceptor.ts and 1 other location - About 2 hrs to fix
          src/interceptors/interceptor.ts on lines 23..30

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 92.

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

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

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

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

          Refactorings

          Further Reading

          Function instantiateByDependencies has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              private instantiateByDependencies(type: {}, dependencies: {}[]) {
                  const params = dependencies
                  .map((dependency, index) => {
          
                      const depParams =
          Severity: Minor
          Found in src/build/invoker.ts - About 2 hrs 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 2 locations. Consider refactoring.
          Open

                  result[propertyType.getter] = (strategyInfo: IStrategyInfo) => {
          
                      Object.defineProperty(strategyInfo.destination, strategyInfo.name, {
                          get: defineWrapGetter(strategyInfo),
                          configurable: true,
          Severity: Major
          Found in src/interceptors/decorator.ts and 1 other location - About 2 hrs to fix
          src/interceptors/decorator.ts on lines 119..126

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 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

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

                  result[propertyType.setter] = (strategyInfo: IStrategyInfo) => {
          
                      Object.defineProperty(strategyInfo.destination, strategyInfo.name, {
                          set: defineWrapSetter(strategyInfo),
                          configurable: true,
          Severity: Major
          Found in src/interceptors/decorator.ts and 1 other location - About 2 hrs to fix
          src/interceptors/decorator.ts on lines 110..117

          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

          Function defineWrapStrategies has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private defineWrapStrategies(): IStrategy {
                  const result = <IStrategy>{}
                  const createCallChainFromList = this.createCallChainFromList.bind(this)
                  const defineWrapGetter = this.defineWrapGetter.bind(this)
                  const defineWrapSetter = this.defineWrapSetter.bind(this)
          Severity: Major
          Found in src/interceptors/decorator.ts - About 2 hrs to fix

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

                    return {
                        initializeBy: this.initializeBy,
                        lazy: this.lazy,
                        dispose: this.dispose,
                        named: this.named,
            Severity: Major
            Found in src/registration/instance.ts and 2 other locations - About 2 hrs to fix
            src/decorators/registration-api.ts on lines 94..103
            src/registration/instance.ts on lines 51..60

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

            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

                    return {
                        initializeBy: this.initializeBy,
                        lazy: this.lazy,
                        dispose: this.dispose,
                        named: this.named,
            Severity: Major
            Found in src/registration/instance.ts and 2 other locations - About 2 hrs to fix
            src/decorators/registration-api.ts on lines 94..103
            src/registration/instance.ts on lines 33..42

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

            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

                    return {
                        lazy : this.lazy,
                        dispose : this.dispose,
                        named: this.named,
                        within: this.within,
            Severity: Major
            Found in src/decorators/registration-api.ts and 2 other locations - About 2 hrs to fix
            src/registration/instance.ts on lines 33..42
            src/registration/instance.ts on lines 51..60

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

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

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

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

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

            Refactorings

            Further Reading

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

            export class ProxyError extends ApplicationError {
            
                /**
                 * Constructor
                 * @param params - optional additional information about the error
            Severity: Major
            Found in src/exceptions/proxy-error.ts and 1 other location - About 1 hr to fix
            src/exceptions/decorator-error.ts on lines 9..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 74.

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

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

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

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

            Refactorings

            Further Reading

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

            export class DecoratorError extends ApplicationError {
            
                /**
                 * Constructor
                 * @param params - optional additional information about the error
            Severity: Major
            Found in src/exceptions/decorator-error.ts and 1 other location - About 1 hr to fix
            src/exceptions/proxy-error.ts on lines 9..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 74.

            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

                private getForFactoryType(registration: IRegistrationBase, storage: FactoryTypeStore):
                    IRegistrationBase |undefined {
            
                    return !registration.name ? storage.factory.noName :
                        storage.factory.names[registration.name]
            Severity: Major
            Found in src/storage/registration-storage.ts and 1 other location - About 1 hr to fix
            src/storage/registration-storage.ts on lines 116..121

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

            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