adamrenklint/bap

View on GitHub

Showing 42 of 70 total issues

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

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

    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

        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

                    Function _params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _params: function () {
                        var params = Layer.prototype._params.apply(this, arguments);
                    
                        params.length = params.length || this.buffer && (this.buffer.duration - params.offset) || 0;
                    
                    
                    Severity: Minor
                    Found in lib/Sample.js - About 35 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 patterns has a Cognitive Complexity of 7 (exceeds 5 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 35 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 calculateLength has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Params.calculateLength = function (params) {
                      var existingLength = params.length || 0;
                      var lengthFromDuration = params.duration && Params.lengthFromDuration(params, params.duration) || 0;
                      if (lengthFromDuration && lengthFromDuration < existingLength || !existingLength) {
                        params.hasLengthFromDuration = true;
                    Severity: Minor
                    Found in lib/Params.js - About 35 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 set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                          set: function (newVal) {
                            if (typeof newVal === 'boolean' || ~types.indexOf(newVal)) {
                              return { val: newVal, type: 'bypassType' };
                            }
                            else if (Array.isArray(newVal)) {
                    Severity: Minor
                    Found in lib/mixins/bypassable.js - About 35 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 slot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      slot: function (id, slot) {
                        if (!id || typeof id !== 'string') {
                          throw new Error('Invalid slot identifier: ' + id);
                        }
                        else if (!slot) {
                    Severity: Minor
                    Found in lib/Kit.js - About 25 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 _lookaheadSteps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _lookaheadSteps: function () {
                        var bar = this.bar || 1;
                        var beat = this.beat || 1;
                        var beatsPerBar = this.sequence && this.sequence.beatsPerBar || 4;
                        var bars = this.sequence && this.sequence.bars || 1;
                    Severity: Minor
                    Found in lib/Clock.js - About 25 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

                    Severity
                    Category
                    Status
                    Source
                    Language