joseramonc/adminpanel

View on GitHub

Showing 138 of 138 total issues

Function widgetKeypress has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        , widgetKeypress: function(e) {
            var input = $(e.target).closest('input').attr('name');

            switch (e.keyCode) {
                case 9: //tab
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 2 hrs to fix

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

            , decrementMinute: function() {
                var newVal = this.minute - this.minuteStep;
                if (newVal < 0) {
                    this.decrementHour();
                    this.minute = newVal + 60;
    Severity: Major
    Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 670..678

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

    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

            , decrementSecond: function() {
                var newVal = this.second - this.secondStep;
                if (newVal < 0) {
                    this.decrementMinute();
                    this.second = newVal + 60;
    Severity: Major
    Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 650..658

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

    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 fnUpdate has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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

    Method google has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def google
          authorize! :read, Adminpanel::Analytic
    
          unless Adminpanel.analytics_profile_id.nil? || Adminpanel.analytics_key_filename.nil? || Adminpanel.analytics_account_email.nil?
            service_account_email = Adminpanel.analytics_account_email # Email of service account
    Severity: Major
    Found in app/controllers/adminpanel/analytics_controller.rb - About 2 hrs to fix

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

              , setValues: function(time) {
                  if (this.showMeridian) {
                      var arr = time.split(' ');
                      var timeArray = arr[0].split(':');
                      this.meridian = arr[1];
      Severity: Major
      Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 2 hrs to fix

        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

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

                          if (!!o.endDate){
                              if (o.endDate instanceof Date)
                                  o.endDate = this._local_to_utc(this._zero_time(o.endDate));
                              else
                                  o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
          Severity: Major
          Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 193..201

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

          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

                          if (!!o.startDate){
                              if (o.startDate instanceof Date)
                                  o.startDate = this._local_to_utc(this._zero_time(o.startDate));
                              else
                                  o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
          Severity: Major
          Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 204..212

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

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

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

                                  else if (e.shiftKey){
                                      newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                                      newViewDate = this.moveMonth(focusDate, dir);
                                      this._trigger('changeMonth', this.viewDate);
                                  }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1261..1276
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1289..1304
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1294..1304

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

              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 4 locations. Consider refactoring.
              Open

                                  if (e.ctrlKey){
                                      newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                                      newViewDate = this.moveYear(focusDate, dir);
                                      this._trigger('changeYear', this.viewDate);
                                  }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1266..1276
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1289..1304
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1294..1304

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

              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 4 locations. Consider refactoring.
              Open

                                  if (e.ctrlKey){
                                      newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                                      newViewDate = this.moveYear(focusDate, dir);
                                      this._trigger('changeYear', this.viewDate);
                                  }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1261..1276
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1266..1276
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1294..1304

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

              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 4 locations. Consider refactoring.
              Open

                                  else if (e.shiftKey){
                                      newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                                      newViewDate = this.moveMonth(focusDate, dir);
                                      this._trigger('changeMonth', this.viewDate);
                                  }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 3 other locations - About 1 hr to fix
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1261..1276
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1266..1276
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1289..1304

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

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

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

                      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                        file = _ref[_i];
                        if (file.status === status) {
                          _results.push(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 1152..1157

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

                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];
                          if (file.xhr === xhr) {
                            _results.push(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 494..499

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

                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 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
                    Severity
                    Category
                    Status
                    Source
                    Language