mseemann/angular2-mdl

View on GitHub

Showing 40 of 40 total issues

Function calcStyle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  public calcStyle(
    offsetWidth: number,
    offsetHeight: number,
    props: ClientRect,
    position: string
Severity: Minor
Found in projects/core/src/lib/tooltip/mdl-tooltip-position.service.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 downHandler_ has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MaterialRipple.prototype.downHandler_ = function (event) {
  if (!this.rippleElement_.style.width && !this.rippleElement_.style.height) {
    const rect = this.element_.getBoundingClientRect();
    this.boundHeight = rect.height;
    this.boundWidth = rect.width;
Severity: Minor
Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 1 hr to fix

    Function setRippleStyles has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          this.setRippleStyles = function (start) {
            if (this.rippleElement_ !== null) {
              let transformString;
              let scale;
              let size;
    Severity: Minor
    Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 1 hr to fix

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

        private calculateCoordinates(
          forElement: HTMLElement,
          popoverElement: HTMLElement,
          position: string
        ): IPositionCoordinates | null {
      Severity: Minor
      Found in projects/popover/src/lib/popover.component.ts - About 1 hr to fix

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

          public calcStyle(
            offsetWidth: number,
            offsetHeight: number,
            props: ClientRect,
            position: string
        Severity: Minor
        Found in projects/core/src/lib/tooltip/mdl-tooltip-position.service.ts - About 1 hr to fix

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

            show(): Observable<MdlDialogReference> {
              if (this.isShown) {
                throw new Error("Only one instance of an embedded mdl-dialog can exist!");
              }
              this.isShown = true;
          Severity: Minor
          Found in projects/core/src/lib/dialog/mdl-dialog.component.ts - About 1 hr to fix

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

              ngAfterContentInit(): void {
                this.validateMode();
            
                if (this.header && this.content && this.content.tabs) {
                  this.header.tabs = this.content.tabs;
            Severity: Minor
            Found in projects/core/src/lib/layout/mdl-layout.component.ts - About 1 hr to fix

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

                show(event: Event, mdlButton: MdlButtonComponent): void {
                  this.menuRegistry.hideAllExcept(this);
              
                  event.stopPropagation();
              
              
              Severity: Minor
              Found in projects/core/src/lib/menu/mdl-menu.component.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 writeValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                public writeValue(value: string | string[] | undefined): void {
                  if (this.multiple) {
                    this.model = this.model || [];
                    if (!value || this.model === value) {
                      // skip ngModel update when undefined value or multiple selects initialized with same array
              Severity: Minor
              Found in projects/select/src/lib/select.component.ts - About 45 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 deeply nested control flow statements.
              Open

                          if (recentering) {
                            offset =
                              "translate(" +
                              this.boundWidth / 2 +
                              "px, " +
              Severity: Major
              Found in projects/core/src/lib/ripple/ripple.vendor.ts - About 45 mins to fix

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

                  showSnackbar(
                    snackbarMessage: IMdlSnackbarMessage
                  ): Observable<MdlSnackbarComponent> {
                    const optTimeout = snackbarMessage.timeout || 2750;
                    const closeAfterTimeout = !!snackbarMessage.closeAfterTimeout;
                Severity: Minor
                Found in projects/core/src/lib/snackbar/mdl-snackbar.service.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

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

                  show(): void {
                    this.visible = true;
                    // give the dialogs time to draw so that a focus can be set
                    setTimeout(() => {
                      this.internalDialogRef.visible();
                Severity: Minor
                Found in projects/core/src/lib/dialog/mdl-dialog-host.component.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

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

                  private renderValue(value: string | string[] | undefined) {
                    if (this.multiple) {
                      this.text = ((value as string[]) || [])
                        .map((valueItem: string) => this.textByValue[stringifyValue(valueItem)])
                        .join(", ");
                Severity: Minor
                Found in projects/select/src/lib/select.component.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

                Function applyClip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private applyClip(height: number | undefined, width: number | undefined) {
                    if (!this.menuElement) {
                      return;
                    }
                    if (this.position === UNALIGNED) {
                Severity: Minor
                Found in projects/core/src/lib/menu/mdl-menu.component.ts - About 25 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 onArrow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private onArrow($event: KeyboardEvent, offset: number) {
                    const arr = this.optionComponents
                      ?.toArray()
                      .filter(({ disabled }) => !disabled);
                    if (!arr) {
                Severity: Minor
                Found in projects/select/src/lib/select.component.ts - About 25 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 checkValidity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private checkValidity() {
                    // check the global setting - if globally disabled do no check
                    if (this.nativeCheckGlobalDisabled === true) {
                      return;
                    }
                Severity: Minor
                Found in projects/core/src/lib/textfield/mdl-textfield.component.ts - About 25 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 onKeyDown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  @HostListener("keydown", ["$event"])
                  public onKeyDown($event: KeyboardEvent): void {
                    if (!this.disabled && this.popoverComponent?.isVisible && !this.multiple) {
                      if (isKey($event, KEYS.upArrow)) {
                        this.onArrow($event, -1);
                Severity: Minor
                Found in projects/select/src/lib/select.component.ts - About 25 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

                TODO found
                Open

                  // TODO(sgomes): Replace with an icon button when we have that component.

                TODO found
                Open

                  // TODO: In some cases (Retina displays), this is big enough to render the

                HACK found
                Open

                * HACK: Even though the intention is to have the current .mdl-spinner__layer-N
                Severity
                Category
                Status
                Source
                Language