oramics/dsp-kit

View on GitHub

Showing 150 of 150 total issues

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function add (N, a, b, out) {
      out = out || zeros(N)
      for (var i = 0; i < N; i++) out[i] = a[i] + b[i]
      return out
    }
    Severity: Major
    Found in packages/array/index.js and 1 other location - About 2 hrs to fix
    packages/array/index.js on lines 108..112

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function mult (N, a, b, out) {
      out = out || zeros(N)
      for (var i = 0; i < N; i++) out[i] = a[i] * b[i]
      return out
    }
    Severity: Major
    Found in packages/array/index.js and 1 other location - About 2 hrs to fix
    packages/array/index.js on lines 89..93

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                  for (i = 0; i < size; i++) {
                    sinTable[i] = Math.sin(-Math.PI / i)
                    cosTable[i] = Math.cos(-Math.PI / i)
                  }
                Severity: Major
                Found in packages/fft-asm/fft-no-asm.js and 1 other location - About 1 hr to fix
                packages/fft-radix2/index.js on lines 129..132

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                  for (let i = 0; i < size; i++) {
                    sinTable[i] = Math.sin(-Math.PI / i)
                    cosTable[i] = Math.cos(-Math.PI / i)
                  }
                Severity: Major
                Found in packages/fft-radix2/index.js and 1 other location - About 1 hr to fix
                packages/fft-asm/fft-no-asm.js on lines 99..102

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                const Overlap = (model, msg) => html`
                  <div>
                    <h2>Overlap</h2>
                    <div><label>Duration:</label>${model.duration}</div>
                    <canvas oncreate=${(e) => draw(e, model.buffer)} width="600" height="150"></canvas>
                Severity: Minor
                Found in packages/elastica/example/app.js and 1 other location - About 55 mins to fix
                packages/elastica/example/app.js on lines 14..21

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 54.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language