freakimkaefig/Music-XML-Analyzer

View on GitHub

Showing 286 of 286 total issues

Function ResultView has a Cognitive Complexity of 305 (exceeds 5 allowed). Consider refactoring.
Open

MusicXMLAnalyzer.ResultView = function(){

    var that = {},

    $patternValue = null,
Severity: Minor
Found in public/js/views/ResultView.js - About 6 days 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 ($pitch->length) {
                        // it's a note
                        $noteObject->type = "note";
                        $noteObject->pitch = new stdClass();

Severity: Major
Found in app/controllers/ResultController.php and 1 other location - About 5 days to fix
app/controllers/ScoreController.php on lines 102..232

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

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 ($pitch->length) {
                        // it's a note
                        $noteObject->type = "note";
                        $noteObject->pitch = new stdClass();

Severity: Major
Found in app/controllers/ScoreController.php and 1 other location - About 5 days to fix
app/controllers/ResultController.php on lines 209..339

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

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

MusicXMLAnalyzer.ScoreView = function(){

    var that = {},

    $scoreValue = null,
Severity: Minor
Found in public/js/views/ScoreView.js - About 3 days 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 generateResultExtract has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateResultExtract($upload_id, $part_id, $voice, $startMeasure, $start, $endMeasure, $end) {
        set_time_limit(300);
        $upload = Upload::find($upload_id);

        $doc = new DOMDocument();
Severity: Minor
Found in app/controllers/ResultController.php - About 2 days 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 ResultView has 581 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MusicXMLAnalyzer.ResultView = function(){

    var that = {},

    $patternValue = null,
Severity: Major
Found in public/js/views/ResultView.js - About 2 days to fix

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

                                if(count(self::$xmlArray) == count(self::$patternArray)){
    
                                    // compare arrays
                                    if(array_values(self::$xmlArray) == array_values(self::$patternArray)){
                                        // create result
    Severity: Major
    Found in app/controllers/MelodyController.php and 1 other location - About 2 days to fix
    app/controllers/SoundSequenzController.php on lines 106..149

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

    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(count(self::$xmlIntervalArray) == count(self::$patternIntervalArray)){
    
                                        // compare arrays
                                        if(array_values(self::$xmlIntervalArray) == array_values(self::$patternIntervalArray)){
                                            // create result
    Severity: Major
    Found in app/controllers/SoundSequenzController.php and 1 other location - About 2 days to fix
    app/controllers/MelodyController.php on lines 223..266

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

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

        public function generateScore($uploadId, $partId) {
            $upload = Upload::find($uploadId);
            if ($upload) {
                $doc = new DOMDocument();
                $doc->loadXML($upload->content);
    Severity: Minor
    Found in app/controllers/ScoreController.php - About 2 days 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 PatternModel has 470 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MusicXMLAnalyzer.PatternModel = function(){
    
        var that = {},
        noteElements = [],
        noteElements4VexFlow = [],
    Severity: Major
    Found in public/js/models/PatternModel.js - About 2 days to fix

      Function PatternModel has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
      Open

      MusicXMLAnalyzer.PatternModel = function(){
      
          var that = {},
          noteElements = [],
          noteElements4VexFlow = [],
      Severity: Minor
      Found in public/js/models/PatternModel.js - About 2 days 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

                  if($fifths != null && $mode === "major"){
                      switch($fifths):
                          case "0":
                              $keysArray[0]->value = $keysArray[0]->value + 1;
                              break;
      Severity: Major
      Found in app/controllers/SearchController.php and 1 other location - About 2 days to fix
      app/controllers/SearchController.php on lines 482..530

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

      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

                  elseif($fifths != null && $mode === "minor"){
                      switch($fifths):
                          case "0":
                              $keysArray[15]->value = $keysArray[15]->value + 1;
                              break;
      Severity: Major
      Found in app/controllers/SearchController.php and 1 other location - About 2 days to fix
      app/controllers/SearchController.php on lines 432..533

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

      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

              var playTune = function() {
      
                  if(i < notesToBePlayed.length){
                      var note = notesToBePlayed[i].note;
                      // how hard the note gets hit
      Severity: Major
      Found in public/js/controllers/PatternController.js and 1 other location - About 2 days to fix
      public/js/controllers/ScoreController.js on lines 143..188

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

      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

              var playTune = function() {
      
                  if(i < notesToBePlayed.length){
                      var note = notesToBePlayed[i].note;
                      // how hard the note gets hit
      Severity: Major
      Found in public/js/controllers/ScoreController.js and 1 other location - About 2 days to fix
      public/js/controllers/PatternController.js on lines 153..198

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

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

      MusicXMLAnalyzer.DashboardView = function(){
      
          var that = {},
      
          $logMessages = null,
      Severity: Major
      Found in public/js/views/DashboardView.js - About 1 day to fix

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

            getVexflowDuration = function(duration, type) {
                switch (duration) {
                    case "whole":
                        switch (type) {
                            case 0: return "w"; break;        // 0 is normal note
        Severity: Major
        Found in public/js/views/ScoreView.js and 1 other location - About 1 day to fix
        public/js/views/ResultView.js on lines 702..761

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

        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

            getVexflowDuration = function(duration, type) {
                switch (duration) {
                    case "whole":
                        switch (type) {
                            case 0: return "w"; break;        // 0 is normal note
        Severity: Major
        Found in public/js/views/ResultView.js and 1 other location - About 1 day to fix
        public/js/views/ScoreView.js on lines 341..400

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

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

        MusicXMLAnalyzer.PatternController = function() {
            var that = {},
            once = true,
            once2 = true,
            stop = false,
        Severity: Minor
        Found in public/js/controllers/PatternController.js - About 1 day 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 ScoreView has 310 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        MusicXMLAnalyzer.ScoreView = function(){
        
            var that = {},
        
            $scoreValue = null,
        Severity: Major
        Found in public/js/views/ScoreView.js - About 1 day to fix
          Severity
          Category
          Status
          Source
          Language