codn/adminpanel

View on GitHub

Showing 139 of 139 total issues

Function datepickerPlugin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var datepickerPlugin = function(option){
        var args = Array.apply(null, arguments);
        args.shift();
        var internal_return;
        this.each(function(){
Severity: Minor
Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

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

                    if (this.showSeconds) {
                        this.$widget.find('span.bootstrap-timepicker-second').text(this.second < 10 ? '0' + this.second : this.second);
                    }
    Severity: Major
    Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 470..472

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

    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

    Method initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(user)
    
        if user.nil?
        elsif user.role.name == 'Admin'
          can :manage, :all
    Severity: Minor
    Found in app/models/ability.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

                    if (this.showSeconds) {
                        this.$widget.find('input.bootstrap-timepicker-second').val(this.second < 10 ? '0' + this.second : this.second);
                    }
    Severity: Major
    Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 479..481

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

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

        Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
          var dirReader, errorHandler, readEntries;
          dirReader = directory.createReader();
          errorHandler = function(error) {
            return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
    Severity: Minor
    Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix

      Function discover has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        Dropzone.discover = function() {
          var checkElements, dropzone, dropzones, _i, _len, _results;
          if (document.querySelectorAll) {
            dropzones = document.querySelectorAll(".dropzone");
          } else {
      Severity: Minor
      Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix

        Function showWidget has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                , showWidget: function(e) {
                    e.stopPropagation();
                    e.preventDefault();
        
                    if (this.open) {
        Severity: Minor
        Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js - About 1 hr to fix

          Method field_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def field_value(attr_type, attribute, object)
                case attr_type
                when 'select'
                  belong_to_object_name(object, attribute.gsub('_id', ''))
                when 'checkbox'
          Severity: Minor
          Found in app/helpers/adminpanel/shared_pages_helper.rb - About 1 hr to fix

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

                  dateUpdated: function(e){
                      // `this.updating` is a workaround for preventing infinite recursion
                      // between `changeDate` triggering and `setUTCDate` calling.  Until
                      // there is a better mechanism.
                      if (this.updating)
          Severity: Minor
          Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js - About 1 hr to fix

            Function getElements has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Dropzone.getElements = function(els, name) {
                var e, el, elements, _i, _j, _len, _len1, _ref;
                if (els instanceof Array) {
                  elements = [];
                  try {
            Severity: Minor
            Found in app/assets/javascripts/adminpanel/dropzone.js - About 1 hr to fix

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

                    this.timeout = setTimeout(function() {
                      if (self.hoverState == 'out') self.hide()
                    }, self.options.delay.hide)
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/adminpanel/bootstrap.js on lines 854..856

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

              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.timeout = setTimeout(function() {
                      if (self.hoverState == 'in') self.show()
                    }, self.options.delay.show)
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/adminpanel/bootstrap.js on lines 866..868

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

              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 = files.length; _i < _len; _i++) {
                                file = files[_i];
                                _this.addFile(file);
                              }
              Severity: Minor
              Found in app/assets/javascripts/adminpanel/dropzone.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/adminpanel/dropzone.js on lines 1577..1580

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

              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 (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
                      el = _ref[_j];
                      elements.push(el);
                    }
              Severity: Minor
              Found in app/assets/javascripts/adminpanel/dropzone.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/adminpanel/dropzone.js on lines 571..574

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

              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 (this.second < 0) {
                                  this.second = 0;
                              } else if (this.second >= 60) {
                                  this.second = 59;
                              }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 3 other locations - About 55 mins to fix
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 323..327
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 339..343
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 346..350

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

              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 (this.minute < 0) {
                              this.minute = 0;
                          } else if (this.minute >= 60) {
                              this.minute = 59;
                          }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 3 other locations - About 55 mins to fix
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 323..327
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 339..343
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 355..359

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

              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 (this.hour > 12) {
                                  this.hour = 12;
                              } else if (this.hour < 1) {
                                  this.hour = 1;
                              }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-timepicker.js and 3 other locations - About 55 mins to fix
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 339..343
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 346..350
              app/assets/javascripts/adminpanel/bootstrap-timepicker.js on lines 355..359

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

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

                          if (this.isInput){
                              element = this.element;
                          }
                          else if (this.component){
                              element = this.element.find('input');
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 2 other locations - About 55 mins to fix
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 530..534
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1350..1355

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

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

                              if (this.isInput){
                                  element = this.element;
                              }
                              else if (this.component){
                                  element = this.element.find('input');
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 2 other locations - About 55 mins to fix
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 530..534
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1164..1169

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

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

                          if (this.isInput) {
                              element = this.element;
                          } else if (this.component) {
                              element = this.element.find('input');
                          }
              Severity: Major
              Found in app/assets/javascripts/adminpanel/bootstrap-datepicker.js and 2 other locations - About 55 mins to fix
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1164..1169
              app/assets/javascripts/adminpanel/bootstrap-datepicker.js on lines 1350..1355

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

              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