Showing 241 of 410 total issues
Method lista
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def lista
if params[:tabla]
r = nil
if (params[:tabla] == "departamento" && params[:pais_id].to_i > 0)
r = Msip::Departamento.where(fechadeshabilitacion: 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 deeply nested control flow statements. Open
if victima_params[:persona_attributes][:id] != ""
vics = Sivel2Gen::Victima.where(
persona_id: victima_params[:persona_attributes][:id])
if vics.count > 0
vic = vics[0]
Avoid deeply nested control flow statements. Open
if victima_params[:id] == ""
if victima_creada == false
vic = Sivel2Gen::Victima.create(victima_params)
victima_creada = true
end
Avoid deeply nested control flow statements. Open
if pt.count > 0
params[:caso][:victima_attributes][victima_indice][:persona_attributes][:persona_trelacion1_attributes][persona_indice][:id] = pt[0].id
else
ptn = Msip::PersonaTrelacion.create(
persona1: vic.persona.id , persona2: p2_id
Method validacion_estandar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def validacion_estandar(casos, titulo, where,
atr = [:id, :fecha, :nusuario],
encabezado = [
'Código', 'Fecha del Hecho', 'Usuario'],
ordenapor = 'fecha')
Avoid deeply nested control flow statements. Open
if victima_params[:id] != ""
vic = Sivel2Gen::Victima.find(victima_params[:id].to_i)
else
victima_params_filtrado = victima_params.deep_dup.tap do |params|
params[:persona_attributes].delete(:persona_trelacion1_attributes)
Consider simplifying this complex logical expression. Open
if mesnac > mes || (dianac && dianac > 0 && dia && dia > 0 &&
dianac > dia)
na -= 1
end
Consider simplifying this complex logical expression. Open
if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
cr = crt
cv = cvt
ca = cat
end
Consider simplifying this complex logical expression. Open
if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
cr = crt
cv = cvt
ca = cat
end
Method importa
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def importa(datosent, datossal, formato_sexo, menserror, opciones = {})
Method importa
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def importa(datosent, datossal, formato_sexo,
menserror, opciones = {})
Method buscar_rango_edad
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def buscar_rango_edad(edad, modelorango)
if (!modelorango || !defined?(modelorango.constantize) ||
!defined?(!modelorango.constantize.habilitados))
puts "No se pudo usar modelorango"
return -1
- 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 presenta_arbol_presp_ul_li
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def presenta_arbol_presp_ul_li(nivel, arbol, opciones={})
subarbol = ''
if arbol && arbol[:hijos] && arbol[:hijos].count > 0
subarbol = "<ul>\n".html_safe + arbol[:hijos].map{|h|
"<li>".html_safe +
- 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 procesa_un_filtrom
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def procesa_un_filtrom(where1, r, ids)
if r[:nomfiltro] == :aniosnac
where1 += (where1 != '' ? ' AND ' : '') +
"(persona.anionac IS NULL OR persona.anionac IN ('" +
ids.sort.join("', '") + "'))"
- 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 genvic
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def genvic
authorize! :contar, Sivel2Gen::Caso
where1 = '';
@fechaini = '';
- 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 principal=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def principal=(v)
if self.id && self.caso
if v.to_i == 1
self.caso.update_attribute('ubicacion_id', self.id)
elsif self.caso.ubicacion_id == self.id
- 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 presentarMapaOsm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
presentarMapaOsm(usuario_autenticado) {
var usuario_aut_global = usuario_autenticado;
// Borrar clase container y ocultar pie de página
document.querySelector('.navbar').classList.add('navbarosm');
document.querySelector('.card-body').classList.add('cardbodyosm');
- 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 actualizarTrazosPresentados
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
actualizarTrazosPresentados(etiquetas) {
var etiquetasP = []
var i = 0
trazosPresentados.forEach(function(t) {
etiquetasP.push(t.name)
- 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 remplazarfamiliar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remplazarfamiliar
@caso = Sivel2Gen::Caso.find(params[:caso_id])
@caso.current_usuario = current_usuario
@personados = Msip::Persona.find(params[:persona_id].to_i)
@vic_position = params[:vic_position].to_i
- 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 nuevo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def nuevo
if !params[:caso_id].nil?
@presponsable = CasoPresponsable.new
@presponsable.caso_id = params[:caso_id]
@presponsable.presponsable_id = 35
- 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"