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');
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;
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);
- Read upRead up
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
},
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);
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;
}
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);
- Read upRead up
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));
- Read upRead up
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;
}
- Read upRead up
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"