pg_associable/app/javascript/asociable_controller.tsx
Function connect
has a Cognitive Complexity of 34 (exceeds 7 allowed). Consider refactoring. Confirmed
Confirmed
connect () {
// ID Ășnico para identificar el campo y el modal
this.elemId = Math.trunc(Math.random() * 1000000000)
this.input = this.element.querySelector('input[type=text]')
- 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
Function connect
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
connect () {
// ID Ășnico para identificar el campo y el modal
this.elemId = Math.trunc(Math.random() * 1000000000)
this.input = this.element.querySelector('input[type=text]')
File asociable_controller.tsx
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
import { Controller } from '@hotwired/stimulus'
import * as React from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
export default class extends Controller {
Function doSearch
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
doSearch (force = false) {
if (this.element.classList.contains('filled')) {
return
}
if (!force && this.input.value.length < 3) {
Function resetResultados
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
resetResultados () {
this.lastValue = null
const rows = []
if (this.element.dataset.puedeCrear) {
rows.push(
Function setMaxHeight
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Confirmed
Confirmed
setMaxHeight () {
let maxHeight
if (!this.element.closest('.modal')) {
const scrollTop = document.scrollingElement.scrollTop
const inputY = this.input.getBoundingClientRect().bottom + scrollTop
- 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"