oramics/dsp-kit

View on GitHub

Showing 29 of 150 total issues

Function fft has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function fft (size, input, output, dir) {
  if (arguments.length > 1) return fft(size)(input, dir, output)
  var cached = tables(size)

  return function process (dir, input, output) {
Severity: Minor
Found in packages/fft-asm/fft-no-asm.js - About 4 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 forward has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function forward (bufferSize, buffer, trans, spectrum, table) {
  var n = bufferSize,
    x = trans,
    n2, n4, n8, nn,
    t1, t2, t3, t4,
Severity: Major
Found in packages/rfft/lib/forward.js - About 4 hrs to fix

    Function forward has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function forward (bufferSize, buffer, trans, spectrum, table) {
      var n = bufferSize,
        x = trans,
        n2, n4, n8, nn,
        t1, t2, t3, t4,
    Severity: Minor
    Found in packages/rfft/lib/forward.js - About 4 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 inverse has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function inverse (bufferSize, buffer, output) {
      var n = bufferSize
      var x = output || new Float64Array(bufferSize)
      var TWO_PI = 2 * Math.PI
      var n2, n4, n8, nn,
    Severity: Major
    Found in packages/rfft/lib/inverse.js - About 3 hrs to fix

      Function inverse has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function inverse (bufferSize, buffer, output) {
        var n = bufferSize
        var x = output || new Float64Array(bufferSize)
        var TWO_PI = 2 * Math.PI
        var n2, n4, n8, nn,
      Severity: Minor
      Found in packages/rfft/lib/inverse.js - 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

      Function fft has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function fft (dir, m, x, y) {
        var n, i, i1, j, k, i2, l, l1, l2
        var c1, c2, tx, ty, t1, t2, u1, u2, z
      
         /* Calculate the number of points */
      Severity: Major
      Found in packages/fft2/index.js - About 2 hrs to fix

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

        module.exports = function fft (dir, m, x, y) {
          var n, i, i1, j, k, i2, l, l1, l2
          var c1, c2, tx, ty, t1, t2, u1, u2, z
        
           /* Calculate the number of points */
        Severity: Minor
        Found in packages/fft2/index.js - 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 fft has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function fft (size, input, output, dir) {
          if (arguments.length > 1) return fft(size)(input, dir, output)
          var cached = tables(size)
        
          return function process (dir, input, output) {
        Severity: Major
        Found in packages/fft-asm/fft-no-asm.js - About 2 hrs to fix

          Function compute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          function compute (real, imag, samples, power, dir) {
            /* Computes in-place complex-to-complex FFT */
            /* Reverse bits */
            var j = 0
            for (var i = 0; i < (samples - 1); i++) {
          Severity: Minor
          Found in packages/fft-asm/versions/arduino.js - 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 process has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            return function process (dir, input, output) {
              // check direction
              if (dir !== 'forward' && dir !== 'inverse') throw Error('Direction must be "forward" or "inverse" but was: ' + dir)
              var inverse = dir === 'inverse'
          
          
          Severity: Major
          Found in packages/fft-asm/fft-no-asm.js - About 2 hrs to fix

            Function compute has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function compute (real, imag, samples, power, dir) {
              /* Computes in-place complex-to-complex FFT */
              /* Reverse bits */
              var j = 0
              for (var i = 0; i < (samples - 1); i++) {
            Severity: Minor
            Found in packages/fft-asm/versions/arduino.js - About 1 hr to fix

              Function process has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function process (dir, tables, input, output) {
                const { size, cosTable, sinTable, reverseTable } = tables
              
                if (!input.real) input = { real: input, imag: new Float32Array(size) }
                const rs = input.real
              Severity: Minor
              Found in packages/fft-radix2/index.js - About 1 hr to fix

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

                function process (dir, tables, input, output) {
                  const { size, cosTable, sinTable, reverseTable } = tables
                
                  if (!input.real) input = { real: input, imag: new Float32Array(size) }
                  const rs = input.real
                Severity: Minor
                Found in packages/fft-radix2/index.js - 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 DFT has 40 lines of code (exceeds 25 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 1 hr to fix

                  Function compute has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function compute (x, y, n, m) {
                    var i = 0, j = 0, k = 0, n1 = 0, n2 = 0, a = 0;
                    var c = 0, s = 0, t1 = 0, t2 = 0;
                  
                    // Bit-reverse
                  Severity: Minor
                  Found in packages/fft-asm/versions/fftc.js - About 1 hr to fix

                    Function compute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function compute (x, y, n, m) {
                      var i = 0, j = 0, k = 0, n1 = 0, n2 = 0, a = 0;
                      var c = 0, s = 0, t1 = 0, t2 = 0;
                    
                      // Bit-reverse
                    Severity: Minor
                    Found in packages/fft-asm/versions/fftc.js - 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 player has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function player ({
                      buffer,
                      loop = false,
                      context = ac,
                      labels = ['Play', 'Stop'],
                    Severity: Minor
                    Found in packages/waa/lib/player.js - 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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function process (re, im, N) {
                      var c, s, tre, tim
                      for (var i = 0; i < N; i++) {
                        for (var j = 0, h = i, k = N; (k >>= 1); h >>= 1) {
                          j = (j << 1) | (h & 1);
                    Severity: Minor
                    Found in packages/fft-asm/versions/mini-fft.js - 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 recalcPhases has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function recalcPhases (frames, { size, factor, hop }, omega) {
                      var ha = hop // hop analysis
                      var hs = hop * factor // hop synthesis
                      var numFrames = frames.length
                    
                    
                    Severity: Minor
                    Found in packages/phase-vocoder/lib/recalcPhasesV2.js - 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 stft has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    export function stft (input, window, output, inputSize, fftSize, hopSize) {
                    Severity: Minor
                    Found in packages/stft/index.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language