perryrh0dan/taskline

View on GitHub
src/renderer.ts

Summary

Maintainability
F
3 days
Test Coverage

File renderer.ts has 663 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Signale, SignaleConstructorOptions } from '@perryrh0dan/signale';
import { addWeeks, isBefore, endOfDay, toDate } from 'date-fns';
import * as figures from 'figures';
import ora = require('ora');

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

    Renderer has 57 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class Renderer {
      private static _instance: Renderer;
      private spinner: ora.Ora;
      private signale: any;
      private theme: Theme;
    Severity: Major
    Found in src/renderer.ts - About 1 day to fix

      Function displayItemByBoard has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        private displayItemByBoard(item: Item): void {
          const age = this.getAge(item.timestamp);
          let dueDate;
          if (item instanceof Task && item.dueDate !== 0 && !item.isComplete) {
            dueDate = this.getDueDate(item.dueDate);
      Severity: Minor
      Found in src/renderer.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 configureSignale has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private configureSignale(): void {
          const signaleOptions: SignaleConstructorOptions = {
            config: {
              displayLabel: false
            },
      Severity: Minor
      Found in src/renderer.ts - About 1 hr to fix

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

          private displayItemByBoard(item: Item): void {
            const age = this.getAge(item.timestamp);
            let dueDate;
            if (item instanceof Task && item.dueDate !== 0 && !item.isComplete) {
              dueDate = this.getDueDate(item.dueDate);
        Severity: Minor
        Found in src/renderer.ts - About 1 hr to fix

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

            public displayStats(percent: number, complete: number, canceled: number, inProgress: number, pending: number, notes: number): void {
              if (!Config.instance.get().displayProgressOverview) {
                return;
              }
          
          
          Severity: Minor
          Found in src/renderer.ts - About 1 hr to fix

            Function displayItemByDate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              private displayItemByDate(item: Item): void {
                const boards = item.boards.filter((x: string) => x !== 'My Board');
                const star = this.getStar(item);
            
                const prefix = this.buildPrefix(item);
            Severity: Minor
            Found in src/renderer.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 buildTaskMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              private buildTaskMessage(item: Task): string {
                const message: Array<string> = [];
            
                if (!item.isComplete && !item.isCanceled && item.priority > 1) {
                  message.push(this.getTaskColorMethod(item).underline(item.description));
            Severity: Minor
            Found in src/renderer.ts - About 35 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 displayStats has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              public displayStats(percent: number, complete: number, canceled: number, inProgress: number, pending: number, notes: number): void {
                if (!Config.instance.get().displayProgressOverview) {
                  return;
                }
            
            
            Severity: Minor
            Found in src/renderer.ts - About 35 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