QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub
app/assets/javascripts/angular/directives/directives.js

Summary

Maintainability
D
2 days
Test Coverage

File directives.js has 578 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function (undefined) {
    var bawds = angular.module('bawApp.directives', []);

    bawds.directive('bawRecordInformation', function () {

Severity: Major
Found in app/assets/javascripts/angular/directives/directives.js - About 1 day to fix

    Function link has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                link: function (scope, elements, attributes, controller) {
                    var element = elements[0];
                    if (element.nodeName !== "AUDIO") {
                        throw 'Cannot put ngAudio element on an element that is not a <audio />';
                    }
    Severity: Major
    Found in app/assets/javascripts/angular/directives/directives.js - About 2 hrs to fix

      Function link has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  link: function (scope, $element, attributes, controller) {
      
                      // assign a unique id to scope
                      scope.id = Number.Unique();
      
      
      Severity: Major
      Found in app/assets/javascripts/angular/directives/directives.js - About 2 hrs to fix

        Function link has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    link: function (scope, element, attrs) {
                        var $control = element,
                            $player = $control.children('div'),
                            cls = 'pause';
        
        
        Severity: Minor
        Found in app/assets/javascripts/angular/directives/directives.js - About 1 hr to fix

          Function updatePlayer has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                          var updatePlayer = function () {
                              $player.jPlayer({
                                  // Flash fallback for outdated browser not supporting HTML5 audio/video tags
                                  // http://jplayer.org/download/
                                  swfPath: 'assets/',
          Severity: Minor
          Found in app/assets/javascripts/angular/directives/directives.js - About 1 hr to fix

            Function radioInputType has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        link: function radioInputType(scope, element, attr) {
                            // make the name unique, if not defined
                            if (baw.angularCopies.isUndefined(attr.name)) {
                                element.attr('name', Number.Unique());
                            }
            Severity: Minor
            Found in app/assets/javascripts/angular/directives/directives.js - About 1 hr to fix

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

                              infoWindow.open = function open(a1, a2, a3, a4, a5, a6) {
              Severity: Minor
              Found in app/assets/javascripts/angular/directives/directives.js - About 45 mins to fix

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

                                    "boxMoved": function (element, box) {
                                        console.log("boxMoved");
                                        resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
                                    },
                Severity: Major
                Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
                app/assets/javascripts/angular/directives/directives.js on lines 358..362
                app/assets/javascripts/angular/directives/directives.js on lines 363..366
                app/assets/javascripts/angular/directives/directives.js on lines 367..370

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

                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 4 locations. Consider refactoring.
                Open

                                    "boxResized": function (element, box) {
                                        console.log("boxResized");
                                        resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
                                    },
                Severity: Major
                Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
                app/assets/javascripts/angular/directives/directives.js on lines 358..362
                app/assets/javascripts/angular/directives/directives.js on lines 367..370
                app/assets/javascripts/angular/directives/directives.js on lines 371..374

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

                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 4 locations. Consider refactoring.
                Open

                                    "boxResizing": function (element, box) {
                                        console.log("boxResizing");
                                        resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
                
                                    },
                Severity: Major
                Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
                app/assets/javascripts/angular/directives/directives.js on lines 363..366
                app/assets/javascripts/angular/directives/directives.js on lines 367..370
                app/assets/javascripts/angular/directives/directives.js on lines 371..374

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

                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 4 locations. Consider refactoring.
                Open

                                    "boxMoving": function (element, box) {
                                        console.log("boxMoving");
                                        resizeOrMoveWithApply(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box);
                                    },
                Severity: Major
                Found in app/assets/javascripts/angular/directives/directives.js and 3 other locations - About 50 mins to fix
                app/assets/javascripts/angular/directives/directives.js on lines 358..362
                app/assets/javascripts/angular/directives/directives.js on lines 363..366
                app/assets/javascripts/angular/directives/directives.js on lines 371..374

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

                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

                There are no issues that match your filters.

                Category
                Status