freakimkaefig/Music-XML-Analyzer

View on GitHub

Showing 168 of 286 total issues

Function ApplicationController has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MusicXMLAnalyzer.ApplicationController = function() {

    var that = {},
    headerController = null,
    uploadController = null,
Severity: Minor
Found in public/js/controllers/ApplicationController.js - About 1 hr to fix

    Method getDurationType has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getDurationType($durationFloat) {
            if ($durationFloat == 1){
                return "whole";
            } elseif ($durationFloat == 0.75) {
                return "whole";
    Severity: Minor
    Found in app/controllers/ResultController.php - About 1 hr to fix

      Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          init = function(){
              model = MusicXMLAnalyzer.ResultModel();
              $(model).on('resultExtractReceived', onResultExtractReceived);
              model.init();
      
      
      Severity: Minor
      Found in public/js/controllers/ResultController.js - About 1 hr to fix

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

            initKeyDistribution = function(data) {
                if (keyDistribution) {
                    keyDistribution.destroy();
                }
                keyDistribution = new d3pie("pie_keyDistribution", {
        Severity: Minor
        Found in public/js/views/DashboardView.js - About 1 hr to fix

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

              initNoteTypeDistribution = function(data) {
                  if (noteTypeDistribution) {
                      noteTypeDistribution.destroy();
                  }
                  noteTypeDistribution = new d3pie("pie_noteTypeDistribution", {
          Severity: Minor
          Found in public/js/views/DashboardView.js - About 1 hr to fix

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

                setValuesForNoteElement = function() {
            
                    //accidential
                    if (curAccidential == "#") {
                        noteElementAccidential = 1;
            Severity: Minor
            Found in public/js/models/PatternModel.js - About 1 hr to fix

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

                  public function search()
                  {
                      // Getting files for current user
                      $user = User::find(Cookie::get('user_id'));
                      $user->uploads->each(function($upload) {
              Severity: Minor
              Found in app/controllers/SearchController.php - About 1 hr to fix

                Function getInterval has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getInterval($n){
                        $tonika = array("C" => 0,
                                        "D" => 2,
                                        "E" => 4,
                                        "F" => 5,
                Severity: Minor
                Found in app/controllers/PatternController.php - About 1 hr 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

                Method up has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function up()
                    {
                        //Remove results <-> files relation
                        Schema::table('results', function($table) {
                            $table->dropForeign('results_file_id_foreign');
                Severity: Minor
                Found in app/database/migrations/2015_01_29_173640_rename_files_table.php - About 1 hr to fix

                  Method down has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function down()
                      {
                          //Remove results <-> uploads relation
                          Schema::table('results', function($table) {
                              $table->dropForeign('results_upload_id_foreign');
                  Severity: Minor
                  Found in app/database/migrations/2015_01_29_173640_rename_files_table.php - About 1 hr to fix

                    Function init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        init = function() {
                            console.info("MusicXMLAnalyzer.ScoreController.init");
                            view = MusicXMLAnalyzer.ScoreView();
                            view.init();
                    
                    
                    Severity: Minor
                    Found in public/js/controllers/ScoreController.js - About 1 hr to fix

                      Function init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          init = function(){
                              $uploadModal = $('#uploadModal');
                              $uploadModal.data('backdrop', 'static');
                              $uploadModal.data('keyboard', false);
                      
                      
                      Severity: Minor
                      Found in public/js/views/UploadView.js - About 1 hr to fix

                        Method getInterval has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function getInterval($n){
                                $tonika = array("C" => 0,
                                                "D" => 2,
                                                "E" => 4,
                                                "F" => 5,
                        Severity: Minor
                        Found in app/controllers/PatternController.php - About 1 hr to fix

                          Function filesize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function filesize() {
                                  // Assume failure
                                  $result = -1;
                          
                                  $curl = curl_init( $this->url );
                          Severity: Minor
                          Found in app/models/Upload.php - 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

                          Method generateResultExtract has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              private function generateResultExtract($upload_id, $part_id, $voice, $startMeasure, $start, $endMeasure, $end) {
                          Severity: Major
                          Found in app/controllers/ResultController.php - About 50 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

                              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

                              Avoid deeply nested control flow statements.
                              Open

                                              if (curName != "break") {
                                                  noteElements.push(
                                                  {
                                                  type: curMode,
                                                      notes:
                              Severity: Major
                              Found in public/js/models/PatternModel.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

                                  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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language