freakimkaefig/Music-XML-Analyzer

View on GitHub

Showing 286 of 286 total issues

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

            for (var j = 0; j < measures[i].notes.length; j++) {

                // ties
                if (measures[i].ties) {
                    if (measures[i].ties[j] !== false && measures[i].ties[j] !== undefined) {
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 123..142

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

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

            for (var j = 0; j < measures[i].notes.length; j++) {

                // ties
                if (measures[i].ties) {
                    if (measures[i].ties[j] !== false && measures[i].ties[j] !== undefined) {
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 341..360

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

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

MusicXMLAnalyzer.NotationView = function(){

    var that = {},
    context = null,
    canvas = null,
Severity: Minor
Found in public/js/views/NotationView.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 DashboardModel has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

MusicXMLAnalyzer.DashboardModel = function(){

    var that = {},

    URL_GET_UPLOAD_IDS = "/dashboard/getUploadIds",
Severity: Minor
Found in public/js/models/DashboardModel.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

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

            for (var j = 0; j < measures[i].notes.length; j++) {
                if (measures[i].tuplets && measures[i].tuplets[j]) {
                    if (measures[i].tuplets[j].toString() !== 'false' && measures[i].tuplets[j].toString() !== 'undefined') {
                        var tupletNotes = measures[i].notes.slice(j, (j + parseInt(measures[i].tuplets[j])));
                        var tupletLocation = tupletNotes[0].stem.stem_direction;
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 146..157

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

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

            for (var j = 0; j < measures[i].notes.length; j++) {
                if (measures[i].tuplets && measures[i].tuplets[j]) {
                    if (measures[i].tuplets[j].toString() !== 'false' && measures[i].tuplets[j].toString() !== 'undefined') {
                        var tupletNotes = measures[i].notes.slice(j, (j + parseInt(measures[i].tuplets[j])));
                        var tupletLocation = tupletNotes[0].stem.stem_direction;
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 364..375

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

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

File SearchController.php has 623 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Controller for analysis of uploads
 *
Severity: Major
Found in app/controllers/SearchController.php - About 1 day to fix

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

        public function down()
        {
            //Remove results <-> uploads relation
            Schema::table('results', function($table) {
                $table->dropForeign('results_upload_id_foreign');
    app/database/migrations/2015_01_29_173640_rename_files_table.php on lines 19..62

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

    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

        public function up()
        {
            //Remove results <-> files relation
            Schema::table('results', function($table) {
                $table->dropForeign('results_file_id_foreign');
    app/database/migrations/2015_01_29_173640_rename_files_table.php on lines 69..111

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

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

    MusicXMLAnalyzer.DashboardModel = function(){
    
        var that = {},
    
        URL_GET_UPLOAD_IDS = "/dashboard/getUploadIds",
    Severity: Major
    Found in public/js/models/DashboardModel.js - About 1 day to fix

      Function NotationView has 253 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function ScoreController has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
        Open

        MusicXMLAnalyzer.ScoreController = function(){
        
            var that = {},
        
            view = null,
        Severity: Minor
        Found in public/js/controllers/ScoreController.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

        File ResultView.js has 583 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /** @constructor */
        MusicXMLAnalyzer.ResultView = function(){
        
            var that = {},
        
        
        Severity: Major
        Found in public/js/views/ResultView.js - About 1 day to fix

          Function PatternController has 243 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          MusicXMLAnalyzer.PatternController = function() {
              var that = {},
              once = true,
              once2 = true,
              stop = false,
          Severity: Major
          Found in public/js/controllers/PatternController.js - About 1 day to fix

            Function PatternView has 241 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            MusicXMLAnalyzer.PatternView = function(){
            
                var that = {},
                $modeButtonClass = $(".btn-mode"),
            
            
            Severity: Major
            Found in public/js/views/PatternView.js - About 1 day to fix

              Function addNoteElement has 198 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  addNoteElement = function() {
              
                      setValuesForNoteElement();
              
                      if (curMode == 2) {
              Severity: Major
              Found in public/js/models/PatternModel.js - About 7 hrs to fix

                Method search has 197 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function search($pattern) {
                
                        $p = $pattern[0]->notes;
                        self::$patternArray = array();
                        self::$results = array();
                Severity: Major
                Found in app/controllers/MelodyController.php - About 7 hrs to fix

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

                                                  if ($restDurationFloat == 1){
                                                      $restDuration = "whole";
                                                  } elseif ($restDurationFloat == 1.5) {
                                                      $restDuration = "whole";
                                                  } elseif ($restDurationFloat == 0.75) {
                  Severity: Major
                  Found in app/controllers/MelodyController.php and 1 other location - About 7 hrs to fix
                  app/controllers/RhythmController.php on lines 150..183

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

                  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 ($restDurationFloat == 1){
                                                      $restDuration = "whole";
                                                  } elseif ($restDurationFloat == 1.5) {
                                                      $restDuration = "whole";
                                                  } elseif ($restDurationFloat == 0.75) {
                  Severity: Major
                  Found in app/controllers/RhythmController.php and 1 other location - About 7 hrs to fix
                  app/controllers/MelodyController.php on lines 168..201

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

                  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

                  Method generateResultExtract has 188 lines of code (exceeds 25 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: Major
                  Found in app/controllers/ResultController.php - About 7 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language