swimlane/ngx-charts

View on GitHub
src/app/app.component.ts

Summary

Maintainability
F
3 days
Test Coverage

File app.component.ts has 668 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Location, LocationStrategy, HashLocationStrategy } from '@angular/common';
import * as shape from 'd3-shape';
import * as d3Array from 'd3-array';

Severity: Major
Found in src/app/app.component.ts - About 1 day to fix

    AppComponent has 43 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Component({
      selector: 'app-root',
      providers: [Location, { provide: LocationStrategy, useClass: HashLocationStrategy }],
      encapsulation: ViewEncapsulation.None,
      styleUrls: ['../../node_modules/@swimlane/ngx-ui/index.css', './app.component.scss'],
    Severity: Minor
    Found in src/app/app.component.ts - About 5 hrs to fix

      Function updateData has 131 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        updateData() {
          if (!this.realTimeData) {
            return;
          }
      
      
      Severity: Major
      Found in src/app/app.component.ts - About 5 hrs to fix

        Function updateData has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          updateData() {
            if (!this.realTimeData) {
              return;
            }
        
        
        Severity: Minor
        Found in src/app/app.component.ts - About 2 hrs 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 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 calcStatusData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            calcStatusData(sales = this.statusData[0].value, dur = this.statusData[2].value) {
              const ret = sales * this.salePrice;
              const cost = ((sales * dur) / 60 / 60 / 1000) * this.personnelCost;
              const ROI = (ret - cost) / cost;
              return [
          Severity: Minor
          Found in src/app/app.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

            There are no issues that match your filters.

            Category
            Status