swimlane/ngx-charts

View on GitHub

Showing 208 of 208 total issues

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

  update(): void {
    super.update();

    this.dims = calculateViewDimensions({
      width: this.width,

    Function scaleText has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      scaleText(element: ElementType, repeat: boolean = true): void {
        let el;
        let resizeScale;
        if (element === ElementType.Value) {
          el = this.valueTextEl;

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

        update(): void {
          super.update();
      
          if (!this.showDataLabel) {
            this.dataLabelMaxHeight = { negative: 0, positive: 0 };

        Function generateData has 32 lines of code (exceeds 25 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 1 hr to fix

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

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

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

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

              Function roundedRect has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function roundedRect(
                x: number,
                y: number,
                w: number,
                h: number,
              Severity: Minor
              Found in projects/swimlane/ngx-charts/src/lib/common/shape.helper.ts - About 1 hr to fix

                Function scaleText has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  scaleText(element: ElementType, repeat: boolean = true): void {
                    let el;
                    let resizeScale;
                    if (element === ElementType.Value) {
                      el = this.valueTextEl;

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

                export function getDomain(
                  values: any[],
                  scaleType: ScaleType,
                  autoScale: boolean,
                  minVal?: number,

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

                  setTransforms() {
                    if (isPlatformServer(this.platformId)) {
                      this.styleTransform = `translate3d(${this.textX}px,${this.textY}px, 0)`;
                      this.attrTransform = `translate(${this.textX},${this.textY})`;
                      this.textTransition = !this.animations ? null : 'transform 0.75s';

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

                  projectComponentBindings(component: ComponentRef<any>, bindings: any): ComponentRef<any> {
                    if (bindings) {
                      if (bindings.inputs !== undefined) {
                        const bindingKeys = Object.getOwnPropertyNames(bindings.inputs);
                        for (const bindingName of bindingKeys) {

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

                export function calculateViewDimensions({
                  width,
                  height,
                  margins,
                  showXAxis = false,

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

                  update(): void {
                    const scale = this.scale;
                    this.ticks = this.getTicks();
                
                    if (this.tickFormatting) {

                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 31 lines of code (exceeds 25 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 1 hr to fix

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

                    update(): void {
                      super.update();
                  
                      if (!this.showDataLabel) {
                        this.dataLabelMaxHeight = { negative: 0, positive: 0 };

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

                      update(): void {
                        this.updateGradients();
                    
                        const line = this.getLineGenerator();
                    
                    

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

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

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

                          update(): void {
                            super.update();
                        
                            this.hasPreviousValue = this.previousValue !== undefined;
                            this.max = Math.max(this.max, this.value);

                          Function getXDomainArray has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function getXDomainArray(
                            values: Array<string | number | Date>,
                            xScaleMin?: number,
                            xScaleMax?: number
                          ): { domain: any[]; xSet: any[]; scaleType: string } {
                          Severity: Minor
                          Found in projects/swimlane/ngx-charts/src/lib/common/domain.helper.ts - About 1 hr to fix

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

                              update(): void {
                                this.zone.run(() => {
                                  const hasValue = this.data && typeof this.data.value !== 'undefined';
                                  const valueFormatting = this.valueFormatting || (card => card.value.toLocaleString());
                                  const labelFormatting = this.labelFormatting || (card => escapeLabel(trimLabel(card.label, 55)));
                            Severity: Minor
                            Found in projects/swimlane/ngx-charts/src/lib/number-card/card.component.ts - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language