swimlane/ngx-charts

View on GitHub

Showing 208 of 208 total issues

Function getYDomainLine has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getYDomainLine(): any[] {
    const domain = [];

    for (const results of this.lineChart) {
      for (const d of results.series) {
Severity: Minor
Found in src/app/custom-charts/combo-chart/combo-chart.component.ts - About 1 hr to fix

    Function exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(config) {
      config.set({
        basePath: '',
        frameworks: ['jasmine', '@angular-devkit/build-angular'],
        plugins: [
    Severity: Minor
    Found in karma.conf.js - About 1 hr to fix

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

        update(): void {
          if (this.valueFormatting) {
            this.formatedValue = this.valueFormatting(this.value);
          } else {
            this.formatedValue = formatLabel(this.value);

        Function getYDomain has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getYDomain(): [number, number] {
            const domain = [];
            for (const results of this.results) {
              for (const d of results.series) {
                if (domain.indexOf(d.value) < 0) {

          Function getYDomain has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getYDomain(): any[] {
              if (this.valueDomain) {
                return this.valueDomain;
              }
          
          
          Severity: Minor
          Found in src/app/custom-charts/sparkline/sparkline.component.ts - About 1 hr to fix

            Function getCards has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              getCards(): CardModel[] {
                const yPadding =
                  typeof this.innerPadding === 'number' ? this.innerPadding : this.innerPadding[0] + this.innerPadding[2];
                const xPadding =
                  typeof this.innerPadding === 'number' ? this.innerPadding : this.innerPadding[1] + this.innerPadding[3];

              Function loadAnimation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                loadAnimation(): void {
                  const node = select(this.element)
                    .selectAll('.arc')
                    .data([{ startAngle: this.startAngle, endAngle: this.endAngle }]);
              
              
              Severity: Minor
              Found in projects/swimlane/ngx-charts/src/lib/pie-chart/pie-arc.component.ts - About 1 hr to fix

                Function calculateLabelPositions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function setDims has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    setDims() {
                      this.dims = calculateViewDimensions({
                        width: this.width,
                        height: this.height,
                        margins: this.margin,

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

                      update(): void {
                        if (this.results) {
                          this.results = this.cloneData(this.results);
                        } else {
                          this.results = [];
                    Severity: Minor
                    Found in projects/swimlane/ngx-charts/src/lib/common/base-chart.component.ts - About 1 hr to fix

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

                        getCalendarData(): any[] {
                          // today
                          const now = new Date();
                          const todaysDay = now.getDate();
                          const thisDay = new Date(now.getFullYear(), now.getMonth(), todaysDay);
                      Severity: Minor
                      Found in src/app/app.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 getStartingPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getStartingPath(): string {
                          if (!this.animations) {
                            return this.getPath();
                          }
                      
                      
                      Severity: Minor
                      Found in projects/swimlane/ngx-charts/src/lib/bar-chart/bar.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 getXDomainLine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getXDomainLine(): any[] {
                          let values = [];
                      
                          for (const results of this.lineChart) {
                            for (const d of results.series) {
                      Severity: Minor
                      Found in src/app/custom-charts/combo-chart/combo-chart.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 getBubblePadding has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getBubblePadding(): number[] {
                          let yMin = 0;
                          let xMin = 0;
                          let yMax = this.dims.height;
                          let xMax = this.dims.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 getBubblePadding has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getBubblePadding() {
                          let yMin = 0;
                          let xMin = 0;
                          let yMax = this.dims.height;
                          let xMax = this.dims.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 getXDomain has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        getXDomain(): any[] {
                          let values = getUniqueXDomainValues(this.results);
                      
                          this.scaleType = getScaleType(values);
                          let domain = [];

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

                        getXDomain(): any[] {
                          let values = [];
                      
                          for (const results of this.results) {
                            for (const d of results.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 mapDataPointToCircle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        mapDataPointToCircle(d: any, i: number): Circle {
                          const seriesName = this.data.name as string;
                      
                          const value = d.value;
                          const label = d.name;
                      Severity: Minor
                      Found in projects/swimlane/ngx-charts/src/lib/common/circle-series.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        update(): void {
                          if (this.results) {
                            this.results = this.cloneData(this.results);
                          } else {
                            this.results = [];
                      Severity: Minor
                      Found in projects/swimlane/ngx-charts/src/lib/common/base-chart.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 = false): void {
                          if (!this.component) return;
                      
                          const destroyFn = () => {
                            // remove events
                      Severity: Minor
                      Found in projects/swimlane/ngx-charts/src/lib/common/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

                      Severity
                      Category
                      Status
                      Source
                      Language