Showing 272 of 272 total issues
Method barra_navegacion
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def barra_navegacion(opciones, &bloque)
r = content_tag(
:nav,
class: "navbar navbar-expand-lg navbar-light bg-light",
) do
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (typeof el.tomselect == 'undefined' &&
(el.tagName == "INPUT" || el.tagName == "SELECT") &&
window.TomSelect) {
new window.TomSelect(el, window.configuracionTomSelect)
}
- 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 65.
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 (typeof el.tomselect == 'undefined' &&
(el.tagName == "INPUT" || el.tagName == "SELECT") &&
window.TomSelect) {
new window.TomSelect(el, window.configuracionTomSelect)
}
- 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 65.
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_msip
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def presenta_msip(atr)
case atr.to_s
when "{:orgsocial_persona=>[]}"
if orgsocial_persona
orgsocial_persona.inject("") do |memo, s|
Method index_msip
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index_msip(c = nil)
if c.nil?
c = Msip::Persona.all
end
if params[:term]
Method poner_nombre_estandar
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def poner_nombre_estandar
self.nombre, self.nombre_sin_pais = Msip::Ubicacionpre.nomenclatura(
pais.nombre,
departamento ? departamento.nombre : "",
municipio ? municipio.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
Method formato_ubicacion_partes
has 35 lines of code (exceeds 25 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
Function msip_ubicacionpre_expandible_busca_lugar
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function msip_ubicacionpre_expandible_busca_lugar(s, ubi) {
root = window
msip_arregla_puntomontaje(root)
cnom = s.attr('id')
v = $("#" + cnom).data('autocompleta')
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]
Similar blocks of code found in 3 locations. Consider refactoring. Open
document.querySelectorAll('.alert-success').forEach((element) => {
element.style.color = tema.alerta_exito_fuente;
element.style.backgroundColor = tema.alerta_exito_fondo;
});
- 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 63.
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 3 locations. Consider refactoring. Open
document.querySelectorAll('.alert-danger').forEach((element) => {
element.style.color = tema.alerta_problema_fuente;
element.style.backgroundColor = tema.alerta_problema_fondo;
});
- 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 63.
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 3 locations. Consider refactoring. Open
document.querySelectorAll('.msip-sf-bs-input:not(.form-check-input)').forEach((element) => {
element.style.backgroundColor = tema.fondo;
element.style.color = tema.color_fuente;
});
- 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 63.
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 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") }
Similar blocks of code found in 2 locations. Consider refactoring. Open
module Concerns
module Controllers
module TrivalentesController
extend ActiveSupport::Concern
- 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 58.
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
module Concerns
module Controllers
module SectoresorgsocialController
extend ActiveSupport::Concern
- 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 58.
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 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"