wearefine/fae

View on GitHub
app/assets/javascripts/fae/form/_ajax.js

Summary

Maintainability
C
1 day
Test Coverage

Function htmlListeners has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  htmlListeners: function() {
    $('#js-main-content, .login-form > form, #simplemodal-data')

      /**
       * For the delete button on file input
Severity: Major
Found in app/assets/javascripts/fae/form/_ajax.js - About 2 hrs to fix

    Function addEditSubmission has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      addEditSubmission: function() {
        var _this = this;
    
        this.$addedit_form.on('ajax:success', function(evt, data, status, xhr){
    
    
    Severity: Minor
    Found in app/assets/javascripts/fae/form/_ajax.js - About 1 hr to fix

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

        filterSubmission: function() {
          var _this = this;
      
          _this.$filter_form
            .on('submit', function() {
      Severity: Minor
      Found in app/assets/javascripts/fae/form/_ajax.js - About 1 hr to fix

        Function _addEditActions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _addEditActions: function(remote_url, $wrapper) {
        
            $.get(remote_url, function(data){
              // check to see if the content is hidden and slide it down if it is.
              if ($wrapper.is(':hidden')) {
        Severity: Minor
        Found in app/assets/javascripts/fae/form/_ajax.js - About 1 hr to fix

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

                } else if ($target.hasClass('js-asset-delete')) {
                  // handle remove asset links on nested forms
                  var $parent = $target.closest('.asset-actions');
          
                  $parent.fadeOut(function(){
          Severity: Major
          Found in app/assets/javascripts/fae/form/_ajax.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/fae/form/_ajax.js on lines 279..287

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

          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 (!$this.closest('.js-addedit-form-wrapper').length) {
                  // handle remove asset links
                  var $parent = $this.closest('.asset-actions');
          
                  $parent.fadeOut(function(){
          Severity: Major
          Found in app/assets/javascripts/fae/form/_ajax.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/fae/form/_ajax.js on lines 170..178

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

          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

              $('#js-main-content, .login-form > form, #simplemodal-data')
          
                /**
                 * For the delete button on file input
                 */
          Severity: Minor
          Found in app/assets/javascripts/fae/form/_ajax.js and 1 other location - About 35 mins to fix
          app/assets/javascripts/fae/form/_ajax.js on lines 312..366

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

          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