RobotlegsJS/RobotlegsJS

View on GitHub

Showing 77 of 77 total issues

Context has 43 functions (exceeds 20 allowed). Consider refactoring.
Open

@injectable()
export class Context extends EventDispatcher implements IContext {
    /*============================================================================*/
    /* Public Properties                                                          */
    /*============================================================================*/
Severity: Minor
Found in src/robotlegs/bender/framework/impl/Context.ts - About 5 hrs to fix

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

        public noneOf(type: IType<any> | Array<IType<any>>, ...types: Array<IType<any>>): TypeMatcher {
            if (type instanceof Array) {
                this.pushAddedTypesTo(type.concat(types), this._noneOfTypes);
            } else {
                this.pushAddedTypesTo([type].concat(types), this._noneOfTypes);
    Severity: Major
    Found in src/robotlegs/bender/extensions/matching/TypeMatcher.ts and 1 other location - About 4 hrs to fix
    src/robotlegs/bender/extensions/matching/TypeMatcher.ts on lines 50..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 131.

    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 anyOf(type: IType<any> | Array<IType<any>>, ...types: Array<IType<any>>): TypeMatcher {
            if (type instanceof Array) {
                this.pushAddedTypesTo(type.concat(types), this._anyOfTypes);
            } else {
                this.pushAddedTypesTo([type].concat(types), this._anyOfTypes);
    Severity: Major
    Found in src/robotlegs/bender/extensions/matching/TypeMatcher.ts and 1 other location - About 4 hrs to fix
    src/robotlegs/bender/extensions/matching/TypeMatcher.ts on lines 62..69

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

    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

    Lifecycle has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class Lifecycle implements ILifecycle {
        /*============================================================================*/
        /* Public Properties                                                          */
        /*============================================================================*/
    
    
    Severity: Minor
    Found in src/robotlegs/bender/framework/impl/Lifecycle.ts - About 4 hrs to fix

      Function exports has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = env => {
      
        if (!env) env = { production: false, karma: false };
      
        let mode = env.production ? "production" : "development";
      Severity: Major
      Found in webpack.config.js - About 2 hrs to fix

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

            private handleObject(object: any): void {
                if (this._initialized) {
                    this._logger.debug("Already initialized. Injecting into config object {0}", [object]);
                    this.processObject(object);
                } else {
        Severity: Major
        Found in src/robotlegs/bender/framework/impl/ConfigManager.ts and 1 other location - About 2 hrs to fix
        src/robotlegs/bender/framework/impl/ConfigManager.ts on lines 114..122

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

        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 handleClass(type: interfaces.Newable<IConfig>): void {
                if (this._initialized) {
                    this._logger.debug("Already initialized. Instantiating config class {0}", [type]);
                    this.processClass(type);
                } else {
        Severity: Major
        Found in src/robotlegs/bender/framework/impl/ConfigManager.ts and 1 other location - About 2 hrs to fix
        src/robotlegs/bender/framework/impl/ConfigManager.ts on lines 124..132

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

        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 whenInitializing(handler: Function): ILifecycle {
                if (this.initialized) {
                    this.reportError(LifecycleError.LATE_HANDLER_ERROR_MESSAGE);
                }
                this.addEventListener(LifecycleEvent.INITIALIZE, this.createSyncLifecycleListener(handler, true));
        Severity: Major
        Found in src/robotlegs/bender/framework/impl/Lifecycle.ts and 1 other location - About 2 hrs to fix
        src/robotlegs/bender/framework/impl/Lifecycle.ts on lines 184..190

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

        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 afterInitializing(handler: Function): ILifecycle {
                if (this.initialized) {
                    this.reportError(LifecycleError.LATE_HANDLER_ERROR_MESSAGE);
                }
                this.addEventListener(LifecycleEvent.POST_INITIALIZE, this.createSyncLifecycleListener(handler, true));
        Severity: Major
        Found in src/robotlegs/bender/framework/impl/Lifecycle.ts and 1 other location - About 2 hrs to fix
        src/robotlegs/bender/framework/impl/Lifecycle.ts on lines 173..179

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

        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 exports has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = config => {
            "use strict";
        
            var configuration = {
                basePath: "",
        Severity: Major
        Found in karma.conf.js - About 2 hrs to fix

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

                  this._domListeners.forEach((domEventConfig: DomEventMapConfig) => {
                      domDispatcher = domEventConfig.dispatcher;
                      domDispatcher.removeEventListener(domEventConfig.eventString, domEventConfig.listener, domEventConfig.options);
                      this._suspendedDomListeners.push(domEventConfig);
                  });
          src/robotlegs/bender/extensions/localEventMap/impl/EventMap.ts on lines 280..284

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

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

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

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

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

          Refactorings

          Further Reading

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

                  this._suspendedDomListeners.forEach((domEventConfig: DomEventMapConfig) => {
                      domDispatcher = domEventConfig.dispatcher;
                      domDispatcher.addEventListener(domEventConfig.eventString, domEventConfig.listener, domEventConfig.options);
                      this._domListeners.push(domEventConfig);
                  });
          src/robotlegs/bender/extensions/localEventMap/impl/EventMap.ts on lines 241..245

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

          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 executeCommand has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public executeCommand(mapping: ICommandMapping, payload?: CommandPayload): void {
                  let hasPayload: boolean = payload && payload.hasPayload();
                  let injectionEnabled: boolean = hasPayload && mapping.payloadInjectionEnabled;
                  let command: ICommand = null;
          
          
          Severity: Minor
          Found in src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.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

          Function guardsApprove has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          export function guardsApprove(guards: any[], injector?: IInjector): boolean {
              for (let guard of guards) {
                  if (typeof guard === "function" && guard.prototype.approve === undefined) {
                      if ((<Function>guard)()) {
                          continue;
          Severity: Minor
          Found in src/robotlegs/bender/framework/impl/guardsApprove.ts - About 1 hr 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

                  this._initialize = new LifecycleTransition(LifecycleEvent.PRE_INITIALIZE, this)
                      .fromStates(LifecycleState.UNINITIALIZED)
                      .toStates(LifecycleState.INITIALIZING, LifecycleState.ACTIVE)
                      .withEvents(LifecycleEvent.PRE_INITIALIZE, LifecycleEvent.INITIALIZE, LifecycleEvent.POST_INITIALIZE);
          Severity: Major
          Found in src/robotlegs/bender/framework/impl/Lifecycle.ts and 1 other location - About 1 hr to fix
          src/robotlegs/bender/framework/impl/Lifecycle.ts on lines 340..343

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

                  this._resume = new LifecycleTransition(LifecycleEvent.PRE_RESUME, this)
                      .fromStates(LifecycleState.SUSPENDED)
                      .toStates(LifecycleState.RESUMING, LifecycleState.ACTIVE)
                      .withEvents(LifecycleEvent.PRE_RESUME, LifecycleEvent.RESUME, LifecycleEvent.POST_RESUME);
          Severity: Major
          Found in src/robotlegs/bender/framework/impl/Lifecycle.ts and 1 other location - About 1 hr to fix
          src/robotlegs/bender/framework/impl/Lifecycle.ts on lines 329..332

          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

          Function enter has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public enter(callback?: Function): void {
                  // immediately call back if we have already transitioned, and exit
                  if (this._lifecycle.state === this._finalState) {
                      if (callback) {
                          safelyCallBack(callback, null, this._name);
          Severity: Minor
          Found in src/robotlegs/bender/framework/impl/LifecycleTransition.ts - About 1 hr to fix

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

                        if (this._injector.satisfiesDirectly(IViewManager)) {
                            this._viewManager = this._injector.getInstance(IViewManager);
                            this._viewManager.addViewHandler(<IViewHandler>this._viewProcessorMap );
                        }
            not-ported-extensions/viewProcessorMap/ViewProcessorMapExtension.ts on lines 69..72

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

            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

                        if (this._injector.satisfiesDirectly(IViewManager)) {
                            this._viewManager = this._injector.getInstance(IViewManager);
                            this._viewManager.removeViewHandler(<IViewHandler>this._viewProcessorMap );
                        }
            not-ported-extensions/viewProcessorMap/ViewProcessorMapExtension.ts on lines 60..63

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

            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 release(...instances: any[]): IContext {
                    instances.forEach((instance: any) => {
                        this._pin.release(instance);
                    });
                    return this;
            Severity: Major
            Found in src/robotlegs/bender/framework/impl/Context.ts and 1 other location - About 1 hr to fix
            src/robotlegs/bender/framework/impl/Context.ts on lines 363..368

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

            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