Showing 272 of 272 total issues
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (typeof elemento.tomselect != 'undefined') {
elemento.tomselect.clear()
elemento.tomselect.clearOptions()
elemento.tomselect.sync()
elemento.tomselect.refreshOptions()
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (el.tomselect) {
el.tomselect.clear()
el.tomselect.clearOptions()
el.tomselect.sync()
el.tomselect.refreshOptions()
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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})
Method atributos_index
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def atributos_index
[
:id,
:nombre,
:fondo,
Similar blocks of code found in 2 locations. Consider refactoring. Open
def fin_semestre_ant
hoy = Time.zone.today
anio = hoy.year
if hoy.mon >= 7 && hoy.mon < 12
fin = anio.to_s + "-" + "06-30"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 51.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def inicio_semestre_ant
hoy = Time.zone.today
anio = hoy.year
if hoy.mon >= 7 && hoy.mon < 12
ini = anio.to_s + "-" + "01-01"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 51.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method presenta_nombre
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def presenta_nombre(opciones = {})
sep = ""
r = ""
if opciones[:sin_pais].nil? && pais
r = pais.nombre
- 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 remplazarOpcionesSelect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static remplazarOpcionesSelect(
idElemento, nuevasop, usatomselect = false, cid = 'id',
cetiqueta = 'nombre', opvacia = false
) {
let elemento = document.getElementById(idElemento)
- 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"