Showing 234 of 234 total issues
Method create
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def create
def crea_pmindicadorpf(mind, fini, ffin, num, np)
pm = Cor1440Gen::Pmindicadorpf.create(
mindicadorpf_id: mind.id,
finicio: fini,
- 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 eval
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
def eval(contexto, menserror = "".dup)
# args que siempre sea vector con argumentos
args = argsp.class.to_s != "Array" ? [argsp] : argsp
# argsev contendrá evaluaciónd de los argumentos necesarios
argsev = []
Method initialize_cor1440_gen
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.initialize_cor1440_gen(habilidad, usuario = nil)
# Sin autenticación puede consultarse información geográfica
habilidad.can(:read, [Msip::Pais, Msip::Departamento, Msip::Municipio, Msip::Centropoblado])
if !usuario || usuario.fechadeshabilitacion
return
Method filtra_contenido_params
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def filtra_contenido_params
if !params || !params[:actividad]
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if mind.funcionresultado.to_s != "" # Medir con esp de medicionindicadorpf
contexto = {
"Actividades_contribuyentes" =>
Cor1440Gen::Actividad.where(id: idacs),
}
- 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 139.
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 mind.funcionresultado.to_s != ""
# Medir con esp de medicionindicadorpf
contexto = {
"Efectos_contribuyentes" =>
Cor1440Gen::Efecto.where(id: idefs),
- 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 139.
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 copia
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def copia
if !params || !params[:proyectofinanciero_id]
render(inline: "Falta parámetro proyectofinanciero_id")
return
end
Method contar_beneficiarios
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def contar_beneficiarios
@contarb_actividad = Cor1440Gen::Actividad.all
@contarb_pf = Cor1440Gen::Proyectofinanciero.all
@contarb_pfid = nil
- 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 update_cor1440_gen
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_cor1440_gen
@pf_respaldo = {}
# para no perder proyectos financieros sin actividad de marco lógico
# en caso de errores de validación
if actividad_params &&
Method conancestros
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def conancestros
prob = ""
actividadpf_ids = []
proyectofinanciero_ids = []
if params[:proyectofinanciero_ids]
- 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 contar_beneficiarios
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def contar_beneficiarios
@contarb_actividad = Cor1440Gen::Actividad.all
@contarb_pf = Cor1440Gen::Proyectofinanciero.all
@contarb_pfid = nil
Method contar
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def contar
@contar_actividad = Cor1440Gen::Actividad.all
@contar_pf = Cor1440Gen::Proyectofinanciero.all
@contar_pfid = nil
@contar_ofi = nil
- 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
module Concerns
module Controllers
module ObjetivospfController
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 114.
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 ResultadospfController
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 114.
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 arregla_tablas_poblacion_desde_2020
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def arregla_tablas_poblacion_desde_2020(resultado)
ActiveRecord::Base.connection.execute(<<-SQL)
DROP VIEW IF EXISTS cor1440_gen_vista_resumentpob CASCADE;
CREATE VIEW cor1440_gen_vista_resumentpob AS (
SELECT * FROM (SELECT a.id AS actividad_id, ARRAY_TO_STRING(ARRAY(
Method importa
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def importa(datosent, datossal, menserror, opciones = {})
ndatosent = datosent.clone # Datos que falta analizar
respuestafor = {} # Respuestas a formularios, llave id de formu.
caracterizacion = {} # Caracterización, llave es id de formu.
valorcampo = {} # Valores llave 1 es id formu. llave 2 es id campo
File medicion_helper.rb
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Cor1440Gen
module MedicionHelper
# SINTAXIS. Basada en ejemplos:
# * https://kschiess.github.io/parslet/get-started.html
# * https://github.com/kschiess/parslet/blob/master/example/calc.rb
Method asegura_camposdinamicos
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def asegura_camposdinamicos(actividad, current_usuario_id)
@listadoasistencia = false
vfid = [] # ids de formularios que deben presentarse
actividad.actividadpf.each do |apf|
if apf.actividadtipo
Method create
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
def crea_pmindicadorpf(mind, fini, ffin, num, np)
pm = Cor1440Gen::Pmindicadorpf.create(
mindicadorpf_id: mind.id,
finicio: fini,
File ability.rb
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Cor1440Gen
class Ability < Msip::Ability
ROLADMIN = 1
ROLDIR = 3
ROLOPERADOR = 5 # Analista