swimlane/ngx-charts

View on GitHub

Showing 208 of 208 total issues

Function calculateLabelPositions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  calculateLabelPositions(pieData): any {
    const factor = 1.5;
    const minDistance = 10;
    const labelPositions = pieData;

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

  getYDomain(): any[] {
    if (this.valueDomain) {
      return this.valueDomain;
    }

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

  setTicks() {
    let tickFormat;
    if (this.xAxisTickFormatting) {
      tickFormat = this.xAxisTickFormatting;
    } else if (this.xScale.tickFormat) {

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 setTicks has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  setTicks() {
    let tickFormat;
    if (this.xAxisTickFormatting) {
      tickFormat = this.xAxisTickFormatting;
    } else if (this.xScale.tickFormat) {

    Function update has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      update(): void {
        this.updateTooltipSettings();
        const width = this.series && this.series.series.length ? Math.round(this.xScale.bandwidth()) : null;
        const seriesName = this.series.name;
    
    

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

        getValueDomain(): [number, number] {
          const domain = [];
          let smallest = 0;
          let biggest = 0;
          for (const group of this.results) {

      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 14 (exceeds 5 allowed). Consider refactoring.
      Open

        getValueDomain(): [number, number] {
          const domain = [];
          let smallest = 0;
          let biggest = 0;
          for (const group of this.results) {

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

        getTooltipMinMaxText(min: number, max: number): string {
          if (min !== undefined || max !== undefined) {
            let result = ' (';
            if (min !== undefined) {
              if (max === undefined) {

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

      export function count(countFrom: number, countTo: number, countDecimals: number, countDuration: number, callback: any) {
        const startVal = Number(countFrom);
        const endVal = Number(countTo);
        const countDown = startVal > endVal;
        const decimals = Math.max(0, countDecimals);
      Severity: Minor
      Found in projects/swimlane/ngx-charts/src/lib/common/count/count.helper.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 update has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

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

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

      export function gridLayout(
        dims: ViewDimensions,
        data: GridData[],
        minWidth: number,
        designatedTotal: number
      Severity: Minor
      Found in projects/swimlane/ngx-charts/src/lib/common/grid-layout.helper.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 getLinearGradientStops has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        getLinearGradientStops(value: number | string, start?: number | string): Gradient[] {
          if (start === undefined) {
            start = this.domain[0];
          }
          const valueScale = scaleLinear()
      Severity: Minor
      Found in projects/swimlane/ngx-charts/src/lib/common/color.helper.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 getTicks has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getTicks(): Ticks {
          const bigTickSegment = this.angleSpan / this.bigSegments;
          const smallTickSegment = bigTickSegment / this.smallSegments;
          const tickLength = 20;
          const ticks = {
      Severity: Minor
      Found in projects/swimlane/ngx-charts/src/lib/gauge/gauge-axis.component.ts - About 1 hr to fix

        Function getCircles has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getCircles(): any[] {
            const seriesName = this.data.name;
        
            return this.data.series
              .map((d, i) => {

          Function getCircles has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getCircles(): any[] {
              const seriesName = this.data.name;
          
              return this.data.series
                .map((d, i) => {

            Function getSeries has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              getSeries(): any[] {
                const total = this.designatedTotal ? this.designatedTotal : this.getTotal();
            
                return this.data.map(d => {
                  const baselineLabelHeight = 20;

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

                getTicks(): Ticks {
                  const bigTickSegment = this.angleSpan / this.bigSegments;
                  const smallTickSegment = bigTickSegment / this.smallSegments;
                  const tickLength = 20;
                  const ticks = {
              Severity: Minor
              Found in projects/swimlane/ngx-charts/src/lib/gauge/gauge-axis.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 update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                update(): void {
                  super.update();
              
                  this.dims = calculateViewDimensions({
                    width: this.width,

              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 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                update(): void {
                  this.updateGradient();
              
                  let currentArea;
                  let startingArea;

                Function getGridPanels has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  getGridPanels(): GridPanel[] {
                    return this.data.map(d => {
                      let offset;
                      let width;
                      let height;
                  Severity
                  Category
                  Status
                  Source
                  Language