saeedsq/django-fancy-cronfield

View on GitHub

Showing 17 of 31 total issues

File jquery-cron.js has 458 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * jQuery gentleSelect plugin (version 0.1.4.1)
 * http://shawnchin.github.com/jquery-cron
 *
 * Copyright (c) 2010-2013 Shawn Chin.
Severity: Minor
Found in fancy_cronfield/static/fancy_cronfield/js/jquery-cron.js - About 7 hrs to fix

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

            init: function(opts) {
    
                // init options
                var options = opts ? opts : {}; /* default to empty obj */
                var o = $.extend([], defaults, options);
    Severity: Major
    Found in fancy_cronfield/static/fancy_cronfield/js/jquery-cron.js - About 4 hrs to fix

      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 value has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                value: function(cron_str) {
                    // when no args, act as getter
                    if (!cron_str) { return getCurrentValue(this); }
        
                    var o = this.data('options');
        Severity: Minor
        Found in fancy_cronfield/static/fancy_cronfield/js/jquery-cron.js - About 1 hr to fix

          Function getCronType has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function getCronType(cron_str, opts) {
                  // if customValues defined, check for matches there first
                  if (defined(opts.customValues)) {
                      for (key in opts.customValues) {
                          if (cron_str === opts.customValues[key]) { return key; }
          Severity: Minor
          Found in fancy_cronfield/static/fancy_cronfield/js/jquery-cron.js - About 1 hr 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 getCurrentValue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function getCurrentValue(c) {
                      var b = c.data('block');
                      var min = '*', hour = '*', day = '*', month = '*', dow = '*';
                      var selectedPeriod = b['period'].find('select').val();
                      switch (selectedPeriod) {
              Severity: Minor
              Found in fancy_cronfield/static/fancy_cronfield/js/jquery-cron.js - About 1 hr to fix

                Function cron_field has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    $.fn.cron_field = function(options) {
                        var cron_id = this.attr('id') + '-cron';
                        if ($('#' + cron_id).exists()) {
                            if (window.cron_objs[cron_id] !== undefined) {
                                return window.cron_objs[cron_id];
                Severity: Minor
                Found in fancy_cronfield/static/fancy_cronfield/js/cronfield.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

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

                        def check_html(self, widget, name, value, html='', attrs=None, **kwargs):
                    Severity: Minor
                    Found in fancy_cronfield/tests/test_widgets.py - About 45 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 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

                                Avoid too many return statements within this function.
                                Open

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

                                  Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def __init__(self, attrs=None, options=None):
                                          options = options or {}
                                          self.options = {
                                              'use_gentle_select': True,
                                              'allow_multiple_all': False,
                                  Severity: Minor
                                  Found in fancy_cronfield/widgets.py - About 25 mins 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language