adamrenklint/bap

View on GitHub

Showing 70 of 70 total issues

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

Function patterns has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  patterns: function (bar, outerOffset) {
    if (typeof bar !== 'number') throw new Error('Invalid argument: bar is not a number');
    if (bar < 1 || bar > this.bars) throw new Error('Invalid argument: bar is not within sequence length');
    var patterns = {};
    var sequences = this.sequences.slice();
Severity: Minor
Found in lib/Sequence.js - About 1 hr to fix

    Function makeBuffer has 37 lines of code (exceeds 25 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

      Function _loadSample has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _loadSample: function (countLoading) {
          var buffer = buffers[this.src];
          this.context.resume();
          if (!buffer) {
            this.loaded = false;
      Severity: Minor
      Found in lib/Sample.js - About 1 hr to fix

        Function mergeSources has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Params.mergeSources = memoize(function (params, sources) {
          var multipliers = ['volume'];
          var adders = ['pitch', 'pan'];
          var keys = Object.keys(Params.prototype._definition);
        
        
        Severity: Minor
        Found in lib/Params.js - About 1 hr to fix

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

          function instanceOf (type, Constructor) {
          
            return {
              set: function (newVal) {
                if (newVal instanceof Constructor) {
          Severity: Minor
          Found in lib/types/instanceOf.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 3 locations. Consider refactoring.
          Open

            props: {
              wet: ['volumeRange', true, 100],
              dry: ['volumeRange', true, 0],
              rate: ['rateRange', true, 1.5],
              feedback: ['inclusivePositiveNumber', true, 0.2],
          Severity: Major
          Found in lib/effects/Chorus.js and 2 other locations - About 1 hr to fix
          lib/effects/Overdrive.js on lines 9..16
          lib/effects/PingPongDelay.js on lines 8..15

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

          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 instanceOfType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          function instanceOfType (type, types) {
          
            return {
              set: function (newVal) {
                if (~types.indexOf(newVal.type)) {
          Severity: Minor
          Found in lib/types/instanceOfType.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 overloadedAccessor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          function overloadedAccessor (name, Ctor) {
          
            var mixin = {};
          
            mixin[name] = function (id, model) {
          Severity: Minor
          Found in lib/mixins/overloadedAccessor.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 3 locations. Consider refactoring.
          Open

            props: {
              wet: ['volumeRange', true, 50],
              dry: ['volumeRange', true, 50],
              preBand: ['preBandRange', true, 50],
              color: ['frequencyRange', true, 800],
          Severity: Major
          Found in lib/effects/Overdrive.js and 2 other locations - About 1 hr to fix
          lib/effects/Chorus.js on lines 8..15
          lib/effects/PingPongDelay.js on lines 8..15

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

          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

            props: {
              wet: ['volumeRange', true, 100],
              dry: ['volumeRange', true, 0],
              feedback: ['feedbackRange', true, 0.2],
              left: ['delayTimeRange', true, 0.15],
          Severity: Major
          Found in lib/effects/PingPongDelay.js and 2 other locations - About 1 hr to fix
          lib/effects/Chorus.js on lines 8..15
          lib/effects/Overdrive.js on lines 9..16

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

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

          function instanceOf (type, Constructor) {
          
            return {
              set: function (newVal) {
                if (newVal instanceof Constructor) {
          Severity: Minor
          Found in lib/types/instanceOf.js - About 1 hr to fix

            Function instanceOfType has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function instanceOfType (type, types) {
            
              return {
                set: function (newVal) {
                  if (~types.indexOf(newVal.type)) {
            Severity: Minor
            Found in lib/types/instanceOfType.js - About 1 hr to fix

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

                piano1.kit(1, lowPianoKit).channel(1).add(
                  ['1.odd.01',  '1E', 96],
                  ['1.even.01', '1R', 96],
                  ['2.1.01',    '1E', 96],
                  ['2.2.01',    '1R', 96],
              Severity: Major
              Found in examples/sequences.js and 1 other location - About 1 hr to fix
              examples/sequences2.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 57.

              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

                lead.kit(1, lowPianoKit).channel(1).add(
                  ['1.odd.01',  '1E', 96],
                  ['1.even.01', '1R', 96],
                  ['2.1.01',    '1E', 96],
                  ['2.2.01',    '1R', 96],
              Severity: Major
              Found in examples/sequences2.js and 1 other location - About 1 hr to fix
              examples/sequences.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 57.

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

                _triggerPlaybackStateEvent: function(event, time, params, note, channel, pattern, kit, slot) {
              Severity: Major
              Found in lib/Layer.js - About 1 hr to fix

                Function notes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  notes: function (bar, beat, tick) {
                    if (!bar) return this.expandedNotes.models.slice();
                    var cache = this._cache;
                    var beats = cache[bar];
                    if (!beat) return (beats && beats['*'] || []).slice();
                Severity: Minor
                Found in lib/Channel.js - About 55 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

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

                    beatsPerBar: {
                      deps: ['sequences'],
                      fn: function () {
                        var first = findFirst(this.sequences);
                        return first && first.beatsPerBar || 4;
                Severity: Minor
                Found in lib/Sequence.js and 1 other location - About 55 mins to fix
                lib/Sequence.js on lines 73..79

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

                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

                    tempo: {
                      deps: ['sequences'],
                      fn: function () {
                        var first = findFirst(this.sequences);
                        return first && first.tempo || 120;
                Severity: Minor
                Found in lib/Sequence.js and 1 other location - About 55 mins to fix
                lib/Sequence.js on lines 92..98

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

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

                BufferHelper.copyChannelData = function (originalBuffer, outputBuffer, sourceChannel, targetChannel, startIndex, targetStartIndex, copyLength) {
                Severity: Major
                Found in lib/BufferHelper.js - About 50 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language