Showing 272 of 272 total issues
Function enviarAutomaticoFormulario
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
static enviarAutomaticoFormulario(f, metodo = 'GET', tipo = 'script', alertaerror = true, vcommit = 'Enviar', agenviarautom = true) {
const root = window;
const t = Date.now();
let d = -1;
if (root.msip_enviarautomatico_t) {
- 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 nomenclatura
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def nomenclatura(pais, departamento, municipio,
centropoblado, vereda, lugar, sitio)
if pais.to_s.strip == ""
return ['', '']
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 create
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create
@respaldo7z = Respaldo7z.new(respaldo7z_params)
respond_to do |format|
if @respaldo7z.valid?
Rake::Task["msip:vuelca"].reenable
- 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
File motor.js
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default class Msip__Motor {
/*
* Librería de funciones comunes.
* Aunque no es un controlador lo dejamos dentro del directorio
Function msip_ubicacionpre_expandible_registra
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function msip_ubicacionpre_expandible_registra(iniid, campoubi, root,
fcamdep = null, fcammun = null) {
msip_arregla_puntomontaje(root)
// Buscador en campo lugar
Method filtrar
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filtrar(reg, params_filtro)
# Control para fecha podría no estar localizado aunque
# campos por presentar si
latr1 = atributos_index.map do |a|
if a.to_s.end_with?("_localizada")
Similar blocks of code found in 3 locations. Consider refactoring. Open
document.querySelectorAll('.btn-primary').forEach((element) => {
element.style.backgroundImage = `linear-gradient(to bottom, ${tema.btn_primario_fondo_ini}, ${tema.btn_primario_fondo_fin})`;
element.style.color = tema.btn_primario_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 80.
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('.btn').forEach((element) => {
element.style.backgroundImage = `linear-gradient(to bottom, ${tema.btn_accion_fondo_ini}, ${tema.btn_accion_fondo_fin})`;
element.style.color = tema.btn_accion_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 80.
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('.btn-danger').forEach((element) => {
element.style.backgroundImage = `linear-gradient(to bottom, ${tema.btn_peligro_fondo_ini}, ${tema.btn_peligro_fondo_fin})`;
element.style.color = tema.btn_peligro_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 80.
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 validar_conjunto_municipios_biyeccion
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validar_conjunto_municipios_biyeccion(validaciones)
if Msip::Municipio.all.count != Msip::Ubicacionpre.
where(lugar: nil).where.not(municipio_id: nil).
where(centropoblado_id: nil).where(vereda_id: nil).count
validaciones << {
Method cambiar_convencion_sexo
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cambiar_convencion_sexo(convencion_final)
unless Msip::Persona::CONVENCIONES_SEXO.keys.include?(convencion_final)
Rails.logger.debug { "Conveción desconocida: #{convecion_final}" }
exit(1)
end
File formato_fecha_helper.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Msip
module FormatoFechaHelper
MESES = [
"",
"Enero",
Method create_gen
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_gen(registro = nil)
c2 = clase.demodulize.underscore
if registro
@registro = registro
else
Method fecha_ddMyyyy
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fecha_ddMyyyy(*fields)
fields.each do |f|
define_method("#{f}_ddMyyyy") do
val = read_attribute(f)
unless val
File modelo.rb
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Msip
module Modelo
extend ActiveSupport::Concern
include Msip::Localizacion
Method opciones_tabla_basica
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def opciones_tabla_basica(clase, f, campo)
col1 = clase.all
if col1.respond_to?(:habilitados)
col1 = col1.habilitados
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 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def item_acordeon_bs(
acid, idit, titulo, expandido = false, opciones_ps = {}, &bloque
)
opciones = opciones_ps.stringify_keys
content_tag(
Method validar_conjunto_departamentos_biyeccion
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validar_conjunto_departamentos_biyeccion(validaciones)
if Msip::Departamento.all.count != Msip::Ubicacionpre.
where(lugar: nil).where.not(departamento_id: nil).
where(municipio_id: nil).count
validaciones << {
Method validar_conjunto_veredas_biyeccion
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validar_conjunto_veredas_biyeccion(validaciones)
if Msip::Vereda.all.count != Msip::Ubicacionpre.
where(lugar: nil).where.not(vereda_id: nil).
where(centropoblado_id: nil).count
validaciones << {
Method validar_conjunto_centrospoblados_biyeccion
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validar_conjunto_centrospoblados_biyeccion(validaciones)
if Msip::Centropoblado.all.count != Msip::Ubicacionpre.
where(lugar: nil).where.not(centropoblado_id: nil).
where(vereda_id: nil).count
validaciones << {