codn/adminpanel

View on GitHub

Showing 57 of 139 total issues

Function update has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        update: function(){
            if (!this._allow_update)
                return this;

            var oldDates = this.dates.copy(),
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 2 hrs to fix

    Function addedfile has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          addedfile: function(file) {
            var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results;
            if (this.element === this.previewsContainer) {
              this.element.classList.add("dz-started");
            }
    Severity: Minor
    Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix

      Function show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        , show: function () {
            var $tip
              , inside
              , pos
              , actualWidth
      Severity: Minor
      Found in app/assets/javascripts/adminpanel/bootstrap.js - About 1 hr to fix

        Function Datepicker has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var Datepicker = function(element, options){
                this._process_options(options);
        
                this.dates = new DateArray();
                this.viewDate = this.o.defaultViewDate;
        Severity: Minor
        Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

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

                  "fnUpdate": function ( oSettings, fnDraw ) {
                    var iListLength = 5;
                    var oPaging = oSettings.oInstance.fnPagingInfo();
                    var an = oSettings.aanFeatures.p;
                    var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
          Severity: Minor
          Found in app/assets/javascripts/adminpanel/tables.js - About 1 hr to fix

            Method form_attributes has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.form_attributes
                  [
                    {
                      'name' => {
                        'type' => 'text_field',
            Severity: Minor
            Found in app/models/adminpanel/user.rb - About 1 hr to fix

              Function getClassNames has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      getClassNames: function(date){
                          var cls = [],
                              year = this.viewDate.getUTCFullYear(),
                              month = this.viewDate.getUTCMonth(),
                              today = new Date();
              Severity: Minor
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

                Method field_value has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def field_value(attr_type, attribute, object)
                      case attr_type
                      when 'select'
                        belong_to_object_name(object, attribute.gsub('_id', ''))
                      when 'checkbox'
                Severity: Minor
                Found in app/helpers/adminpanel/shared_pages_helper.rb - About 1 hr to fix

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

                          moveMonth: function(date, dir){
                              if (!date)
                                  return undefined;
                              if (!dir)
                                  return date;
                  Severity: Minor
                  Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

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

                        var DateArray = (function(){
                            var extras = {
                                get: function(i){
                                    return this.slice(i)[0];
                                },
                    Severity: Minor
                    Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

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

                        , slide: function (type, next) {
                            var $active = this.$element.find('.item.active')
                              , $next = next || $active[type]()
                              , isCycling = this.interval
                              , direction = type == 'next' ? 'left' : 'right'
                      Severity: Minor
                      Found in app/assets/javascripts/adminpanel/bootstrap.js - About 1 hr to fix

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

                                updateNavArrows: function(){
                                    if (!this._allow_update)
                                        return;
                        
                                    var d = new Date(this.viewDate),
                        Severity: Minor
                        Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

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

                                  , setDefaultTime: function(defaultTime){
                                      if (defaultTime) {
                                          if (defaultTime === 'current') {
                                              var dTime = new Date();
                                              var hours = dTime.getHours();
                          Severity: Minor
                          Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 1 hr to fix

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

                                    , init: function () {
                                        if (this.$element.parent().hasClass('input-append')) {
                                            this.$element.parent('.input-append').find('.add-on').on('click', $.proxy(this.showWidget, this));
                                            this.$element.on({
                                                focus: $.proxy(this.highlightUnit, this),
                            Severity: Minor
                            Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 1 hr to fix

                              Function resize has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    resize: function(file) {
                                      var info, srcRatio, trgRatio;
                                      info = {
                                        srcX: 0,
                                        srcY: 0,
                              Severity: Minor
                              Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix

                                Function createThumbnailFromUrl has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback, crossOrigin) {
                                      var img;
                                      img = document.createElement("img");
                                      if (crossOrigin) {
                                        img.crossOrigin = crossOrigin;
                                Severity: Minor
                                Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix

                                  Function datepickerPlugin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      var datepickerPlugin = function(option){
                                          var args = Array.apply(null, arguments);
                                          args.shift();
                                          var internal_return;
                                          this.each(function(){
                                  Severity: Minor
                                  Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

                                    Method initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def initialize(user)
                                    
                                        if user.nil?
                                        elsif user.role.name == 'Admin'
                                          can :manage, :all
                                    Severity: Minor
                                    Found in app/models/ability.rb - About 1 hr 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

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

                                        Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
                                          var dirReader, errorHandler, readEntries;
                                          dirReader = directory.createReader();
                                          errorHandler = function(error) {
                                            return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
                                    Severity: Minor
                                    Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix

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

                                        Dropzone.discover = function() {
                                          var checkElements, dropzone, dropzones, _i, _len, _results;
                                          if (document.querySelectorAll) {
                                            dropzones = document.querySelectorAll(".dropzone");
                                          } else {
                                      Severity: Minor
                                      Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language