Showing 42 of 135 total issues
Function toggle
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto.toggle = function toggle() {
if (this._element.disabled || $$$1(this._element).hasClass(ClassName.DISABLED)) {
return;
}
Function hide
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto.hide = function hide(callback) {
var _this2 = this;
var tip = this.getTipElement();
var hideEvent = $$$1.Event(this.constructor.Event.HIDE);
Function _clearMenus
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Dropdown._clearMenus = function _clearMenus(event) {
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
return;
}
Function show
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto.show = function show(relatedTarget) {
var _this = this;
if (this._isTransitioning || this._isShown) {
return;
Function hide
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto.hide = function hide() {
var _this2 = this;
if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) {
return;
Function toggle
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto.toggle = function toggle() {
var triggerChangeEvent = true;
var addAriaPressed = true;
var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
Function _dataApiKeydownHandler
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function _showElement
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto._showElement = function _showElement(relatedTarget) {
var _this3 = this;
var transition = $$$1(this._element).hasClass(ClassName.FADE);
Function hide
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto.hide = function hide(event) {
var _this2 = this;
if (event) {
event.preventDefault();
Function refresh
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function _getPopperConfig
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto._getPopperConfig = function _getPopperConfig() {
var _this2 = this;
var offsetConf = {};
Function _setListeners
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_proto._setListeners = function _setListeners() {
var _this3 = this;
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
Function _transitionComplete
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
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];
Avoid deeply nested control flow statements. Open
Open
if (activeElement) {
$$$1(activeElement).removeClass(ClassName.ACTIVE);
}
Consider simplifying this complex logical expression. Open
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;
}
Consider simplifying this complex logical expression. Open
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');
}
Consider simplifying this complex logical expression. Open
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');
}
Method buscar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def buscar
@nome_busca = params[:texto]
@proximos = leven(@nome_busca)
if busca_vazia
- Read upRead up
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
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?
- Read upRead up
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
Open
return "Outros"