pasosdeJesus/cor1440_gen

View on GitHub

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,
Severity: Minor
Found in lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb - About 4 hrs 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 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 = []
Severity: Major
Found in app/helpers/cor1440_gen/medicion_helper.rb - About 4 hrs to fix

    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
    Severity: Major
    Found in app/models/cor1440_gen/ability.rb - About 4 hrs to fix

      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
      
      
      Severity: Minor
      Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 4 hrs 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

                  if mind.funcionresultado.to_s != "" # Medir con esp de medicionindicadorpf
                    contexto = {
                      "Actividades_contribuyentes" =>
                      Cor1440Gen::Actividad.where(id: idacs),
                    }
      lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb on lines 411..458

      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

      Further Reading

      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),
      lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb on lines 343..385

      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

      Further Reading

      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
        
        
        Severity: Minor
        Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 3 hrs 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 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 &&
        Severity: Major
        Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 3 hrs to fix

          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]
          Severity: Minor
          Found in lib/cor1440_gen/concerns/controllers/actividadespf_controller.rb - About 3 hrs 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 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
          
          
          Severity: Major
          Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 3 hrs to fix

            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
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 3 hrs 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

              module Concerns
                module Controllers
                  module ObjetivospfController
                    extend ActiveSupport::Concern
            
            
            lib/cor1440_gen/concerns/controllers/resultadospf_controller.rb on lines 4..50

            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

            Further Reading

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

              module Concerns
                module Controllers
                  module ResultadospfController
                    extend ActiveSupport::Concern
            
            
            lib/cor1440_gen/concerns/controllers/objetivospf_controller.rb on lines 4..50

            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

            Further Reading

            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(
            Severity: Major
            Found in app/helpers/cor1440_gen/conteos_helper.rb - About 3 hrs to fix

              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
              Severity: Major
              Found in lib/cor1440_gen/concerns/models/persona.rb - About 3 hrs to fix

                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
                Severity: Minor
                Found in app/helpers/cor1440_gen/medicion_helper.rb - About 3 hrs to fix

                  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
                  Severity: Major
                  Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb - About 3 hrs to fix

                    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,
                    Severity: Major
                    Found in lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb - About 2 hrs to fix

                      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
                      Severity: Minor
                      Found in app/models/cor1440_gen/ability.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language