valor-software/angular2-bootstrap

View on GitHub
src/component-loader/component-loader.class.ts

Summary

Maintainability
C
7 hrs
Test Coverage

File component-loader.class.ts has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// tslint:disable:max-file-line-count
// todo: add delay support
// todo: merge events onShow, onShown, etc...
// todo: add global positioning configuration?
import {
Severity: Minor
Found in src/component-loader/component-loader.class.ts - About 2 hrs to fix

    Function show has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      show(opts: {
        content?: string | TemplateRef<any>;
        context?: any;
        initialState?: any; [key: string]: any;
      } = {}
    Severity: Minor
    Found in src/component-loader/component-loader.class.ts - About 1 hr to fix

      Function _getContentRef has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private _getContentRef(
          content: string | TemplateRef<any> | any,
          context?: any,
          initialState?: any
        ): ContentRef {
      Severity: Minor
      Found in src/component-loader/component-loader.class.ts - About 1 hr to fix

        Function show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          show(opts: {
            content?: string | TemplateRef<any>;
            context?: any;
            initialState?: any; [key: string]: any;
          } = {}
        Severity: Minor
        Found in src/component-loader/component-loader.class.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

        Function listen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          listen(listenOpts: ListenOptions): ComponentLoader<T> {
            this.triggers = listenOpts.triggers || this.triggers;
            this._listenOpts.outsideClick = listenOpts.outsideClick;
            listenOpts.target = listenOpts.target || this._elementRef.nativeElement;
        
        
        Severity: Minor
        Found in src/component-loader/component-loader.class.ts - About 35 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

        Avoid too many return statements within this function.
        Open

            return new ContentRef([[this._renderer.createText(`${content}`)]]);
        Severity: Major
        Found in src/component-loader/component-loader.class.ts - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status