adamrenklint/bap

View on GitHub

Showing 70 of 70 total issues

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

  _delegateStarted: function (note, params) {
    if (this.original && this.original !== this) {
      this.original.trigger('started', note, params);
    }
  },
Severity: Minor
Found in lib/Note.js and 1 other location - About 50 mins to fix
lib/Note.js on lines 42..46

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

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

  _delegateStopped: function (note, params) {
    if (this.original && this.original !== this) {
      this.original.trigger('stopped', note, params);
    }
  },
Severity: Minor
Found in lib/Note.js and 1 other location - About 50 mins to fix
lib/Note.js on lines 36..40

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

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

  drumKit.slot('W').layer('sounds/snare_1.wav').layer(bap.sample({
    src: 'sounds/snare_38.wav',
    bitcrush: 12,
    volume: 40
  }));
Severity: Minor
Found in examples/sequences.js and 1 other location - About 50 mins to fix
examples/sequences2.js on lines 28..32

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

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

  drumKit.slot('W').layer('sounds/snare_1.wav').layer(bap.sample({
    src: 'sounds/snare_38.wav',
    bitcrush: 12,
    volume: 40
  }));
Severity: Minor
Found in examples/sequences2.js and 1 other location - About 50 mins to fix
examples/sequences.js on lines 51..55

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

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 start has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  start: function (time, note, channel, pattern, kit, slot) {
Severity: Minor
Found in lib/Layer.js - About 45 mins to fix

    Function stop has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      stop: function (time, note, channel, pattern, kit, slot) {
    Severity: Minor
    Found in lib/Layer.js - About 45 mins to fix

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

      Clock.uncachedPossibleSteps = function (bar, beat, bars, beats) {
      
        var steps = new Array(192);
        var index = 0;
      
      
      Severity: Minor
      Found in lib/Clock.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 _updateTempo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        _updateTempo: function (position) {
          if (!this.sequence) {
            this.tempo = 120;
          }
          else if (position && this.sequence.tempoAt) {
      Severity: Minor
      Found in lib/Clock.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 constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        constructor: function () {
          var args = Array.prototype.slice.call(arguments);
          var types = ['sequence', 'pattern'];
          var sequences = [];
          var cont = true;
      Severity: Minor
      Found in lib/Sequence.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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        start: function (sequence) {
      
          if (!inited) {
            init(this.context);
          }
      Severity: Minor
      Found in lib/Clock.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

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

          if (typeof time !== 'number') {
            pattern = channel;
            channel = note;
            note = time;
            time = this.context.currentTime;
      Severity: Minor
      Found in lib/Layer.js and 1 other location - About 40 mins to fix
      lib/Layer.js on lines 112..117

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

      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

          if (typeof time !== 'number') {
            pattern = channel;
            channel = note;
            note = time;
            time = this.context.currentTime;
      Severity: Minor
      Found in lib/Layer.js and 1 other location - About 40 mins to fix
      lib/Layer.js on lines 41..46

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

      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

        stop: function (time, note, channel, pattern, kit) {
          this.layers.each(function (layer) {
            layer.stop(time, note, channel, pattern, kit, this);
          }.bind(this));
        }
      Severity: Minor
      Found in lib/Slot.js and 1 other location - About 40 mins to fix
      lib/Slot.js on lines 27..31

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

      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

          if (!this.mute) {
            this.layers.each(function (layer) {
              layer.start(time, note, channel, pattern, kit, this);
            }.bind(this));
          }
      Severity: Minor
      Found in lib/Slot.js and 1 other location - About 40 mins to fix
      lib/Slot.js on lines 34..38

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

      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 _params has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        _params: function (note, channel, pattern, kit, slot) {
      Severity: Minor
      Found in lib/Layer.js - About 35 mins to fix

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

          stop: function (time, note, channel, pattern, kit) {
        Severity: Minor
        Found in lib/Slot.js - About 35 mins to fix

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

          BufferHelper.mergeChannelsData = function (originalBuffer, outputBuffer, startIndex, targetStartIndex, copyLength) {
          Severity: Minor
          Found in lib/BufferHelper.js - About 35 mins to fix

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

              start: function (time, note, channel, pattern, kit) {
            Severity: Minor
            Found in lib/Slot.js - About 35 mins to fix

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

              BufferHelper.diffChannelsData = function (originalBuffer, outputBuffer, startIndex, targetStartIndex, copyLength) {
              Severity: Minor
              Found in lib/BufferHelper.js - About 35 mins to fix

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

                  _paramsSources: function (note, channel, pattern, kit, slot) {
                Severity: Minor
                Found in lib/Layer.js - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language