LibreCat/LibreCat

View on GitHub
public/javascripts/librecat_dropzones.js

Summary

Maintainability
C
1 day
Test Coverage

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

        init: function() {
            $('.dz-default.dz-message').addClass('col-md-11');
            this.on("uploadprogress", function(file,progress,bytesSent){
                $('html').css({ cursor: "wait" });
                if (file['accepted'] === true) {
Severity: Major
Found in public/javascripts/librecat_dropzones.js - About 3 hrs to fix

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

            init: function(){
                $('.dz-default.dz-message').addClass('qae');
                this.on("addedfile", function(file) {
                    var fileName = Dropzone.createElement("<div class=\"row\"><div class=\"progress progress-striped active\"><div class=\"progress-bar\" id=\"" + htmlEscape(file.name) + "_progress\" style=\"width:0;text-align:left;padding-left:10px;\">" + file.name + "</span></div></div></div>");
                    file.previewElement.appendChild(fileName);
    Severity: Minor
    Found in public/javascripts/librecat_dropzones.js - About 1 hr to fix

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

                          var dateString = Dropzone.createElement("<div class=\"col-md-3\" id=\"updated_" + htmlEscape(resp.tempid) + "\"><span>" + htmlEscape(resp.date_updated) + "</span></div>");
      Severity: Major
      Found in public/javascripts/librecat_dropzones.js and 4 other locations - About 35 mins to fix
      public/javascripts/librecat_dropzones.js on lines 114..114
      public/javascripts/librecat_dropzones.js on lines 120..120
      public/javascripts/librecat_dropzones.js on lines 126..126
      public/javascripts/librecat_dropzones.js on lines 129..129

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

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

                          var fileName = Dropzone.createElement("<div class=\"row\"><div class=\"col-md-12 padded text-muted\" id=\"filename_" + htmlEscape(resp.tempid) + "\"><span class=\"fa fa-file text-muted\"></span> <strong>" + htmlEscape(file.name) + "</strong></div></div>");
      Severity: Major
      Found in public/javascripts/librecat_dropzones.js and 4 other locations - About 35 mins to fix
      public/javascripts/librecat_dropzones.js on lines 120..120
      public/javascripts/librecat_dropzones.js on lines 123..123
      public/javascripts/librecat_dropzones.js on lines 126..126
      public/javascripts/librecat_dropzones.js on lines 129..129

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

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

                          var userString = Dropzone.createElement("<div class=\"col-md-3\" id=\"creator_" + htmlEscape(resp.tempid) + "\"><span>" + htmlEscape(resp.creator) + "</span></div>");
      Severity: Major
      Found in public/javascripts/librecat_dropzones.js and 4 other locations - About 35 mins to fix
      public/javascripts/librecat_dropzones.js on lines 114..114
      public/javascripts/librecat_dropzones.js on lines 120..120
      public/javascripts/librecat_dropzones.js on lines 123..123
      public/javascripts/librecat_dropzones.js on lines 129..129

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

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

                          var relationString = Dropzone.createElement("<div class=\"col-md-4\" id=\"relation_" + htmlEscape(resp.tempid) + "\"><span>" + htmlEscape(resp.relation) + "</span></div>");
      Severity: Major
      Found in public/javascripts/librecat_dropzones.js and 4 other locations - About 35 mins to fix
      public/javascripts/librecat_dropzones.js on lines 114..114
      public/javascripts/librecat_dropzones.js on lines 120..120
      public/javascripts/librecat_dropzones.js on lines 123..123
      public/javascripts/librecat_dropzones.js on lines 126..126

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

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

                          var accessString = Dropzone.createElement("<div class=\"row\"><div class=\"col-md-2\" id=\"access_" + htmlEscape(resp.tempid) + "\"><span>" + htmlEscape(resp.access_level) + "</span></div></div>");
      Severity: Major
      Found in public/javascripts/librecat_dropzones.js and 4 other locations - About 35 mins to fix
      public/javascripts/librecat_dropzones.js on lines 114..114
      public/javascripts/librecat_dropzones.js on lines 123..123
      public/javascripts/librecat_dropzones.js on lines 126..126
      public/javascripts/librecat_dropzones.js on lines 129..129

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

      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