Showing 82 of 82 total issues
Method llena_plantilla_multiple_importadatos
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
def self.llena_plantilla_multiple_importadatos(
plantillahcm, controlador, modelo, narchent, ulteditor_id
)
puts "self.llena_plantilla. ulteditor_id=#{ulteditor_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
File plantillahcm_controller.rb
has 457 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Heb412Gen
module Concerns
module Controllers
module PlantillahcmController
extend ActiveSupport::Concern
Function ejecutarAlCargarDocumentoYRecursos
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
static ejecutarAlCargarDocumentoYRecursos() {
console.log("* Corriendo Heb412Gen__Motor::ejecutarAlCargarDocumentoYRecursos()")
if (window.location.href.match(/\/plantillahcm\/ */)) {
document.addEventListener('change', event => {
if (event.target.id = "plantillahcm_vista") {
Method llena_plantilla_multiple_importadatos
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.llena_plantilla_multiple_importadatos(
plantillahcm, controlador, modelo, narchent, ulteditor_id
)
puts "self.llena_plantilla. ulteditor_id=#{ulteditor_id}"
Method perform
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def perform(idplantilla, cmodelo, ccontrolador, ids, narch, parsimp,
extension, campoid = :id, params = nil)
puts "Inicio de generación de plantilla #{idplantilla}, con modelo #{cmodelo}, controlador #{ccontrolador}, cantidad de ids #{ids.length}, en #{narch}#{extension}"
plant = Heb412Gen::Plantillahcm.find(idplantilla)
controlador = ccontrolador.constantize
- 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 modelos_controller.rb
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Heb412Gen
class ModelosController < Msip::ModelosController
# Sin control de autorización porquue es usada por otras clases
# que si lo deben implementar
def importa_dato_gen(datosent, datossal, menserror, registro = nil, opciones = {})
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (d == -1 || d > 2) {
window.heb412_mcdir_t = t
switch (e.target.id) {
case "abrir":
window.heb412_mcdir_enlace.click()
- 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 113.
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 (d == -1 || d > 2) {
window.heb412_mcarc_t = t
switch (e.target.id) {
case "descargar":
window.heb412_mcarc_descarga.click()
- 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 113.
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 index
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def index
authorize!(:read, Heb412Gen::Doc)
if current_usuario &&
::Ability.respond_to?(:externo?) && ::Ability.externo?(current_usuario)
if request.path != "/sis/arch/generados"
- 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 perform
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(idplantilla, cmodelo, ccontrolador, ids, narch, parsimp,
extension, campoid = :id, params = nil)
puts "Inicio de generación de plantilla #{idplantilla}, con modelo #{cmodelo}, controlador #{ccontrolador}, cantidad de ids #{ids.length}, en #{narch}#{extension}"
plant = Heb412Gen::Plantillahcm.find(idplantilla)
controlador = ccontrolador.constantize
Method importadatos
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def importadatos
if params && params[:filtro] &&
params[:filtro][:plantillahcm_id] && params[:filtro][:archivo]
if params[:filtro][:plantillahcm_id].to_i <= 0
Method llena_plantilla_multiple_fd
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.llena_plantilla_multiple_fd(plantillahcm, fd,
nomcontrolador = nil)
ruta = File.join(
Rails.application.config.x.heb412_ruta,
plantillahcm.ruta,
- 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 presenta_contenido
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def presenta_contenido(rr, modhistorial = true)
@leeme = nil
@dir = []
cotejador = TwitterCldr::Collation::Collator.new(
Rails.configuration.i18n.default_locale,
- 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 completarEnlacePlantilla
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
static completarEnlacePlantilla(
elema, idselplantilla, idruta, rutagenera, formatosalida = 'ods'
) {
let formato = formatosalida
let p = $(idselplantilla).val().split('.')
- 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 llena_plantilla_fd
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.llena_plantilla_fd(plantillahcr, fd)
ruta = File.join(
Rails.application.config.x.heb412_ruta,
plantillahcr.ruta,
).to_s
- 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
Class ModelosController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class ModelosController < Msip::ModelosController
# Sin control de autorización porquue es usada por otras clases
# que si lo deben implementar
def importa_dato_gen(datosent, datossal, menserror, registro = nil, opciones = {})
if registro.nil?
File sisarch_controller.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "cgi"
module Heb412Gen
module Concerns
module Controllers
Method importadatos
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def importadatos
if params && params[:filtro] &&
params[:filtro][:plantillahcm_id] && params[:filtro][:archivo]
if params[:filtro][:plantillahcm_id].to_i <= 0
- 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 programa_generacion_listado
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def programa_generacion_listado(params, extension, campoid = :id)
if params[:idplantilla].nil? or params[:idplantilla].to_i <= 0 or
@registros == []
flash[:error] = "No hay registros por generar"
elsif Heb412Gen::Plantillahcm.where(
Method index
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
authorize!(:read, Heb412Gen::Doc)
if current_usuario &&
::Ability.respond_to?(:externo?) && ::Ability.externo?(current_usuario)
if request.path != "/sis/arch/generados"