saeedsq/django-fancy-cronfield

View on GitHub
fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js

Summary

Maintainability
D
2 days
Test Coverage

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

        init: function(options) {
            var o = $.extend({}, defaults, options);

            if (hasError(this, o)) { return this; } // check for errors
            optionOverrides(this, o); //
Severity: Major
Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 2 hrs to fix

    Function hasError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function hasError(c, o) {
            if (defined(o.columns) && defined(o.rows)) {
                $.error("gentleSelect: You cannot supply both 'rows' and 'columns'");
                return true;
            }
    Severity: Minor
    Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 1 hr to fix

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

              dialogClick: function(e) {
                  var clicked = $(e.target);
                  var $this = $(this);
                  var root = $this.data('root');
                  var opts = root.data('options');
      Severity: Minor
      Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 1 hr to fix

        Avoid too many return statements within this function.
        Open

                    return true;
        Severity: Major
        Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return true;
          Severity: Major
          Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return true;
            Severity: Major
            Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return true;
              Severity: Major
              Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return false;
                Severity: Major
                Found in fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js - About 30 mins to fix

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

                      $.fn.gentleSelect = function(method) {
                          if (methods[method]) {
                              return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
                          } else if (typeof method === 'object' || ! method) {
                              return methods.init.apply(this, arguments);
                  fancy_cronfield/static/fancy_cronfield/js/jquery-cron.js on lines 592..600

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

                  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 (!defined(o.openSpeed) || typeof o.openSpeed !== 'number' &&
                                  (typeof o.openSpeed === 'string' && (o.openSpeed !== 'slow' && o.openSpeed !== 'fast'))) {
                              $.error('gentleSelect: openSpeed must be an integer or \"slow\" or \"fast\"');
                              return true;
                          }
                  fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js on lines 62..66

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

                  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 (!defined(o.closeSpeed) || typeof o.closeSpeed !== 'number' &&
                                  (typeof o.closeSpeed === 'string' && (o.closeSpeed !== 'slow' && o.closeSpeed !== 'fast'))) {
                              $.error('gentleSelect: closeSpeed must be an integer or \"slow\" or \"fast\"');
                              return true;
                          }
                  fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js on lines 57..61

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

                  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 (!defined(o.openEffect) || (o.openEffect !== 'fade' && o.openEffect !== 'slide')) {
                              $.error("gentleSelect: openEffect must be either 'fade' or 'slide'!");
                              return true;
                          }
                  fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js on lines 71..74

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

                  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 (!defined(o.closeEffect) || (o.closeEffect !== 'fade' && o.closeEffect !== 'slide')) {
                              $.error("gentleSelect: closeEffect must be either 'fade' or 'slide'!");
                              return true;
                          }
                  fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js on lines 67..70

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

                  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 (opts.openEffect === 'fade') {
                                  dialog.fadeIn(opts.openSpeed);
                              } else {
                                  dialog.slideDown(opts.openSpeed);
                              }
                  fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js on lines 257..261

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

                  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 (opts.closeEffect === 'fade') {
                                      $this.fadeOut(opts.closeSpeed);
                                  } else {
                                      $this.slideUp(opts.closeSpeed);
                                  }
                  fancy_cronfield/static/fancy_cronfield/js/jquery-gentleSelect.js on lines 237..241

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

                  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