Showing 214 of 272 total issues
Avoid deeply nested control flow statements. Open
if n[p[i]]
n = n[p[i]]
else
return ""
end
Avoid deeply nested control flow statements. Open
if r.respond_to?(:presenta_nombre)
r.presenta_nombre
else
r.id.to_s
end
Avoid deeply nested control flow statements. Open
elsif atr == "fechacreacion"
created_at
elsif atr == "fechacreacion_localizada"
Msip::FormatoFechaHelper.fecha_estandar_local(created_at)
elsif atr == "fechaactualizacion"
Method formato_ubicacion_partes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def formato_ubicacion_partes(pais_id, departamento_id, municipio_id,
centropoblado_id, con_centropoblado, con_pais)
r = ""
if pais_id.nil? || Msip::Pais.where(id: pais_id).count != 1
return r
- 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(alertaerror && xhr.status !== 0 && xhr.responseText !== ''){
alert('Error: el servicio respondió: ' + xhr.status + xhr.responseText);
}
Method rehabilita_centropoblado
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def rehabilita_centropoblado(
id, municipio_id, cplocal_cod, nombre, observacion, fechacreacion
)
# byebug
- 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 verificarutas
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def verificarutas
em = ""
unless File.directory?(Msip.ruta_anexos)
em += "No existe ruta de anexos '#{Msip.ruta_anexos}'. "
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 item_acordeon_bs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
acid, idit, titulo, expandido = false, opciones_ps = {}, &bloque
Method caja_de_verificacion_bs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def caja_de_verificacion_bs(idit, clase_div, valor, at_nombre,
etiqueta, opciones = {})
Method agregar_actualizar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.agregar_actualizar(
request, indparam1, indparam2, usuario_id, params,
modelo, registro_id
)
# Se intentó implementar a nivel de modelo con
- 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 rehabilita_centropoblado
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
id, municipio_id, cplocal_cod, nombre, observacion, fechacreacion
Method asociacion_llave_foranea
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.asociacion_llave_foranea(atr)
aso = reflect_on_all_associations
bel = aso.select { |a| a.macro == :belongs_to }
fk = bel.map do |e|
e.foreign_key.to_s
- 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 mostrar_portada
has a Cognitive Complexity of 8 (exceeds 5 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})
- 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 new_gen
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def new_gen
if cannot?(:new, clase.constantize)
# Supone alias por omision de https://github.com/CanCanCommunity/cancancan/blob/develop/lib/cancan/ability/actions.rb
authorize!(:create, clase.constantize)
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 flotante_localizado
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def flotante_localizado(*fields)
fields.each do |f|
define_method("#{f}_localizado") do
val = if attribute_method?(f)
read_attribute(f)
- 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
Consider simplifying this complex logical expression. Open
if !f || (f.class != String && f.class != Date &&
f.class != ActiveSupport::TimeWithZone) ||
(f.class == String && f == "")
return nil
end
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 !params || !params[:ubicacionpre] ||
!params[:ubicacionpre][:lugar] ||
!params[:ubicacionpre][:lugar].strip == '' ||
!params[:ubicacionpre][:pais_id] ||
Msip::Pais.where(id: params[:ubicacionpre][:pais_id]).count != 1
Method ampliar_where
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ampliar_where(w, n, v, opcmp = "=", con = "AND")
Method ampliar_where_sinap
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ampliar_where_sinap(w, n, v, opcmp = "=", con = "AND")