perryrh0dan/taskline

View on GitHub

Showing 29 of 32 total issues

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

export const getRelativeHumanizedDate = function (
  dueDate: Date,
  now?: Date,
): string {
  if (!now) now = new Date();
Severity: Minor
Found in src/libs/date.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 updatePriority has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public async updatePriority(ids: string, priority: string): Promise<void> {
    Renderer.instance.startLoading();

    let level: TaskPriority;
    try {
Severity: Minor
Found in src/taskline.ts - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

              if (!target[key]) {
                target[key] = {};
              }
    Severity: Major
    Found in src/utils/utils.ts - About 45 mins to fix

      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

      Function createTask has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        public async createTask(
          description: string,
          boards?: string,
          priority?: string,
          dueDate?: string
      Severity: Minor
      Found in src/taskline.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 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

      Avoid too many return statements within this function.
      Open

          return parsedDate;
      Severity: Major
      Found in src/libs/date.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return undefined;
        Severity: Major
        Found in src/libs/date.ts - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language