Showing 410 of 410 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
window.Rails.ajax({
type: 'GET',
url: a,
data: d,
success: (resp, estado, xhr) => {
- 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 137.
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
window.Rails.ajax({
type: 'GET',
url: a,
data: d,
success: (resp, estado, xhr) => {
- 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 137.
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 update_gen
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_gen
respond_to do |format|
if (caso_params[:caso_ubicacionpre_attributes])
# Usa ubicacionepre existente o agrega si hace falta
Function cambiarficha
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
cambiarficha(){
if(event.target.dataset.enviarFichaCasoTarget == 'actos-pestana'){
document.getElementById("capa-cargando").style.display = 'flex';
if(this.requiereGuardar()){
let casoId = this.idcasoTarget.value
Method index
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def index
if !Rails.configuration.x.sivel2_consulta_web_publica
authorize! :index, Sivel2Gen::Caso
end
begin
- 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 importar_relato
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.importar_relato(doc, menserror, sintaxis_errores, mensexito, ids_importados,
usuario_id, formato_sexo)
if !Nokogiri::XML(doc).errors.empty?
Nokogiri::XML(doc).errors.each do |error|
sintaxis_errores.push(error.message)
Method sivel2_gen_victima_presenta
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def sivel2_gen_victima_presenta(atr)
case atr.to_s
when 'fecha_caso'
self.caso ? self.caso.fecha : ''
when '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 create_sivel2_gen
has a Cognitive Complexity of 29 (exceeds 5 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
- 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 graficar_conteo_controller.rb
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Sivel2Gen
module Concerns
module Controllers
module GraficarConteoController
extend ActiveSupport::Concern
File ability.rb
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Sivel2Gen
# Permisos
class Ability < Msip::Ability
include CanCan::Ability
File conscaso.rb
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Sivel2Gen
module Concerns
module Models
module Conscaso
extend ActiveSupport::Concern
Function presentarMapaOsm
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
presentarMapaOsm(usuario_autenticado) {
var usuario_aut_global = usuario_autenticado;
// Borrar clase container y ocultar pie de página
document.querySelector('.navbar').classList.add('navbarosm');
document.querySelector('.card-body').classList.add('cardbodyosm');
Similar blocks of code found in 2 locations. 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
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 118.
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 valida_categoria_presponsable
consl= "WITH RECURSIVE cteRecursion AS (
SELECT id, 1 AS Level
FROM public.sivel2_gen_presponsable
WHERE id = 39
- 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 118.
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 actualizarEdad
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
actualizarEdad(event){
let anio = parseInt(this.anionacTarget.value);
let mes = parseInt(this.mesnacTarget.value) - 1;
let dia = parseInt(this.dianacTarget.value);
- 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 victimizaciones
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def victimizaciones
authorize! :contar, Sivel2Gen::Caso
# Filtros
pFini = escapar_param(params, [:filtro, '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
Method recorrer_observaciones_co
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def recorrer_observaciones_co(ele, menserror)
case ele[0]
when 'filiacion'
if Sivel2Gen::Filiacion.where('TRIM(nombre)=?', ele[1].strip).count ==1
self.filiacion_id = Sivel2Gen::Filiacion.
- 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 importa
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def importa(datosent, datossal, menserror, opciones = {})
pais = Msip::Pais.
where('nombre ILIKE ?', datosent['pais']).ids[0]
self.pais_id = pais || Msip.paisomision
dep = Msip::Departamento.
- 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 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Sivel2Gen__AutocompletaAjaxColectivas from "./AutocompletaAjaxColectivas"
window.Sivel2Gen__AutocompletaAjaxColectivas = Sivel2Gen__AutocompletaAjaxColectivas
import Sivel2Gen__AutocompletaAjaxFamiliares from "./AutocompletaAjaxFamiliares"
window.Sivel2Gen__AutocompletaAjaxFamiliares = Sivel2Gen__AutocompletaAjaxFamiliares
Identical blocks of code found in 2 locations. Consider refactoring. Open
if(elem.multiple){
let opciones = elem.options
let valores_multi= []
for (const opc of opciones){
if(opc.selected){
- 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 99.
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