codn/adminpanel

View on GitHub

Showing 139 of 139 total issues

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

          for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
            node = _ref1[_j];
            node.innerHTML = this.filesize(file.size);
          }
Severity: Major
Found in app/assets/javascripts/adminpanel/dropzone.js and 1 other location - About 1 hr to fix
app/assets/javascripts/adminpanel/dropzone.js on lines 261..264

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

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

          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
            node = _ref[_i];
            node.textContent = this._renameFilename(file.name);
          }
Severity: Major
Found in app/assets/javascripts/adminpanel/dropzone.js and 1 other location - About 1 hr to fix
app/assets/javascripts/adminpanel/dropzone.js on lines 266..269

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

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

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

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

                                if (this.dateWithinRange(newViewDate)){
                                    this.focusDate = this.viewDate = newViewDate;
                                    this.setValue();
                                    this.fill();
                                    e.preventDefault();
            Severity: Major
            Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1277..1282

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

            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

                                        case 'M':
                                            filtered = $(dates[language].monthsShort).filter(match_part);
                                            val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
                                            break;
            Severity: Major
            Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1687..1690

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

            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

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

                                if (this.dateWithinRange(newViewDate)){
                                    this.focusDate = this.viewDate = newViewDate;
                                    this.setValue();
                                    this.fill();
                                    e.preventDefault();
            Severity: Major
            Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1305..1310

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

            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

                                        case 'MM':
                                            filtered = $(dates[language].months).filter(match_part);
                                            val = $.inArray(filtered[0], dates[language].months) + 1;
                                            break;
            Severity: Major
            Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1691..1694

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

            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

            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

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

                          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                            file = _ref[_i];
                            _results.push(this.cancelUpload(file));
                          }
                    Severity: Major
                    Found in app/assets/javascripts/adminpanel/dropzone.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/adminpanel/dropzone.js on lines 898..901

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

                    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

                          for (_i = 0, _len = files.length; _i < _len; _i++) {
                            file = files[_i];
                            _results.push(this.addFile(file));
                          }
                    Severity: Major
                    Found in app/assets/javascripts/adminpanel/dropzone.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/adminpanel/dropzone.js on lines 820..823

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

                    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

                    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

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

                                  switch (o.startView){
                                      case 2:
                                      case 'decade':
                                          o.startView = 2;
                                          break;
                      Severity: Major
                      Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 165..176

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

                      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

                                  switch (o.minViewMode){
                                      case 1:
                                      case 'months':
                                          o.minViewMode = 1;
                                          break;
                      Severity: Major
                      Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 152..163

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language