Showing 410 of 410 total issues
Method procesa_filtros_categoria
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def procesa_filtros_categoria(where1)
pTviolencia = escapar_param(params, [:filtro, 'tviolencia_id'])
@pDesagregarpor = escapar_param(params, [:filtro, 'segun'])
pExcluirCateRep = escapar_param(params, [:filtro, 'excluircaterep'])
lcat = Sivel2Gen::Categoria.habilitados.pluck(:id)
- 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 personas_procesa_segun_om
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def personas_procesa_segun_om(que1, tablas1, where1, que3, tablas3, where3)
ctablas1 = tablas1
tablas1 = agregar_tabla(tablas1, 'public.msip_persona AS persona')
if (ctablas1 != tablas1)
where1 = ampliar_where_sinap(
Method asignar_id_personatrelacion
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def asignar_id_personatrelacion(
params, victima_indice, victima_params, victimas_por_borrar
)
if victima_params[:persona_attributes]
if victima_params[:persona_attributes][:persona_trelacion1_attributes]
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (typeof id === 'undefined') {
id = $(v).find('div').filter(function() {
return this.attributes.class.value.match(/grupoper_id/);
}).find('input').val();
}
- 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 83.
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 nom === 'undefined') {
nom = $(v).find('div').filter(function() {
return this.attributes.class.value.match(/grupoper_nombre/);
}).find('input').val();
}
- 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 83.
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
Function actualizarTrazosPresentados
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
actualizarTrazosPresentados(etiquetas) {
var etiquetasP = []
var i = 0
trazosPresentados.forEach(function(t) {
etiquetasP.push(t.name)
Method show_sivel2_gen
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_sivel2_gen
if !Rails.configuration.x.sivel2_consulta_web_publica
authorize! :read, Sivel2Gen::Caso
end
Method municipio_caso
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def municipio_caso
r = ''
if self.caso && self.caso.ubicacionprincipal
if self.caso.ubicacionprincipal.pais_id == 170 # COLOMBIA
r += self.caso.ubicacionprincipal.municipio ?
- 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 validarcasos_controller.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Sivel2Gen
module Concerns
module Controllers
module ValidarcasosController
extend ActiveSupport::Concern
Method create_sivel2_gen
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_sivel2_gen
@merr = "" # Colchon para errores
if params[:caso][:id].nil?
@merr = 'Falta identificacion del caso'
render inline: @merr, status: :unprocessable_entity
Function crearCopiaDeCombatiente
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
static crearCopiaDeCombatiente(obj, fobj){
let div_combatiente = obj.parentElement.parentElement;
let valores_input= []
let valores_select= []
div_combatiente.querySelectorAll('input').forEach(elem => {
Method consulta
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def consulta
authorize! :contar, Sivel2Gen::Caso
arma_estructuras
Method valida_categoria_presponsable
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def valida_categoria_presponsable
consl= "WITH RECURSIVE cteRecursion AS (
SELECT id, 1 AS Level
FROM public.sivel2_gen_presponsable
WHERE id = 39
- 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 valida_categoria_presponsable
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def valida_categoria_presponsable
consl= "WITH RECURSIVE cteRecursion AS (
SELECT id, 1 AS Level
FROM public.sivel2_gen_presponsable
WHERE id = 39
- 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 nomrango
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.nomrango(fechaini, fechafin)
if !fechaini
return "Sin fechaini"
end
if !fechafin
- 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 nuevo
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def nuevo
if params[:caso_id]
@persona = Msip::Persona.new
@victima = Victima.new
@persona.nombres = 'N'
- 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 filtro_fechas
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def filtro_fechas(casos, cfecha = 'sivel2_gen_caso.fecha')
pfid = ''
if (params[:validarcaso] && params[:validarcaso][:fechaini])
if params[:validarcaso][:fechaini] != ''
pfi = params[:validarcaso][:fechaini]
- 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 creaMarcador
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
creaMarcador(punto, codigo, titulo) {
// Exportar los casos a formato GeoJson
var marcadorCaso = new L.Marker(punto);
// Acción al hacer clic en caso en el mapa
marcadorCaso.on('click', clicMarcadorCaso);
Method index
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if !Rails.configuration.x.sivel2_consulta_web_publica
authorize! :index, Sivel2Gen::Caso
end
begin
Method importa
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def importa
authorize! :create, Sivel2Gen::Caso
arc = params[:arc]
doc = nil
begin