microting/ngx-charts

View on GitHub

Showing 204 of 204 total issues

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

  getTooltipText(circle): string {
    const hasRadius = typeof circle.r !== 'undefined';
    const hasTooltipLabel = circle.tooltipLabel && circle.tooltipLabel.length;
    const hasSeriesName = circle.seriesName && circle.seriesName.length;

Severity: Minor
Found in demo/bubble-chart-interactive/bubble-series-interactive.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 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 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 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() {
            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 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(): 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 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

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

          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 placement;
            Severity: Major
            Found in src/common/tooltip/position/position.ts - About 30 mins to fix

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

                update(): void {
                  this.updateGradient();
              
                  let currentArea;
                  let startingArea;
              Severity: Minor
              Found in src/area-chart/area-series.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