oramics/dsp-kit

View on GitHub

Showing 29 of 150 total issues

Function DFT has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function DFT(size, window) {
  if (!window) window = fill(winFn, size);
  if (window.length !== size)
    throw Error(
      "Window size must be " + size + " length but is " + window.length
Severity: Minor
Found in packages/spectral-models/src/dft.js - About 45 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 forward has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export default function forward (bufferSize, buffer, trans, spectrum, table) {
Severity: Minor
Found in packages/rfft/lib/forward.js - About 35 mins to fix

    Function compute has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function compute (real, imag, samples, power, dir) {
    Severity: Minor
    Found in packages/fft-asm/versions/arduino.js - About 35 mins to fix

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

      function toComplex (signal, size) {
        if (!signal) {
          if (!size) throw Error('A signal is required')
          return { real: new Float32Array(size), imag: new Float32Array(size) }
        } else if (signal.length) {
      Severity: Minor
      Found in packages/dft/index.js - 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 roundTo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function roundTo (dec) {
        return function round (arr, n = dec, output) {
          const size = arr.length
          if (!output) output = new Float64Array(size)
          const limit = Math.min(size, output.length)
      Severity: Minor
      Found in packages/array/index.js - 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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function process (inverse, signal, output) {
        let r, i, theta
        const { real, imag } = signal
        // we take the size of the output. It can be smaller than the source
        const size = output.real.length
      Severity: Minor
      Found in packages/dft/index.js - 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 exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function (canvas, data, color, maxStep = 1000) {
        var ctx = canvas.getContext('2d')
        if (color) ctx.fillStyle = color
        var width = canvas.width
        var height = canvas.height
      Severity: Minor
      Found in packages/waa/lib/draw-waveform.js - 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 polar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function polar (result, output) {
        const { real, imag } = result
        const len = real.length
        if (!output) output = { magnitudes: zeros(len), phases: zeros(len) }
        const { magnitudes, phases } = output
      Severity: Minor
      Found in packages/spectrum/index.js - About 25 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 stft has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function stft (input, window, output, inputSize, fftSize, hopSize) {
        const fft = new FFT(fftSize)
        const fftOut = fft.createComplexArray()
        const frame = new Array(fftSize)
      
      
      Severity: Minor
      Found in packages/stft/index.js - About 25 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

      Severity
      Category
      Status
      Source
      Language