pasosdeJesus/cor1440_gen

View on GitHub

Showing 234 of 234 total issues

Method nueva_asistencia has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def nueva_asistencia
            authorize!(:new, Msip::Persona)
            if params[:actividad_id].nil?
              resp_error("Falta parámetro actividad_id")
              return
Severity: Minor
Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 1 hr to fix

    Method impreso has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def impreso
                @informe = Informe.find(@informe.id)
                @actividades = filtra_actividades
    
                # Ejemplo de https://github.com/sandrods/odf-report
    Severity: Minor
    Found in lib/cor1440_gen/concerns/controllers/informes_controller.rb - About 1 hr to fix

      Method eval has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

            def eval(contexto, menserror = "".dup)
              r = registro.eval(contexto, menserror)
              c = campo.to_s
              if r.nil?
                STDERR.puts "** Evaluacion de registro dió nil"
      Severity: Minor
      Found in app/helpers/cor1440_gen/medicion_helper.rb - About 1 hr to fix

      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 compara_tabla_poblacion_asistentes_actividad has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def compara_tabla_poblacion_asistentes_actividad(a)
            d = genera_dicc_poblacion_de_asistentes(a)
      
            numdif = 0
      
      
      Severity: Minor
      Found in app/helpers/cor1440_gen/conteos_helper.rb - About 1 hr to fix

        Method conancestros has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def conancestros
                    prob = ""
                    actividadpf_ids = []
                    proyectofinanciero_ids = []
                    if params[:proyectofinanciero_ids]
        Severity: Minor
        Found in lib/cor1440_gen/concerns/controllers/actividadespf_controller.rb - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                    def objetivospf
                      authorize!(:read, Cor1440Gen::Proyectofinanciero)
                      pfl = []
                      if params[:pfl] && params[:pfl] != ""
                        params[:pfl].each do |pf|
          lib/cor1440_gen/concerns/controllers/proyectosfinancieros_controller.rb on lines 140..163

          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 70.

          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

          Further Reading

          Method asegura_camposdinamicos has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

                    def asegura_camposdinamicos(efecto, current_usuario_id)
                      vfid = [] # ids de formularios que deben presentarse
          
                      if efecto.indicadorpf && efecto.indicadorpf.tipoindicador &&
                          efecto.indicadorpf.tipoindicador.formulario
          Severity: Minor
          Found in lib/cor1440_gen/concerns/controllers/efectos_controller.rb - About 1 hr to fix

          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

                    def actividadespf
                      authorize!(:read, Cor1440Gen::Proyectofinanciero)
                      pfl = []
                      if params[:pfl] && params[:pfl] != ""
                        params[:pfl].each do |pf|
          lib/cor1440_gen/concerns/controllers/proyectosfinancieros_controller.rb on lines 170..193

          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 70.

          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

          Further Reading

          Method genera_dicc_poblacion_de_asistentes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def genera_dicc_poblacion_de_asistentes(a)
                personas = {}
                a.asistencia.each do |asist|
                  if !asist.persona
                    merr = "Persona en NULL en asistencia #{asist.id} "\
          Severity: Minor
          Found in app/helpers/cor1440_gen/conteos_helper.rb - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                          if p && p.anionac && (p.anionac > self.fecha.year ||
                              (p.mesnac && p.anionac == self.fecha.year &&
                               (p.mesnac > self.fecha.month ||
                                (p.dianac && p.mesnac == self.fecha.month &&
                                 p.dianac > self.fecha.day)
            Severity: Critical
            Found in lib/cor1440_gen/concerns/models/actividad.rb - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                          if params[:finicio] &&
                              params[:finicio] != "" &&
                              params[:ffin] &&
                              params[:ffin] != "" &&
                              params[:indicadorpf_id] &&
              Severity: Critical
              Found in lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb - About 1 hr to fix

                Method relacionadas has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def relacionadas
                            prob = "".dup
                            actividadpf_ids = []
                            proyectofinanciero_ids = []
                            if params[:proyectofinanciero_ids]
                Severity: Minor
                Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 1 hr to fix

                  Method medir_indicador_particular has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def medir_indicador_particular(mind, fini, ffin)
                              resf = { resind: -1.0, rutaevidencia: "#", datosint: [], prob: "" }
                  
                              ind = mind.indicadorpf
                              if ind.nil?
                  Severity: Minor
                  Found in lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb - About 1 hr to fix

                  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 fecha_concuerda_corresponsables_habilitados has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def fecha_concuerda_corresponsables_habilitados
                              if fecha && usuario && usuario.length > 0
                                usuario.each do |u|
                                  if u.fechacreacion > fecha
                                    errors.add(:usuario, "Corresponsable #{u.presenta_nombre} " +
                  Severity: Minor
                  Found in lib/cor1440_gen/concerns/models/actividad.rb - About 1 hr to fix

                  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 compara_tabla_poblacion_asistentes_actividad has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def compara_tabla_poblacion_asistentes_actividad(a)
                        d = genera_dicc_poblacion_de_asistentes(a)
                  
                        numdif = 0
                  
                  
                  Severity: Minor
                  Found in app/helpers/cor1440_gen/conteos_helper.rb - About 1 hr to fix

                  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 3 locations. Consider refactoring.
                  Open

                    module Concerns
                      module Models
                        module Informefinanciero
                          extend ActiveSupport::Concern
                  
                  
                  Severity: Major
                  Found in lib/cor1440_gen/concerns/models/informefinanciero.rb and 2 other locations - About 1 hr to fix
                  lib/cor1440_gen/concerns/models/informeauditoria.rb on lines 4..38
                  lib/cor1440_gen/concerns/models/informenarrativo.rb on lines 4..38

                  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 65.

                  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

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    module Concerns
                      module Models
                        module Informenarrativo
                          extend ActiveSupport::Concern
                  
                  
                  Severity: Major
                  Found in lib/cor1440_gen/concerns/models/informenarrativo.rb and 2 other locations - About 1 hr to fix
                  lib/cor1440_gen/concerns/models/informeauditoria.rb on lines 4..38
                  lib/cor1440_gen/concerns/models/informefinanciero.rb on lines 4..38

                  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 65.

                  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

                  Further Reading

                  Method validaciones has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def validaciones(registro)
                              @validaciones_error = ""
                              fus = []
                              if params && params[:proyectofinanciero] && params[:proyectofinanciero][:proyectofinanciero_usuario_attributes]
                                params[:proyectofinanciero][:proyectofinanciero_usuario_attributes].each do |_l, v|

                  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

                                vfid << f.id
                                aw = efecto.respuestafor.where(formulario_id: f.id)
                                if aw.count == 0
                                  rf = Mr519Gen::Respuestafor.create(
                                    formulario_id: f.id,
                  Severity: Major
                  Found in lib/cor1440_gen/concerns/controllers/efectos_controller.rb and 1 other location - About 1 hr to fix
                  lib/cor1440_gen/concerns/controllers/actividades_controller.rb on lines 236..256

                  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 65.

                  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

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    module Concerns
                      module Models
                        module Informeauditoria
                          extend ActiveSupport::Concern
                  
                  
                  Severity: Major
                  Found in lib/cor1440_gen/concerns/models/informeauditoria.rb and 2 other locations - About 1 hr to fix
                  lib/cor1440_gen/concerns/models/informefinanciero.rb on lines 4..38
                  lib/cor1440_gen/concerns/models/informenarrativo.rb on lines 4..38

                  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 65.

                  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

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language