konsumer/Protracker

View on GitHub

Showing 41 of 90 total issues

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

Protracker.prototype.clearsong = function()
{  
  this.title="";
  this.signature="";
  this.songlen=1;
Severity: Minor
Found in index.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

              if (n==this.baseperiodtable[np]) this.note[i][j*this.channels+c]=np;
    Severity: Major
    Found in formats/mod.js - About 45 mins to fix

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

      Protracker.prototype.effect_t0_ed=function(mod, ch) { // ed delay sample
        if (mod.tick==(mod.channel[ch].data&0x0f)) {
          // start note
          var p=mod.patterntable[mod.position];
          var pp=mod.row*4*mod.channels + ch*4;            
      Severity: Minor
      Found in index.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

      Avoid deeply nested control flow statements.
      Open

              if (n==this.baseperiodtable[np]) this.note[i][j*this.channels+c]=np;
      Severity: Major
      Found in index.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if (n==this.baseperiodtable[np]) this.note[i][j*this.channels+c]=np;
        Severity: Major
        Found in formats/xm.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (mod.flags&16) { // pattern jump/break?
                      //console.log("break to pattern " + mod.patternjump + " row "+mod.breakrow);
                      mod.position=mod.patternjump;
                      mod.row=mod.breakrow;
                      mod.patternjump=0;
          Severity: Major
          Found in index.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (!mod.tick) {
                        // process only on tick 0
                        mod.effects_t0[mod.channel[ch].command](mod, ch);
                      } else {
                        mod.effects_t1[mod.channel[ch].command](mod, ch);    
            Severity: Major
            Found in index.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if (!(mod.channel[ch].command==0x0e && (mod.channel[ch].data&0xf0)==0xd0)) {
                          n=(mod.pattern[p][pp]&0x0f)<<8 | mod.pattern[p][pp+1];
                          if (n) {
                            // noteon, except if command=3 (porta to note)
                            if ((mod.channel[ch].command != 0x03) && (mod.channel[ch].command != 0x05)) {
              Severity: Major
              Found in index.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          if (mod.sample[mod.channel[ch].sample].loopstart || mod.sample[mod.channel[ch].sample].looplength) {
                            if (mod.channel[ch].samplepos >= (mod.sample[mod.channel[ch].sample].loopstart+mod.sample[mod.channel[ch].sample].looplength)) {
                              mod.channel[ch].samplepos-=mod.sample[mod.channel[ch].sample].looplength;
                            }
                          } else {
                Severity: Major
                Found in index.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if (mod.sample[mod.channel[ch].sample].length > mod.channel[ch].samplepos)
                              f=(1.0/mod.channels) *
                                (mod.sample[mod.channel[ch].sample].data[Math.floor(mod.channel[ch].samplepos)]*mod.channel[ch].volume)/64.0;
                  Severity: Major
                  Found in index.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              for(var np=0; np<mod.baseperiodtable.length; np++)
                                if (mod.baseperiodtable[np]>=mod.channel[ch].period) mod.channel[ch].note=np;
                    Severity: Major
                    Found in index.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if (mod.channel[ch].period>=120)
                                  mod.channel[ch].semitone=mod.baseperiodtable[mod.channel[ch].note]-mod.baseperiodtable[mod.channel[ch].note+1];
                      Severity: Major
                      Found in index.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                  if (n==this.baseperiodtable[np]) this.note[i][j*this.channels+c]=np;
                        Severity: Major
                        Found in formats/it.js - About 45 mins to fix

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

                          Protracker.prototype.setamigamodel = function(amiga)
                          {
                            if (amiga=="600" || amiga=="1200" || amiga=="4000") {
                              this.amiga500=false;
                              if (this.filterNode) this.filterNode.frequency.value=28867;
                          Severity: Minor
                          Found in index.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 effect_t0_e6 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Protracker.prototype.effect_t0_e6=function(mod, ch) { // e6 loop pattern
                            if (mod.channel[ch].data&0x0f) {
                              if (mod.loopcount) {
                                mod.loopcount--;
                              } else {
                          Severity: Minor
                          Found in index.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 effect_t1_0 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Protracker.prototype.effect_t1_0=function(mod, ch) { // 0 arpeggio
                            if (mod.channel[ch].data) {
                              var apn=mod.channel[ch].note;
                              if ((mod.tick%3)==1) apn+=mod.channel[ch].arpeggio>>4;
                              if ((mod.tick%3)==2) apn+=mod.channel[ch].arpeggio&0x0f;
                          Severity: Minor
                          Found in index.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 createContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Protracker.prototype.createContext = function()
                          {
                            if ( typeof AudioContext !== 'undefined') {
                              this.context = new AudioContext();
                            } else {
                          Severity: Minor
                          Found in index.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

                          Avoid too many return statements within this function.
                          Open

                              return true;
                          Severity: Major
                          Found in formats/it.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return true;
                            Severity: Major
                            Found in formats/xm.js - About 30 mins to fix

                              Function effect_t1_3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              Protracker.prototype.effect_t1_3=function(mod, ch) { // 3 slide to note
                                if (mod.channel[ch].period < mod.channel[ch].slideto) {
                                  mod.channel[ch].period+=mod.channel[ch].slidetospeed;
                                  if (mod.channel[ch].period > mod.channel[ch].slideto)
                                    mod.channel[ch].period=mod.channel[ch].slideto;
                              Severity: Minor
                              Found in index.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