joseramonc/adminpanel

View on GitHub

Showing 138 of 138 total issues

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

        setDaysOfWeekDisabled: function(daysOfWeekDisabled){
            this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
            this.update();
            this.updateNavArrows();
            return this;
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 2 other locations - About 50 mins to fix
app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 589..594
app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 596..601

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

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

        setStartDate: function(startDate){
            this._process_options({startDate: startDate});
            this.update();
            this.updateNavArrows();
            return this;
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 2 other locations - About 50 mins to fix
app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 596..601
app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 603..608

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

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

        setEndDate: function(endDate){
            this._process_options({endDate: endDate});
            this.update();
            this.updateNavArrows();
            return this;
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 2 other locations - About 50 mins to fix
app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 589..594
app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 603..608

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

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

Avoid deeply nested control flow statements.
Open

                                if (this.o.minViewMode === 1){
                                    this._setDate(UTCDate(year, month, day));
                                    this.showMode();
                                } else {
                                    this.showMode(-1);
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if (hours > 12) {
                                    hours = hours - 12;
                                }
    Severity: Major
    Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (option.selected) {
                      formData.append(inputName, option.value);
                    }
      Severity: Major
      Found in app/assets/javascripts/adminpanel/dropzone.js - About 45 mins to fix

        Method collection_check_boxes has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})
        Severity: Minor
        Found in app/helpers/adminpanel/adminpanel_form_builder.rb - About 45 mins to fix

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

                  this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
          Severity: Minor
          Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 45 mins to fix
          app/assets/javascripts/adminpanel/bootstrap.js on lines 826..826

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

          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

          Avoid deeply nested control flow statements.
          Open

                                      else if (target.hasClass('new')){
                                          if (month === 11){
                                              month = 0;
                                              year += 1;
                                          }
          Severity: Major
          Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            if (this.o.minViewMode === 2){
                                                this._setDate(UTCDate(year, month, day));
                                            }
            Severity: Major
            Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 45 mins to fix

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

                      this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
              Severity: Minor
              Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 45 mins to fix
              app/assets/javascripts/adminpanel/bootstrap.js on lines 825..825

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

              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

              Avoid deeply nested control flow statements.
              Open

                                                      if (this.viewMode === 1)
                                                          this._trigger('changeYear', this.viewDate);
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 45 mins to fix

                Method create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def create
                      merge_params
                      @resource_instance = @model.new(send(whitelisted_params))
                      respond_to do |format|
                        if @resource_instance.save
                Severity: Minor
                Found in app/controllers/concerns/adminpanel/rest_actions.rb - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                                if (month === 0){
                                                    month = 11;
                                                    year -= 1;
                                                }
                                                else {
                Severity: Major
                Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 45 mins to fix

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

                    , destroy: function () {
                        this.hide().$element.off('.' + this.type).removeData(this.type)
                      }
                  Severity: Minor
                  Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/adminpanel/bootstrap.js on lines 1134..1136

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

                  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

                        this.$element
                          .on('blur',     $.proxy(this.blur, this))
                          .on('keypress', $.proxy(this.keypress, this))
                  Severity: Minor
                  Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/adminpanel/bootstrap.js on lines 1694..1696

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

                  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

                      this.options.pause == 'hover' && this.$element
                        .on('mouseenter', $.proxy(this.pause, this))
                        .on('mouseleave', $.proxy(this.cycle, this))
                  Severity: Minor
                  Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/adminpanel/bootstrap.js on lines 2021..2023

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

                  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

                    , destroy: function () {
                        this.hide().$element.off('.' + this.type).removeData(this.type)
                      }
                  Severity: Minor
                  Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/adminpanel/bootstrap.js on lines 1016..1018

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

                  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

                  Consider simplifying this complex logical expression.
                  Open

                      if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
                        if (!("classList" in document.createElement("a"))) {
                          capableBrowser = false;
                        } else {
                          _ref = Dropzone.blacklistedBrowsers;
                  Severity: Major
                  Found in app/assets/javascripts/adminpanel/dropzone.js - About 40 mins to fix

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

                          var pos = $.extend({}, this.$element.position(), {
                            height: this.$element[0].offsetHeight
                          })
                    Severity: Minor
                    Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 113..115

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

                    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