nukeop/nuclear

View on GitHub
packages/app/app/actions/queue.ts

Summary

Maintainability
C
1 day
Test Coverage

Function findStreamsForTrack has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

export const findStreamsForTrack = (index: number) => async (dispatch, getState) => {
  const {queue, settings}: RootState = getState();
  const track = queue.queueItems[index];

  if (track && !track.local && trackHasNoFirstStream(track)) {
Severity: Minor
Found in packages/app/app/actions/queue.ts - About 3 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

File queue.ts has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logger from 'electron-timber';
import _, { isEmpty, isString } from 'lodash';
import { createStandardAction } from 'typesafe-actions';
import { v4 } from 'uuid';

Severity: Minor
Found in packages/app/app/actions/queue.ts - About 2 hrs to fix

    Function findStreamsForTrack has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const findStreamsForTrack = (index: number) => async (dispatch, getState) => {
      const {queue, settings}: RootState = getState();
      const track = queue.queueItems[index];
    
      if (track && !track.local && trackHasNoFirstStream(track)) {
    Severity: Major
    Found in packages/app/app/actions/queue.ts - About 2 hrs to fix

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

        (item: QueueItem, asNextItem = false) =>
          async (dispatch, getState) => {
            const { local }: RootState = getState();
            item = {
              ...safeAddUuid(item),
      Severity: Minor
      Found in packages/app/app/actions/queue.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

      There are no issues that match your filters.

      Category
      Status