freakimkaefig/Music-XML-Analyzer

View on GitHub

Showing 286 of 286 total issues

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

            for (var j = 0; j < score.measures[i].notes.length; j++) {
                if (score.measures[i].notes[j].pitch && score.measures[i].notes[j].pitch.beam) {
                    score.measures[i].notes[j].pitch.tuplet = "3";
                } else if(score.measures[i].notes[j].pitch) {
                    score.measures[i].notes[j].pitch.tuplet = false;
Severity: Major
Found in public/js/views/ScoreView.js and 1 other location - About 7 hrs to fix
public/js/views/ResultView.js on lines 410..416

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

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 < pattern.measures[i].notes.length; j++) {
                    if (pattern.measures[i].notes[j].pitch && pattern.measures[i].notes[j].pitch.beam) {
                        pattern.measures[i].notes[j].pitch.tuplet = "3";
                    } else if(pattern.measures[i].notes[j].pitch) {
                        pattern.measures[i].notes[j].pitch.tuplet = false;
Severity: Major
Found in public/js/views/ResultView.js and 1 other location - About 7 hrs to fix
public/js/views/ScoreView.js on lines 192..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 184.

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 search has 186 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/RhythmController.php - About 7 hrs to fix

    Function _countIntervals has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

        private function _countIntervals($xml){
            $tonika = array("C" => 0,
                            "D" => 2,
                            "E" => 4,
                            "F" => 5,
    Severity: Minor
    Found in app/controllers/SearchController.php - About 7 hrs 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 PatternModel.js has 472 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /** @constructor */
    MusicXMLAnalyzer.PatternModel = function(){
    
        var that = {},
        noteElements = [],
    Severity: Minor
    Found in public/js/models/PatternModel.js - About 7 hrs to fix

      Function _mergeResults has 175 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _mergeResults = function(resultsArr) {
              mergedArr = {
                  artist: [],
                  clef: null,
                  count_measures: 0.0,
      Severity: Major
      Found in public/js/models/DashboardModel.js - About 7 hrs to fix

        Method _countIntervals has 173 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function _countIntervals($xml){
                $tonika = array("C" => 0,
                                "D" => 2,
                                "E" => 4,
                                "F" => 5,
        Severity: Major
        Found in app/controllers/SearchController.php - About 6 hrs to fix

          Function generateVexflowNotes has 170 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              generateVexflowNotes = function(pattern, result) {
                  // prepare pattern if no result from ResultController.php
                  if (!result) {
                      for (var i = 0; i < pattern.measures.length; i++) {
                          for (var j = 0; j < pattern.measures[i].notes.length; j++) {
          Severity: Major
          Found in public/js/views/ResultView.js - About 6 hrs to fix

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

                initKeyDistribution = function(data) {
                    if (keyDistribution) {
                        keyDistribution.destroy();
                    }
                    keyDistribution = new d3pie("pie_keyDistribution", {
            Severity: Major
            Found in public/js/views/DashboardView.js and 1 other location - About 6 hrs to fix
            public/js/views/DashboardView.js on lines 461..490

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

            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

                initNoteTypeDistribution = function(data) {
                    if (noteTypeDistribution) {
                        noteTypeDistribution.destroy();
                    }
                    noteTypeDistribution = new d3pie("pie_noteTypeDistribution", {
            Severity: Major
            Found in public/js/views/DashboardView.js and 1 other location - About 6 hrs to fix
            public/js/views/DashboardView.js on lines 423..452

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

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

            MusicXMLAnalyzer.ResultController = function(){
            
                var that = {},
            
                model = null,
            Severity: Minor
            Found in public/js/controllers/ResultController.js - About 6 hrs 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 ResultController has 163 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            MusicXMLAnalyzer.ResultController = function(){
            
                var that = {},
            
                model = null,
            Severity: Major
            Found in public/js/controllers/ResultController.js - About 6 hrs to fix

              Method generateScore has 163 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function generateScore($uploadId, $partId) {
                      $upload = Upload::find($uploadId);
                      if ($upload) {
                          $doc = new DOMDocument();
                          $doc->loadXML($upload->content);
              Severity: Major
              Found in app/controllers/ScoreController.php - About 6 hrs to fix

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

                    getDuration = function(type){
                        var duration;
                
                        if (type == "whole"){
                            duration = 1;
                Severity: Major
                Found in public/js/controllers/PatternController.js and 1 other location - About 5 hrs to fix
                public/js/controllers/ResultController.js on lines 104..124

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

                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

                    getDuration = function(type){
                        var duration;
                
                        if (type == "whole"){
                            duration = 1;
                Severity: Major
                Found in public/js/controllers/ResultController.js and 1 other location - About 5 hrs to fix
                public/js/controllers/PatternController.js on lines 75..95

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

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

                    private function _determineKey($xml){
                        $keys = $xml->xpath("//key");
                        $keysArray = array(
                            (object)array("label" => "C major", "value" => 0 ),
                            (object)array("label" => "G major", "value" => 0 ),
                Severity: Minor
                Found in app/controllers/SearchController.php - About 5 hrs 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 _determineKey has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function _determineKey($xml){
                        $keys = $xml->xpath("//key");
                        $keysArray = array(
                            (object)array("label" => "C major", "value" => 0 ),
                            (object)array("label" => "G major", "value" => 0 ),
                Severity: Major
                Found in app/controllers/SearchController.php - About 5 hrs to fix

                  File DashboardView.js has 389 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /** @constructor */
                  MusicXMLAnalyzer.DashboardView = function(){
                  
                      var that = {},
                  
                  
                  Severity: Minor
                  Found in public/js/views/DashboardView.js - About 5 hrs to fix

                    Function _getKey has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function _getKey($id){
                            $xml = simplexml_load_string(Upload::find($id)->content);
                            $keys = $xml->xpath("//key");
                            $key = $keys[0];
                    
                    
                    Severity: Minor
                    Found in app/controllers/ResultController.php - About 5 hrs 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

                            svg.selectAll(".bar")
                               .data(data)
                               .enter()
                               .append("rect")
                               .attr("class", "bar")
                    Severity: Major
                    Found in public/js/views/DashboardView.js and 1 other location - About 5 hrs to fix
                    public/js/views/DashboardView.js on lines 394..402

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language