microting/ngx-charts

View on GitHub

Showing 204 of 204 total issues

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

  getDimension(value: string | number | Array<string | number>, index = 0, N: number, L: number): number {
    if (typeof value === 'string') {
      value = value
        .replace('[', '')
        .replace(']', '')
Severity: Minor
Found in src/heat-map/heat-map.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

Consider simplifying this complex logical expression.
Open

    if (this.data.length > 2) {
      const valueFormatting = this.valueFormatting || (card => card.value.toLocaleString());

      const sortedLengths = this.data
        .map(d => {
Severity: Major
Found in src/number-card/card-series.component.ts - About 40 mins to fix

    Function count has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export function count(countFrom, countTo, countDecimals, countDuration, callback) {
    Severity: Minor
    Found in src/common/count/count.helper.ts - About 35 mins to fix

      Function getDomain has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      export function getDomain(values, scaleType, autoScale, minVal?, maxVal?): number[] {
      Severity: Minor
      Found in src/bubble-chart/bubble-chart.utils.ts - About 35 mins to fix

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

          getValueDomain() {
            const domain = [];
            for (const group of this.results) {
              for (const d of group.series) {
                if (!domain.includes(d.value)) {
        Severity: Minor
        Found in src/bar-chart/bar-vertical-2d.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 getValueDomain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getValueDomain(): any[] {
            const domain = [];
        
            for (const group of this.results) {
              for (const d of group.series) {
        Severity: Minor
        Found in src/bar-chart/bar-horizontal-2d.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          update(): void {
            this.updateGradients();
        
            const data = this.sortData(this.data.series);
        
        
        Severity: Minor
        Found in src/line-chart/line-series.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          update(): void {
            super.update();
        
            if (!this.showAxis) {
              if (!this.margin) {
        Severity: Minor
        Found in src/gauge/gauge.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 getValueDomain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getValueDomain() {
            const domain = [];
            for (const group of this.results) {
              for (const d of group.series) {
                if (!domain.includes(d.value)) {
        Severity: Minor
        Found in src/bar-chart/bar-vertical-2d-stacked.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 onMouseLeave has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          @HostListener('mouseleave', ['$event.target'])
          onMouseLeave(target): void {
            if(this.listensForHover && this.tooltipCloseOnMouseLeave) {
              clearTimeout(this.timeout);
        
        
        Severity: Minor
        Found in src/common/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 getScaleType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getScaleType(values): string {
            let date = true;
            let num = true;
            for (const value of values) {
              if (!this.isDate(value)) {
        Severity: Minor
        Found in src/area-chart/area-chart.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 findClosestPointIndex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          findClosestPointIndex(xPos) {
            let minIndex = 0;
            let maxIndex = this.xSet.length - 1;
            let minDiff = Number.MAX_VALUE;
            let closestIndex = 0;
        Severity: Minor
        Found in src/common/tooltip-area.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 getScaleType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getScaleType(values): string {
            let date = true;
            let num = true;
        
            for (const value of values) {
        Severity: Minor
        Found in demo/sparkline/sparkline.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 getScaleType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getScaleType(values): string {
            let date = true;
            let num = true;
        
            for (const value of values) {
        Severity: Minor
        Found in demo/combo-chart/combo-chart.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

        Avoid too many return statements within this function.
        Open

              if (bDate > aDate) return 1;
        Severity: Major
        Found in src/utils/sort.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return 0;
          Severity: Major
          Found in src/utils/sort.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return placement;
            Severity: Major
            Found in src/common/tooltip/position/position.ts - About 30 mins to fix

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

              export function trimLabel(s, max = 16): string {
                if(typeof s !== 'string') {
                  if(typeof s === 'number') {
                    return s + '';
                  } else {
              Severity: Minor
              Found in src/common/trim-label.helper.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 scaleText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                scaleText(repeat: boolean = true): void {
                  if (!this.showText) {
                    return;
                  }
                  const { width } = this.textEl.nativeElement.getBoundingClientRect();
              Severity: Minor
              Found in src/gauge/gauge.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 getInnerDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                getInnerDomain(): any[] {
                  const domain = [];
              
                  for (const group of this.results) {
                    for (const d of group.series) {
              Severity: Minor
              Found in src/bar-chart/bar-horizontal-normalized.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

              Severity
              Category
              Status
              Source
              Language