adamrenklint/bap

View on GitHub

Showing 70 of 70 total issues

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

  createNode: function () {

    var input = this.context.createGain();
    var dry = input._dry = this.context.createGain();
    var wet = input._wet = this.context.createGain();
Severity: Major
Found in lib/effects/Chorus.js and 2 other locations - About 1 day to fix
lib/effects/Phaser.js on lines 26..43
lib/effects/PingPongDelay.js on lines 22..39

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 210.

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 3 locations. Consider refactoring.
Open

  createNode: function () {

    var input = this.context.createGain();
    var dry = input._dry = this.context.createGain();
    var wet = input._wet = this.context.createGain();
Severity: Major
Found in lib/effects/PingPongDelay.js and 2 other locations - About 1 day to fix
lib/effects/Chorus.js on lines 22..39
lib/effects/Phaser.js on lines 26..43

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 210.

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 3 locations. Consider refactoring.
Open

  createNode: function () {

    var input = this.context.createGain();
    var dry = input._dry = this.context.createGain();
    var wet = input._wet = this.context.createGain();
Severity: Major
Found in lib/effects/Phaser.js and 2 other locations - About 1 day to fix
lib/effects/Chorus.js on lines 22..39
lib/effects/PingPongDelay.js on lines 22..39

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 210.

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 effects has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function effects () {

  var baseSample = bap.sample({
    src: 'sounds/plong1.wav',
    duration: 96,
Severity: Major
Found in examples/effects.js - About 6 hrs to fix

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

    BufferHelper.mergeChannelsData = function (originalBuffer, outputBuffer, startIndex, targetStartIndex, copyLength) {
      var firstInput = originalBuffer.getChannelData(0);
      var secondInput = originalBuffer.getChannelData(1);
      var output = outputBuffer.getChannelData(0);
      var offset = targetStartIndex - startIndex;
    Severity: Major
    Found in lib/BufferHelper.js and 1 other location - About 5 hrs to fix
    lib/BufferHelper.js on lines 125..134

    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 136.

    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

    BufferHelper.diffChannelsData = function (originalBuffer, outputBuffer, startIndex, targetStartIndex, copyLength) {
      var firstInput = originalBuffer.getChannelData(0);
      var secondInput = originalBuffer.getChannelData(1);
      var output = outputBuffer.getChannelData(0);
      var offset = targetStartIndex - startIndex;
    Severity: Major
    Found in lib/BufferHelper.js and 1 other location - About 5 hrs to fix
    lib/BufferHelper.js on lines 136..145

    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 136.

    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 boombap has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function boombap () {
      var drumKit = bap.kit();
      var drumCompressor = bap.compressor({
        threshold: -12,
        gain: 110
    Severity: Major
    Found in examples/boombap.js - About 5 hrs to fix

      Function sequences has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function sequences () {
      
        var lowPianoKit = bap.sample({
          src: 'sounds/own_barricade_end.wav',
          attack: 0.01,
      Severity: Major
      Found in examples/sequences.js - About 3 hrs to fix

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

          props: {
            wet: ['volumeRange', true, 50],
            dry: ['volumeRange', true, 100],
            time: ['delayTimeRange', true, 0.3],
            feedback: ['volumeRange', true, 50],
        Severity: Major
        Found in lib/effects/Delay.js and 1 other location - About 2 hrs to fix
        lib/effects/Reverb.js on lines 8..20

        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 90.

        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

          props: {
            wet: ['volumeRange', true, 50],
            dry: ['volumeRange', true, 100],
            time: ['inclusivePositiveNumber', true, 1],
            decay: ['inclusivePositiveNumber', true, 3],
        Severity: Major
        Found in lib/effects/Reverb.js and 1 other location - About 2 hrs to fix
        lib/effects/Delay.js on lines 9..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 90.

        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

            compare: function (currentVal, newVal, attributeName) {
              var isSame = currentVal === newVal;
              if (!isSame) {
                if (currentVal) {
                  this.stopListening(currentVal);
        Severity: Major
        Found in lib/types/instanceOf.js and 1 other location - About 2 hrs to fix
        lib/types/instanceOfType.js on lines 18..29

        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 86.

        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

            compare: function (currentVal, newVal, attributeName) {
              var isSame = currentVal === newVal;
              if (!isSame) {
                if (currentVal) {
                  this.stopListening(currentVal);
        Severity: Major
        Found in lib/types/instanceOfType.js and 1 other location - About 2 hrs to fix
        lib/types/instanceOf.js on lines 18..29

        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 86.

        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

          var lowPianoKit = bap.sample({
            src: 'sounds/own_barricade_end.wav',
            attack: 0.01,
            release: 0.01,
            pitch: -4,
        Severity: Major
        Found in examples/sequences2.js and 1 other location - About 2 hrs to fix
        examples/sequences.js on lines 5..11

        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 83.

        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

          var lowPianoKit = bap.sample({
            src: 'sounds/own_barricade_end.wav',
            attack: 0.01,
            release: 0.01,
            pitch: -4,
        Severity: Major
        Found in examples/sequences.js and 1 other location - About 2 hrs to fix
        examples/sequences2.js on lines 5..11

        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 83.

        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 slices has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function slices () {
          var sampleKit = bap.kit();
          var base = bap.sample({
            src: 'sounds/slices.wav',
            attack: 0.01,
        Severity: Major
        Found in examples/slices.js - About 2 hrs to fix

          Function _getCollectionEventBubblingHandler has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            _getCollectionEventBubblingHandler: function (propertyName) {
              return function (eventName, model, newValue, collection) {
                var validNames = ['change', 'add', 'remove'];
                if (~validNames.indexOf(eventName)) {
                  this.trigger('change:' + propertyName, model, newValue);
          Severity: Minor
          Found in lib/Model.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 sequences has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function sequences () {
          
            var lowPianoKit = bap.sample({
              src: 'sounds/own_barricade_end.wav',
              attack: 0.01,
          Severity: Minor
          Found in examples/sequences2.js - About 1 hr to fix

            Function start has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              start: function (time, note, channel, pattern, kit, slot) {
                if (this.mute) { return; }
            
                if (typeof time !== 'number') {
                  pattern = channel;
            Severity: Minor
            Found in lib/Layer.js - About 1 hr to fix

              Function makeBuffer has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              BufferHelper.makeBuffer = memoize(function (params, originalBuffer, context) {
              
                var start = new Date();
                var sampleRate = originalBuffer.sampleRate;
                var numberOfChannels = BufferHelper.getChannelCount(params, originalBuffer);
              Severity: Minor
              Found in lib/BufferHelper.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 start has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                start: function (time, note, channel, pattern, kit, slot) {
                  if (this.mute) { return; }
              
                  if (typeof time !== 'number') {
                    pattern = channel;
              Severity: Minor
              Found in lib/Layer.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

              Severity
              Category
              Status
              Source
              Language