ricarthlima/eo-project-es

View on GitHub

Showing 42 of 135 total issues

Function toggle has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      _proto.toggle = function toggle() {
        if (this._element.disabled || $$$1(this._element).hasClass(ClassName.DISABLED)) {
          return;
        }

Severity: Minor
Found in app/assets/javascripts/application.js - About 1 hr to fix

    Function hide has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          _proto.hide = function hide(callback) {
            var _this2 = this;
    
            var tip = this.getTipElement();
            var hideEvent = $$$1.Event(this.constructor.Event.HIDE);
    Severity: Minor
    Found in app/assets/javascripts/application.js - About 1 hr to fix

      Function _clearMenus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            Dropdown._clearMenus = function _clearMenus(event) {
              if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
                return;
              }
      
      
      Severity: Minor
      Found in app/assets/javascripts/application.js - About 1 hr to fix

        Function show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              _proto.show = function show(relatedTarget) {
                var _this = this;
        
                if (this._isTransitioning || this._isShown) {
                  return;
        Severity: Minor
        Found in app/assets/javascripts/application.js - About 1 hr to fix

          Function hide has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                _proto.hide = function hide() {
                  var _this2 = this;
          
                  if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) {
                    return;
          Severity: Minor
          Found in app/assets/javascripts/application.js - About 1 hr to fix

            Function toggle has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  _proto.toggle = function toggle() {
                    var triggerChangeEvent = true;
                    var addAriaPressed = true;
                    var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
            
            
            Severity: Minor
            Found in app/assets/javascripts/application.js - About 1 hr to fix

              Function _dataApiKeydownHandler has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
                      // If not input/textarea:
                      //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
                      // If input/textarea:
                      //  - If space key => not a dropdown command
              Severity: Minor
              Found in app/assets/javascripts/application.js - About 1 hr to fix

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

                      _proto._showElement = function _showElement(relatedTarget) {
                        var _this3 = this;
                
                        var transition = $$$1(this._element).hasClass(ClassName.FADE);
                
                
                Severity: Minor
                Found in app/assets/javascripts/application.js - About 1 hr to fix

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

                        _proto.hide = function hide(event) {
                          var _this2 = this;
                  
                          if (event) {
                            event.preventDefault();
                  Severity: Minor
                  Found in app/assets/javascripts/application.js - About 1 hr to fix

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

                          _proto.refresh = function refresh() {
                            var _this2 = this;
                    
                            var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
                            var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
                    Severity: Minor
                    Found in app/assets/javascripts/application.js - About 1 hr to fix

                      Function _getPopperConfig has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            _proto._getPopperConfig = function _getPopperConfig() {
                              var _this2 = this;
                      
                              var offsetConf = {};
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/application.js - About 1 hr to fix

                        Function _setListeners has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              _proto._setListeners = function _setListeners() {
                                var _this3 = this;
                        
                                var triggers = this.config.trigger.split(' ');
                                triggers.forEach(function (trigger) {
                        Severity: Minor
                        Found in app/assets/javascripts/application.js - About 1 hr to fix

                          Function _transitionComplete has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                _proto._transitionComplete = function _transitionComplete(element, active, callback) {
                                  if (active) {
                                    $$$1(active).removeClass(ClassName.SHOW + " " + ClassName.ACTIVE);
                                    var dropdownChild = $$$1(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/application.js - About 1 hr to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if (activeElement) {
                                              $$$1(activeElement).removeClass(ClassName.ACTIVE);
                                            }
                            Severity: Major
                            Found in app/assets/javascripts/application.js - About 45 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $$$1.contains(parent, event.target)) {
                                          continue;
                                        }
                              Severity: Major
                              Found in app/assets/javascripts/application.js - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
                                      throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
                                    }
                                Severity: Major
                                Found in app/assets/javascripts/application.js - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
                                            if (event.which === ESCAPE_KEYCODE) {
                                              var toggle = parent.querySelector(Selector.DATA_TOGGLE);
                                              $$$1(toggle).trigger('focus');
                                            }
                                  Severity: Major
                                  Found in app/assets/javascripts/application.js - About 40 mins to fix

                                    Method buscar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def buscar
                                            @nome_busca = params[:texto]
                                            @proximos = leven(@nome_busca)
                                            
                                            if busca_vazia
                                    Severity: Minor
                                    Found in app/controllers/busca_controller.rb - About 35 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

                                    Method valid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def valid
                                            errors.add(:nome, "não pode ficar em branco") if nome == "" or nome.nil?
                                            errors.add(:marca_id, "não pode ficar em branco") if marca_id.nil?
                                            errors.add(:descricao, "não pode ficar em branco") if descricao == "" or descricao.nil?
                                            errors.add(:class_vegan, "não pode ficar em branco") if class_vegan.nil?
                                    Severity: Minor
                                    Found in app/models/produto.rb - About 35 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 too many return statements within this method.
                                    Open

                                                return "Outros"
                                    Severity: Major
                                    Found in app/helpers/application_helper.rb - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language