codn/adminpanel

View on GitHub

Showing 139 of 139 total issues

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

  $.fn.popover = function (option) {
    return this.each(function () {
      var $this = $(this)
        , data = $this.data('popover')
        , options = typeof option == 'object' && option
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap.js and 5 other locations - About 4 hrs to fix
app/assets/javascripts/adminpanel/bootstrap.js on lines 593..601
app/assets/javascripts/adminpanel/bootstrap.js on lines 1028..1036
app/assets/javascripts/adminpanel/bootstrap.js on lines 1247..1255
app/assets/javascripts/adminpanel/bootstrap.js on lines 1623..1631
app/assets/javascripts/adminpanel/bootstrap.js on lines 2130..2138

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

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 parseDate has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        parseDate: function(date, format, language){
            if (!date)
                return undefined;
            if (date instanceof Date)
                return date;
Severity: Major
Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 4 hrs to fix

    Function click has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            click: function(e){
                e.preventDefault();
                var target = $(e.target).closest('span, td, th'),
                    year, month, day;
                if (target.length === 1){
    Severity: Major
    Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 4 hrs to fix

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

        $.fn.dropdown = function (option) {
          return this.each(function () {
            var $this = $(this)
              , data = $this.data('dropdown')
            if (!data) $this.data('dropdown', (data = new Dropdown(this)))
      Severity: Major
      Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/adminpanel/bootstrap.js on lines 1364..1371

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

      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

        $.fn.alert = function (option) {
          return this.each(function () {
            var $this = $(this)
              , data = $this.data('alert')
            if (!data) $this.data('alert', (data = new Alert(this)))
      Severity: Major
      Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/adminpanel/bootstrap.js on lines 436..443

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

      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 getTemplate has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              , getTemplate: function() {
                  if (this.options.templates[this.options.template]) {
                      return this.options.templates[this.options.template];
                  }
                  if (this.showInputs) {
      Severity: Major
      Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 3 hrs to fix

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

                , incrementMinute: function() {
                    var newVal = this.minute + this.minuteStep - (this.minute % this.minuteStep);
                    if (newVal > 59) {
                        this.incrementHour();
                        this.minute = newVal - 60;
        Severity: Major
        Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 660..668

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

        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

                , incrementSecond: function() {
                    var newVal = this.second + this.secondStep - (this.second % this.secondStep);
                    if (newVal > 59) {
                        this.incrementMinute();
                        this.second = newVal - 60;
        Severity: Major
        Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 640..648

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

        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

        Class AdminpanelFormBuilder has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class AdminpanelFormBuilder < ActionView::Helpers::FormBuilder
            include ApplicationHelper
            alias_method :text_field_original, :text_field
            alias_method :radio_button_original, :radio_button
            alias_method :text_area_original, :text_area
        Severity: Minor
        Found in app/helpers/adminpanel/adminpanel_form_builder.rb - About 3 hrs to fix

          Function elementKeypress has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  , elementKeypress: function(e) {
                      var input = this.$element.get(0);
                      switch (e.keyCode) {
                          case 0: //input
                          break;
          Severity: Major
          Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 2 hrs to fix

            Function _buildEvents has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _buildEvents: function(){
                        var events = {
                            keyup: $.proxy(function(e){
                                if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)
                                    this.update();
            Severity: Major
            Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 2 hrs to fix

              Function place has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      place: function(){
                          if (this.isInline)
                              return this;
                          var calendarWidth = this.picker.outerWidth(),
                              calendarHeight = this.picker.outerHeight(),
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 2 hrs to fix

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

                  , getTitle: function () {
                      var title
                        , $e = this.$element
                        , o = this.options
                
                
                Severity: Major
                Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/adminpanel/bootstrap.js on lines 1116..1125

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

                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

                  , getContent: function () {
                      var content
                        , $e = this.$element
                        , o = this.options
                
                
                Severity: Major
                Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/adminpanel/bootstrap.js on lines 976..985

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

                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

                                this.$element.on({
                                    focus: $.proxy(this.highlightUnit, this),
                                    click: $.proxy(this.highlightUnit, this),
                                    keypress: $.proxy(this.elementKeypress, this),
                                    blur: $.proxy(this.blurElement, this)
                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 74..79

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

                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

                                    this.$element.on({
                                        focus: $.proxy(this.highlightUnit, this),
                                        click: $.proxy(this.highlightUnit, this),
                                        keypress: $.proxy(this.elementKeypress, this),
                                        blur: $.proxy(this.blurElement, this)
                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 59..64

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

                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 40: // down arrow
                                    switch (this.highlightedUnit) {
                                        case 'hour':
                                            this.decrementHour();
                                        break;
                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 257..273

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

                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 38: // up arrow
                                    switch (this.highlightedUnit) {
                                        case 'hour':
                                            this.incrementHour();
                                        break;
                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 278..294

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

                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 38: // up arrow
                                    switch (input) {
                                        case 'hour':
                                            this.incrementHour();
                                        break;
                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 204..220

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

                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 40: // down arrow
                                    switch (input) {
                                        case 'hour':
                                            this.decrementHour();
                                        break;
                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 187..203

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

                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