swimlane/ngx-charts

View on GitHub

Showing 208 of 208 total issues

Avoid too many return statements within this function.
Open

    return placement;
Severity: Major
Found in projects/swimlane/ngx-charts/src/lib/common/tooltip/position/position.ts - About 30 mins to fix

    Function generateGraph has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function generateGraph(nodeCount: number) {
      const nodes = [];
      const links = [];
      for (let i = 0; i < nodeCount; i++) {
        const country = countries[Math.floor(Math.random() * countries.length)];
    Severity: Minor
    Found in src/app/data.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 getXDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getXDomain(): any[] {
        const 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 scaleText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      scaleText(repeat: boolean = true): void {
        if (!this.showText) {
          return;
        }
        const { width } = this.textEl.nativeElement.getBoundingClientRect();
    Severity: Minor
    Found in projects/swimlane/ngx-charts/src/lib/gauge/gauge.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 getXValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getXValues(): any[] {
        const values = [];
        for (const results of this.results) {
          for (const d of results.series) {
            if (!values.includes(d.name)) {

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

      updateGradient() {
        if (this.colors.scaleType === ScaleType.Linear) {
          this.hasGradient = true;
          if (this.stacked || this.normalized) {
            const d0values = this.data.series.map(d => d.d0);
    Severity: Minor
    Found in projects/swimlane/ngx-charts/src/lib/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

    Function getXScaleLine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getXScaleLine(domain, width): any {
        let scale;
        if (this.bandwidth === undefined) {
          this.bandwidth = width - this.barPadding;
        }
    Severity: Minor
    Found in src/app/custom-charts/combo-chart/combo-chart.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.updateTooltipSettings();
        const width = this.series && this.series.series.length ? Math.round(this.xScale.bandwidth()) : null;
        const seriesName = this.series.name;
    
    
    Severity: Minor
    Found in projects/swimlane/ngx-charts/src/lib/box-chart/box-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

    Function getInnerDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getInnerDomain(): string[] {
        const domain = [];
        for (const group of this.results) {
          for (const d of group.series) {
            if (!domain.includes(d.label)) {

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

      getXDomain(): number[] {
        const 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 getInnerDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getInnerDomain(): string[] {
        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 getInnerDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getInnerDomain(): string[] {
        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 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 projects/swimlane/ngx-charts/src/lib/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

    Function getYDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getYDomain(): any[] {
        const 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 getInnerDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getInnerDomain(): string[] {
        const domain = [];
        for (const group of this.results) {
          for (const d of group.series) {
            if (!domain.includes(d.label)) {

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

      runCheck(): void {
        const check = () => {
          if (!this.element) {
            return;
          }
    Severity: Minor
    Found in projects/swimlane/ngx-charts/src/lib/utils/visibility-observer.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 getYDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getYDomain(): [number, number] {
        const values = this.results.map(d => d.value);
    
        let min = this.yScaleMin ? Math.min(this.yScaleMin, ...values) : Math.min(0, ...values);
        if (this.yAxisTicks && !this.yAxisTicks.some(isNaN)) {
    Severity: Minor
    Found in projects/swimlane/ngx-charts/src/lib/bar-chart/bar-vertical.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(): string[] {
        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 updateTooltipSettings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      updateTooltipSettings() {
        if (this.tooltipDisabled) {
          this.tooltipPlacement = undefined;
          this.tooltipType = undefined;
        } else {
    Severity: Minor
    Found in projects/swimlane/ngx-charts/src/lib/box-chart/box-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

    Function getYDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      getYDomain(): number[] {
        const domain: Array<number | Date> = [];
        for (const results of this.results) {
          for (const d of results.series) {
            if (domain.indexOf(d.value) < 0) {
    Severity: Minor
    Found in projects/swimlane/ngx-charts/src/lib/box-chart/box-chart.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