microting/ngx-charts

View on GitHub
demo/app.component.ts

Summary

Maintainability
F
3 days
Test Coverage

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

declare var APP_VERSION: string;

import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Location, LocationStrategy, HashLocationStrategy } from '@angular/common';
import * as shape from 'd3-shape';
Severity: Major
Found in demo/app.component.ts - About 1 day to fix

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

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

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

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

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

          updateData() {
            if (!this.realTimeData) {
              return;
            }
        
        
        Severity: Minor
        Found in demo/app.component.ts - About 1 hr 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 demo/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 demo/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 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

            There are no issues that match your filters.

            Category
            Status