codn/adminpanel

View on GitHub

Showing 139 of 139 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

            , 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

    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

    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

    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

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

                                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 1185..1190

              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 500..505

              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

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