joseramonc/adminpanel

View on GitHub

Showing 56 of 138 total issues

Function Dropzone has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Dropzone(element, options) {
      var elementOptions, fallback, _ref;
      this.element = element;
      this.version = Dropzone.version;
      this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, "");
Severity: Major
Found in app/assets/javascripts/adminpanel/dropzone.js - About 2 hrs to fix

    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

                  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 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 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 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 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 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 field_value has 32 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

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

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

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