swimlane/ngx-charts

View on GitHub

Showing 208 of 208 total issues

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

export function generateData(seriesLength: number, includeMinMaxRange: boolean, dataPoints: number = 5): MultiSeries {
  const results: MultiSeries = [];

  const domain: Date[] = []; // array of time stamps in milliseconds

Severity: Minor
Found in src/app/data.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 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;

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 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;

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

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

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

  x: number,
  y: number,
  w: number,
  h: number,
  r: number,
Severity: Minor
Found in projects/swimlane/ngx-charts/src/lib/common/shape.helper.ts - About 45 mins to fix

    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 => {

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

        values: any[],
        scaleType: ScaleType,
        autoScale: boolean,
        minVal?: number,
        maxVal?: number
      Severity: Minor
      Found in projects/swimlane/ngx-charts/src/lib/bubble-chart/bubble-chart.utils.ts - About 35 mins to fix

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

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

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

            update(): void {
              super.update();
          
              if (this.labels && this.hasNoOptionalMarginsSet()) {
                this.margins = [30, 80, 30, 80];
          Severity: Minor
          Found in projects/swimlane/ngx-charts/src/lib/pie-chart/pie-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 getValueDomain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            getValueDomain(): [number, number] {
              const domain = [];
              for (const group of this.results) {
                for (const d of group.series) {
                  if (!domain.includes(d.value)) {

          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): ScaleType {
              let date = true;
              let num = true;
          
              for (const value of values) {
          Severity: Minor
          Found in src/app/custom-charts/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

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

            getValueDomain(): [number, number] {
              const domain = [];
          
              for (const group of this.results) {
                for (const d of group.series) {

          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): ScaleType {
              let date = true;
              let num = true;
          
              for (const value of values) {
          Severity: Minor
          Found in src/app/custom-charts/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): ScaleType {
              let date = true;
              let num = true;
              for (const value of values) {
                if (isDate(value)) {
          Severity: Minor
          Found in projects/swimlane/ngx-charts/src/lib/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 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 projects/swimlane/ngx-charts/src/lib/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 projects/swimlane/ngx-charts/src/lib/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 findClosestPointIndex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            findClosestPointIndex(xPos: number): number {
              let minIndex = 0;
              let maxIndex = this.xSet.length - 1;
              let minDiff = Number.MAX_VALUE;
              let closestIndex = 0;
          Severity: Minor
          Found in projects/swimlane/ngx-charts/src/lib/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 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 projects/swimlane/ngx-charts/src/lib/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

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

                  return 0;
            Severity: Major
            Found in projects/swimlane/ngx-charts/src/lib/utils/sort.ts - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language