joseramonc/adminpanel

View on GitHub

Showing 138 of 138 total issues

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

            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

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

            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

                    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 801..804

                    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 = _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 875..878

                    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

                                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

                    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

                        Severity
                        Category
                        Status
                        Source
                        Language