pasosdeJesus/cor1440_gen

View on GitHub

Showing 234 of 234 total issues

Avoid too many return statements within this method.
Open

                  return
Severity: Major
Found in lib/cor1440_gen/concerns/controllers/proyectosfinancieros_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                        return
    Severity: Major
    Found in lib/cor1440_gen/concerns/controllers/proyectosfinancieros_controller.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return
      Severity: Major
      Found in lib/cor1440_gen/concerns/controllers/proyectosfinancieros_controller.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return
        Severity: Major
        Found in lib/cor1440_gen/concerns/controllers/proyectosfinancieros_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                            return
          Severity: Major
          Found in lib/cor1440_gen/concerns/controllers/proyectosfinancieros_controller.rb - About 30 mins to fix

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

                        if er.count > 0
                          rb = er.map(&:respuestafor_id)
                          Cor1440Gen::EfectoRespuestafor.connection
                            .execute("DELETE FROM cor1440_gen_efecto_respuestafor
                                    WHERE efecto_id=#{efecto.id}
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/efectos_controller.rb and 1 other location - About 30 mins to fix
            lib/cor1440_gen/concerns/controllers/actividades_controller.rb on lines 302..308

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

            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 ar.count > 0
                          rb = ar.map(&:respuestafor_id)
                          Cor1440Gen::ActividadRespuestafor.connection
                            .execute("DELETE FROM cor1440_gen_actividad_respuestafor
                                    WHERE actividad_id=#{actividad.id}
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb and 1 other location - About 30 mins to fix
            lib/cor1440_gen/concerns/controllers/efectos_controller.rb on lines 105..111

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

            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 tm != dm
                      STDERR.puts "** Diferencia en actividad #{a.id}, "\
                        "rango de edad #{re.id}, sexo #{convM}. "\
                        "Tabla dice #{tm} y cuenta de asistentes da #{dm}."
                      numdif += 1
            Severity: Minor
            Found in app/helpers/cor1440_gen/conteos_helper.rb and 1 other location - About 25 mins to fix
            app/helpers/cor1440_gen/conteos_helper.rb on lines 91..96

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

            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 tf != df
                      STDERR.puts "** Diferencia en actividad #{a.id}, "\
                        "rango de edad #{re.id}, sexo #{convF}. "\
                        "Tabla dice #{tf} y cuenta de asistentes da #{df}."
                      numdif += 1
            Severity: Minor
            Found in app/helpers/cor1440_gen/conteos_helper.rb and 1 other location - About 25 mins to fix
            app/helpers/cor1440_gen/conteos_helper.rb on lines 97..102

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

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

                      def editar_intermedio(registro, usuario_actual_id)
                        if params["proyectofinanciero_ids"]
                          registro.proyectofinanciero_ids = if params["proyectofinanciero_ids"] == ["-1"] # Convención vacio
                            # Si la llamada AJAC se hace con [] ese parametro no llega
                            []
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/personas_controller.rb - About 25 mins 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 semestreformulacion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                      def semestreformulacion
                        if fechaformulacion
                          if fechaformulacion.month <= 6
                            "1"
                          else
            Severity: Minor
            Found in lib/cor1440_gen/concerns/models/proyectofinanciero.rb - About 25 mins 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 presenta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                      def presenta(atr)
                        case atr
                        when "indicadorpf_id"
                          if indicadorpf_id
                            indicadorpf.numero
            Severity: Minor
            Found in lib/cor1440_gen/concerns/models/efecto.rb - About 25 mins 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 initialize_cor1440_gen has a Cognitive Complexity of 6 (exceeds 5 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: Minor
            Found in app/models/cor1440_gen/ability.rb - About 25 mins 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 medir_indicador_res_tipo_4 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                      def medir_indicador_res_tipo_4(idacs, mind, fini, ffin)
                        datosint = []
                        mujeres = asistencia_por_sexo(
                          idacs, Msip::Persona::convecion_sexo[:sexo_femenino], true)
                        hombres = asistencia_por_sexo(
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb - About 25 mins 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 medir_indicador_res_tipo_3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                      def medir_indicador_res_tipo_3(idacs, mind, fini, ffin)
                        datosint = []
                        mujeres = asistencia_por_sexo(
                          idacs, Msip::Persona::convecion_sexo[:sexo_femenino], false)
                        hombres = asistencia_por_sexo(
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/mindicadorespf_controller.rb - About 25 mins 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 disponibles_cor1440_gen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                      def disponibles_cor1440_gen(filtro, ability, c = nil)
                        c2 = c ? c : Cor1440Gen::Actividadpf.accessible_by(ability)
                        if filtro[:proyectofinanciero_ids] &&
                            filtro[:proyectofinanciero_ids].count > 0
                          pf_ids = filtro[:proyectofinanciero_ids].map(&:to_i)
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/actividadespf_controller.rb - About 25 mins 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

                        ar = if vfid.count > 0
                          Cor1440Gen::ActividadRespuestafor
                            .where(actividad_id: actividad.id)
                            .joins(:respuestafor)
                            .where("formulario_id NOT IN (#{vfid.join(", ")})")
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/actividades_controller.rb and 1 other location - About 25 mins to fix
            lib/cor1440_gen/concerns/controllers/efectos_controller.rb on lines 96..103

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

            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

                        er = if vfid.count > 0
                          Cor1440Gen::EfectoRespuestafor
                            .where(efecto_id: efecto.id)
                            .joins(:respuestafor)
                            .where("formulario_id NOT IN (#{vfid.join(", ")})")
            Severity: Minor
            Found in lib/cor1440_gen/concerns/controllers/efectos_controller.rb and 1 other location - About 25 mins to fix
            lib/cor1440_gen/concerns/controllers/actividades_controller.rb on lines 293..300

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

            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 ActividadRespuestafor
                    extend ActiveSupport::Concern
            
            
            Severity: Minor
            Found in lib/cor1440_gen/concerns/models/actividad_respuestafor.rb and 2 other locations - About 20 mins to fix
            lib/cor1440_gen/concerns/models/actividadtipo_formulario.rb on lines 4..19
            lib/cor1440_gen/concerns/models/formulario_tipoindicador.rb on lines 4..19

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

            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 FormularioTipoindicador
                    extend ActiveSupport::Concern
            
            
            Severity: Minor
            Found in lib/cor1440_gen/concerns/models/formulario_tipoindicador.rb and 2 other locations - About 20 mins to fix
            lib/cor1440_gen/concerns/models/actividad_respuestafor.rb on lines 4..19
            lib/cor1440_gen/concerns/models/actividadtipo_formulario.rb on lines 4..19

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

            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