microting/ngx-charts

View on GitHub

Showing 204 of 204 total issues

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;

Severity: Minor
Found in src/pie-chart/pie-series.component.ts - About 1 hr to fix

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

      generateColorScheme(scheme: ColorSet | string, type: ScaleType, domain) {
        if (typeof scheme === 'string') {
          scheme = colorSets.find(cs => {
            return cs.name === scheme;
          });
    Severity: Minor
    Found in src/common/color.helper.ts - About 1 hr to fix

      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 src/common/base-chart.component.ts - About 1 hr to fix

        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,
        Severity: Minor
        Found in src/polar-chart/polar-chart.component.ts - About 1 hr to fix

          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 src/pie-chart/pie-arc.component.ts - About 1 hr to fix

            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) {
            Severity: Minor
            Found in src/common/timeline/timeline.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 mapDataPointToCircle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              mapDataPointToCircle(d: any, i: number): any {
                const seriesName = this.data.name;
            
                const value = d.value;
                const label = d.name;
            Severity: Minor
            Found in src/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 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 = [];
            Severity: Minor
            Found in src/area-chart/area-chart-normalized.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 src/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

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

              getStartingPath() {
                if (!this.animations) {
                  return this.getPath();
                }
            
            
            Severity: Minor
            Found in src/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 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 src/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 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;
            Severity: Minor
            Found in src/bubble-chart/bubble-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() {
                let yMin = 0;
                let xMin = 0;
                let yMax = this.dims.height;
                let xMax = this.dims.width;
            Severity: Minor
            Found in demo/bubble-chart-interactive/bubble-chart-interactive.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 demo/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 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 demo/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 update has a Cognitive Complexity of 8 (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 src/pie-chart/pie-chart.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

            export function roundedRect(x, y, w, h, r, [tl, tr, bl, br]: boolean[]) {
            Severity: Minor
            Found in src/common/shape.helper.ts - About 45 mins to fix

              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 src/bubble-chart/bubble-series.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 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

              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 demo/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

              Severity
              Category
              Status
              Source
              Language