Showing 214 of 272 total issues
Method importa_gen
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def importa_gen(datosent, datossal, menserror, opciones = {})
datosent.keys.each do |ll|
case ll.to_sym
when :actualizado_en
self.updated_at = datosent[ll.to_sym]
Method campofecha_mesanio
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def campofecha_mesanio(*fields)
fields.each do |f|
define_method("#{f}_anio") do
val = self[f]
val&.year ? val.year : nil
Method index
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if !params[:term]
respond_to do |format|
format.html { render(inline: "Falta variable term") }
format.json { render(inline: "Falta variable term") }
Method opciones_tabla_basica
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def opciones_tabla_basica(clase, f, campo)
col1 = clase.all
if col1.respond_to?(:habilitados)
col1 = col1.habilitados
end
Method genera_asociacion
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def genera_asociacion
puts "Para asociarla en #{options.asocia}:"
puts <<~EOF
Cree migracion que incluya
add_column :#{options.asocia}, :#{nom_arch}_id, :integer
Method tema_usuario
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tema_usuario(current_usuario)
t = if !current_usuario || !current_usuario.tema_id
if Msip::Tema.where(id: 1).count == 1
Msip::Tema.find(1)
else
Method msip_presenta
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def msip_presenta(atr)
case atr.to_s
when "centro_poblado"
centropoblado ? centropoblado.nombre : ""
when "nacionalde"
- 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 edad_de_fechanac_fecha
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def edad_de_fechanac_fecha(anionac, mesnac, dianac,
anio, mes, dia)
if anionac.nil? || anionac == ""
return -1
end
- 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 buscar_o_agregar
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def buscar_o_agregar(pais_id, departamento_id, municipio_id,
centropoblado_id, lugar, sitio, tsitio_id,
latitud, longitud,
usa_latlon = true)
Method despliega_abajo_dk
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def despliega_abajo_dk(opcionmenu, url, opciones = {}, &bloque)
copiaop = opciones
opab = opcionmenu.gsub(" ", "_")
maticon = "home"
if opciones[:maticon]
- 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 asegura_varambiente_bd
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def asegura_varambiente_bd
# Toma ideas de https://github.com/opdemand/puppet-modules/blob/master/rails/files/databases.rake
abcs = ActiveRecord::Base.configurations
confbd = abcs.configurations.select { |c| c.env_name == Rails.env }.first
- 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 datos
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def datos
return unless params[:persona_id]
@persona = Msip::Persona.find(params[:persona_id].to_i)
authorize!(:read, @persona)
- 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 caja_de_verificacion_bs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def caja_de_verificacion_bs(idit, clase_div, valor, at_nombre,
etiqueta, opciones = {})
content_tag(
:div,
class: "form-check", # optional #{clase_div}"
Method separa_apellidos_nombres
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def separa_apellidos_nombres(nombre, menserror)
apellidos = "N"
nombres = "N"
n = nombre.to_s.gsub(/ */, " ").gsub(/^ /, "").gsub(/ $/, "")
p = n.split(" ")
Method dif_meses_dias
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dif_meses_dias(fechaini, fechafin)
m = 0
d = 0
if fechaini && fechafin && fechaini < fechafin
if fechafin.month < fechaini.month
Method lista_params_msip
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def lista_params_msip
r = [
:id,
:nusuario,
:password,
Method lista_params_msip
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def lista_params_msip
atributos_form + [
:pais_id,
:departamento_id,
:municipio_id,
Method datos
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def datos
return unless params[:persona_id]
@persona = Msip::Persona.find(params[:persona_id].to_i)
authorize!(:read, @persona)
Method asociacion_combinada
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.asociacion_combinada(atr)
r = nil
if atr.is_a?(Hash) &&
(atr.first[0].to_s.ends_with?("_ids") ||
atr.first[0].to_s.ends_with?("_attributes"))
Method mostrar_portada
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mostrar_portada
if !params[:id].nil?
@anexo = Anexo.find(params[:id].to_i)
ruta = @anexo.adjunto_file_name
# ls = %x(ls -l #{Msip.ruta_anexos})