swimlane/ngx-ui

View on GitHub

Showing 139 of 731 total issues

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

  addHideListeners(tooltip: HTMLElement): void {
    // on mouse enter, cancel the hide triggered by the leave
    this.mouseEnterContentEvent = this.renderer.listen(
      tooltip,
      'mouseenter',
Severity: Minor
Found in projects/swimlane/ngx-ui/src/lib/components/tooltip/tooltip.directive.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 parseDate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  private parseDate(date: string | Date): moment.Moment {
    if (date instanceof Date) {
      /* istanbul ignore next */
      date = isNaN(date.getTime()) ? date.toString() : date.toISOString();
    }

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

  ngOnChanges(changes: SimpleChanges) {
    super.ngOnChanges(changes);
    if ('level' in changes || 'hideRoot' in changes) {
      this.nextLevel = this.level === undefined ? (this.hideRoot ? -1 : 0) : this.level + 1;
    }

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

  private increment(event: MouseEvent) {
    event.preventDefault();

    if (!this.disabled) {
      const el = this.element.nativeElement as HTMLInputElement;
Severity: Minor
Found in projects/swimlane/ngx-ui/src/lib/components/input/input.component.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 hideTooltip has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  hideTooltip(immediate?: boolean): void {
    if (!this.component) return;

    const destroyFn = () => {
      // remove events
Severity: Minor
Found in projects/swimlane/ngx-ui/src/lib/components/tooltip/tooltip.directive.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 getFill has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  getFill(): any {
    if (this.filled) {
      const percentMin = this.multiple ? Math.min(...this._percents) : 0;
      const percentMax = this.multiple ? Math.max(...this._percents) : this._percents[0];
      const width = percentMax - percentMin;
Severity: Minor
Found in projects/swimlane/ngx-ui/src/lib/components/slider/slider.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

Function active has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  set active(v: number) {
    v = coerceNumberProperty(v);

    if (v !== undefined && !isNaN(v) && v !== this._active && v >= 0 && (!this._steps || v <= this._steps.length)) {
      this._active = v;
Severity: Minor
Found in projects/swimlane/ngx-ui/src/lib/components/stepper/stepper.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

Function getMinMaxPct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  minBasis: string,
  maxBasis: string,
  grow: string,
  shrink: string,
  baseBasisPct: number,

    Function active has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      set active(v: number) {
        v = coerceNumberProperty(v);
    
        if (
          v !== undefined &&
    Severity: Minor
    Found in projects/swimlane/ngx-ui/src/lib/components/navbar/navbar.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

    Function ngOnChanges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      ngOnChanges(changes: SimpleChanges) {
        if (changes.hide && changes.hide.currentValue !== changes.hide.previousValue) {
          if (changes.hide.currentValue === true) {
            // nag is hidden external from component
            this.state = State.closed;
    Severity: Minor
    Found in projects/swimlane/ngx-ui/src/lib/components/nag/nag.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 (patternRegex.test(prop)) {
                  schema = JSON.parse(JSON.stringify(this.schema.patternProperties[pattern]));
                  matchesPattern = true;
                }

      Function addArrayItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        addArrayItem(dataType?: JsonSchemaDataType): void {
          let schema;
          if (dataType) {
            if (dataType.name === 'String') {
              dataType.schema = { type: 'string' };

      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

      Consider simplifying this complex logical expression.
      Open

          if (
            v !== undefined &&
            !isNaN(v) &&
            v !== this._active &&
            v >= 0 &&
      Severity: Major
      Found in projects/swimlane/ngx-ui/src/lib/components/navbar/navbar.component.ts - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

            if (v !== undefined && !isNaN(v) && v !== this._active && v >= 0 && (!this._steps || v <= this._steps.length)) {
              this._active = v;
        
              if (this._steps) {
                for (const step of this._steps) {
        Severity: Major
        Found in projects/swimlane/ngx-ui/src/lib/components/stepper/stepper.component.ts - About 40 mins to fix

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

            updateWidth(): void {
              const inputText = this.ngModel ? this.ngModel.value : this._getProperty('value');
              const placeHolderText = this._getProperty('placeholder');
              const inputTextWidth = this.textWidth(inputText) + this.extraWidth + this.borderWidth + this.paddingWidth;
              const setMinWidth = this.minWidth > 0 && this.minWidth > inputTextWidth;

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

            @HostListener('mouseleave', ['$event'])
            onMouseLeave(event: { toElement: Node }): void {
              if (this.listensForHover && this.tooltipCloseOnMouseLeave) {
                clearTimeout(this.timeout);
          
          
          Severity: Minor
          Found in projects/swimlane/ngx-ui/src/lib/components/tooltip/tooltip.directive.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 updateHotkeys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            updateHotkeys(hotkeys: { [combo: string]: Hotkey[] }) {
              const hks: Hotkey[] = [];
          
              for (const comb in hotkeys) {
                for (const hotkey of hotkeys[comb]) {
          Severity: Minor
          Found in projects/swimlane/ngx-ui/src/lib/components/hotkeys/hotkeys.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 completeIcon has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            set completeIcon(v: string) {
              if (this._steps) {
                for (const step of this._steps) {
                  if (!step.completeIcon || step.completeIcon === this._completeIcon) {
                    step.completeIcon = v;
          Severity: Minor
          Found in projects/swimlane/ngx-ui/src/lib/components/stepper/stepper.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 getWeeksForDays has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          export function getWeeksForDays(days: CalendarDay[], startDay: number) {
            const weeks: CalendarMonth = [];
            let offset = 7;
          
            // fill front row

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

            focusFirst() {
              if (!this.disabled && this._radios) {
                const len = this._radios.length;
                for (let i = 0; i < len; i++) {
                  if (!this._radios.get(i).disabled) {

          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

          Severity
          Category
          Status
          Source
          Language