freakimkaefig/Music-XML-Analyzer

View on GitHub

Showing 168 of 286 total issues

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

    renderNotes = function(measures, canvas, renderer, context, stave, score) {
Severity: Minor
Found in public/js/views/ScoreView.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if (type === "whole" || type === "half") {
                                    var keys = ["b/4/d0"];
                                } else {
                                    var keys = ["b/4/d2"];
                                }
    Severity: Major
    Found in public/js/views/ResultView.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (pattern.measures[i].notes[j].type === "note") {
                                      if (!pattern.measures[i].notes[j].pitch.chord) {
                                          // determine note variables
                                          var step = pattern.measures[i].notes[j].pitch.step;
                                          var octave = pattern.measures[i].notes[j].pitch.octave;
      Severity: Major
      Found in public/js/views/ResultView.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (measures[i].ties[j].indexOf("stop") > -1) {
                                    tieStop = measures[i].notes[j];
                                    if (tieStart !== null) {
                                        var tie = new Vex.Flow.StaveTie({ first_note: tieStart, last_note: tieStop, first_indices: [0], last_indices: [0] });
                                        ties.push(tie);
        Severity: Major
        Found in public/js/views/ResultView.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (pattern.measures[i].notes[j].pitch.dot) {
                                          durationType = 2;
                                      }
          Severity: Major
          Found in public/js/views/ResultView.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if (curName != "break") {
                                noteElements[0].notes.push(
                                {
                                    type: "note",
                                    pitch: {
            Severity: Major
            Found in public/js/models/PatternModel.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (measures[i].ties[j].indexOf("start") > -1) {
                                          tieStart = measures[i].notes[j];
                                      }
              Severity: Major
              Found in public/js/views/ScoreView.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    } else if (score.measures[i].notes[j].type === "rest") {
                                        var durationType = 1; // rests type is 1
                                        var noteDuration = getVexflowDuration(score.measures[i].notes[j].duration, durationType);
                
                                        note = new Vex.Flow.StaveNote({ keys: ["b/4"], duration: noteDuration });
                Severity: Major
                Found in public/js/views/ScoreView.js - About 45 mins to fix

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

                      renderNotes = function(measures, canvas, renderer, context, stave, pattern) {
                  Severity: Minor
                  Found in public/js/views/ResultView.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if(typeof noteTuplet === 'undefined'){
                                                console.log("beam is undefined");
                                                noteTuplet = false;
                                            }
                    Severity: Major
                    Found in public/js/controllers/ResultController.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (!score.measures[i].notes[j].pitch.chord) {
                                                  // determine note variables
                                                  var step = score.measures[i].notes[j].pitch.step;
                                                  var octave = score.measures[i].notes[j].pitch.octave;
                                                  var alter = score.measures[i].notes[j].pitch.alter;
                      Severity: Major
                      Found in public/js/views/ScoreView.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (pattern.measures[i].notes[j].pitch.dot) {
                                                        note.addDotToAll();
                                                    }
                        Severity: Major
                        Found in public/js/views/ResultView.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  } else if (pattern.measures[i].notes[j].type === "rest") {
                                                      var durationType = 1; // rests type is 1
                                                      var noteDuration = getVexflowDuration(pattern.measures[i].notes[j].duration, durationType);
                          
                                                      note = new Vex.Flow.StaveNote({ keys: ["b/4"], duration: noteDuration });
                          Severity: Major
                          Found in public/js/views/ResultView.js - About 45 mins to fix

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

                                public function getResultDetail($id, $page) {
                                    if (Cache::has('results') && Cache::has('pattern')) {
                                        $results = Cache::get('results');
                                        foreach ($results as $item) {
                                            if ($item->file_id == $id) {
                            Severity: Minor
                            Found in app/controllers/ResultController.php - 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 ApplicationController has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            MusicXMLAnalyzer.ApplicationController = function() {
                            
                                var that = {},
                                headerController = null,
                                uploadController = null,
                            Severity: Minor
                            Found in public/js/controllers/ApplicationController.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 (measures[i].ties[j].indexOf("stop") > -1) {
                                                        tieStop = measures[i].notes[j];
                                                        if (tieStart !== null) {
                                                            var tie = new Vex.Flow.StaveTie({ first_note: tieStart, last_note: tieStop, first_indices: [0], last_indices: [0] });
                                                            ties.push(tie);
                            Severity: Major
                            Found in public/js/views/ScoreView.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if(typeof noteDuration === 'undefined'){
                                                          noteDuration = 0.25;
                                                      }
                              Severity: Major
                              Found in public/js/controllers/ResultController.js - About 45 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                                        if (($j == $startMeasure && $noteCounter >= $start) || ($j > $startMeasure && $j < $endMeasure) || ($j == $endMeasure && $noteCounter <= $end)) {
                                                            // set color to red if note is between start and end of result
                                                            $currentColor = "#b71c1c";
                                                        }
                                Severity: Major
                                Found in app/controllers/ResultController.php - About 40 mins to fix

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

                                      public function getHome() {
                                          if (Cookie::get('user_id')) {
                                              $user = User::find(Cookie::get('user_id'));
                                              if ($user) {
                                                  $name = 'user_id';
                                  Severity: Minor
                                  Found in app/controllers/HomeController.php - 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 method.
                                  Open

                                              return "16th";
                                  Severity: Major
                                  Found in app/controllers/ResultController.php - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language