pasosdeJesus/sivel2_gen

View on GitHub

Showing 410 of 410 total issues

Method mapaosm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

          def mapaosm
            if !Rails.configuration.x.sivel2_consulta_web_publica
              authorize! :index, Sivel2Gen::Caso
            end

Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/casos_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 refresca_conscaso has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def refresca_conscaso
            if ARGV.include?("db:migrate")
              return 'Ejecutando migración'
            end
            if !ActiveRecord::Base.connection.data_source_exists? 'sivel2_gen_conscaso'
Severity: Minor
Found in lib/sivel2_gen/concerns/models/conscaso.rb - About 1 hr to fix

    Function ejecutarAlCargarDocumentoYRecursos has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static ejecutarAlCargarDocumentoYRecursos() {
        console.log("* Corriendo Sivel2Gen__Motor::ejecutarAlCargarDocumentoYRecursos()")
    
        if (typeof window.puntoMontaje == 'undefined') {
          window.puntoMontaje = '/'
    Severity: Minor
    Found in app/javascript/controllers/motor.js - About 1 hr to fix

      Function procesar_datos has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        procesar_datos(filas, variable) {
          var dicEtiquetas = {}
          filas.forEach(function(r) {
            dicEtiquetas[r[variable]] = 0
            if (typeof datosr[r.fecha] == 'undefined') {
      Severity: Minor
      Found in app/javascript/controllers/plotly_actos_controller.js - About 1 hr to fix

        Method atributos_show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def atributos_show
                    [
                      # basicos
                      :id,
                      :fecha,
        Severity: Minor
        Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

          Method sivel2_gen_victima_presenta has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def sivel2_gen_victima_presenta(atr)
                      case atr.to_s
                      when 'fecha_caso'
                        self.caso ? self.caso.fecha : ''
                      when 'nombre'
          Severity: Minor
          Found in lib/sivel2_gen/concerns/models/victima.rb - About 1 hr to fix

            Method remplazarfamiliar has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      def remplazarfamiliar
                        @caso = Sivel2Gen::Caso.find(params[:caso_id])
                        @caso.current_usuario = current_usuario
                        @personados = Msip::Persona.find(params[:persona_id].to_i)
                        @vic_position = params[:vic_position].to_i
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/personas_controller.rb - About 1 hr to fix

              Method personas_procesa_filtros_sivel2_gen has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def personas_procesa_filtros_sivel2_gen(que1, tablas1, where1, que3, 
                                                                tablas3, where3)
                          @filtrosegun.each do |e, r|
                            if (params[:filtro] && params[:filtro][r[:nomfiltro]] && 
                                params[:filtro][r[:nomfiltro]] != '') 
              Severity: Minor
              Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

                Method nomrango has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def self.nomrango(fechaini, fechafin)
                            if !fechaini
                              return "Sin fechaini"
                            end
                            if !fechafin
                Severity: Minor
                Found in lib/sivel2_gen/concerns/controllers/mapadep_controller.rb - About 1 hr to fix

                  Method pestanas_formulariocaso has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            def pestanas_formulariocaso
                              #byebug
                              if current_usuario && can?(:solocambiaretiquetas, Sivel2Gen::Caso)
                                [
                                  { titulo: 'Etiquetas', parcial: 'etiquetas'},
                  Severity: Minor
                  Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

                    Method remplazar has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def remplazar
                                @grupoper = Msip::Grupoper.find(params[:grupoper_id].to_i)
                                @caso = Sivel2Gen::Caso.find(params[:caso_id].to_i)
                                @vicol_posicion = params[:vicol_posicion].to_i
                                @caso.current_usuario = current_usuario
                    Severity: Minor
                    Found in lib/sivel2_gen/concerns/controllers/gruposper_controller.rb - About 1 hr to fix

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

                                if(elem.type != "hidden" && elem.type != 'submit' &&
                                  !elem.id.includes('personados') && !elem.classList.contains('chosen-search-input')){
                                  elem.value = valores_input[indice_tipo_input]
                                  elem.dispatchEvent(new Event('input'));
                                  indice_tipo_input += 1;
                      Severity: Major
                      Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                      app/javascript/controllers/motor.js on lines 286..289
                      app/javascript/controllers/motor.js on lines 292..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 58.

                      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

                            if(elem.type != "hidden" && elem.type != 'submit' && 
                              !elem.id.includes('personados') && !elem.classList.contains('chosen-search-input')){
                              valores_input.push(elem.value)
                            }
                      Severity: Major
                      Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                      app/javascript/controllers/motor.js on lines 292..308
                      app/javascript/controllers/motor.js on lines 321..326

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

                      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

                            if(elem.type != "hidden" && elem.type != 'submit' && 
                              !elem.id.includes('personados') && !elem.id.includes('persona_trelacion1')){
                              console.log([elem.value, elem.type, elem.id])
                              if(elem.multiple){
                                let opciones = elem.options
                      Severity: Major
                      Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                      app/javascript/controllers/motor.js on lines 286..289
                      app/javascript/controllers/motor.js on lines 321..326

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

                      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

                      Function connect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        connect() {
                          document.getElementById("capa-cargando").style.display = 'none';
                          console.log("Conexion de controlador enviar ficha caso establecida")
                          const pestanias = document.querySelectorAll('.fichacambia');
                          pestanias.forEach(function(pestania) {
                      Severity: Minor
                      Found in app/javascript/controllers/enviar_ficha_caso_controller.js - About 1 hr to fix

                        Function actualizarGruposper has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function actualizarGruposper(s) {
                              var sel = s.value;
                              var cadena = '';
                              var campo = document.querySelectorAll('#victimascolectivas .control-group[style!="display: none;"]');
                              campo.each(function(k, v) {
                        Severity: Minor
                        Found in app/javascript/controllers/enviar_ficha_caso_controller.js - About 1 hr to fix

                          Method importa has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    def importa(datosent, datossal, menserror, opciones = {})
                                      ## Verifica que sí es un presunto responsable
                                      pres = Sivel2Gen::Presponsable.
                                        where('upper(nombre COLLATE es_co_utf_8)=upper(? COLLATE es_co_utf_8)', datosent['nombre_grupo'])
                                      unless pres.empty?
                          Severity: Minor
                          Found in lib/sivel2_gen/concerns/models/caso_presponsable.rb - About 1 hr to fix

                            Method sivel2_gen_destroy has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                      def sivel2_gen_destroy
                                        tcaso_id=@caso.id
                                        if @caso.id
                                          CasoUsuario.where(caso_id: @caso.id).destroy_all
                                        end
                            Severity: Minor
                            Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 1 hr to fix

                              Method genvic_tabla has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                        def genvic_tabla(titulo, filas, tittotales, where1)
                                          cuerpo = []
                                          tot = 0;
                                          filas.each do |f|
                                            s = 0;
                              Severity: Minor
                              Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 1 hr to fix

                                Method fuenteprensa_fecha_y_fuente_unicas has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                          def fuenteprensa_fecha_y_fuente_unicas
                                            fuentesprensa = self.caso_fuenteprensa
                                            valfp = []
                                            fuentesprensa.each do |fp|
                                              if fp && fp.fuenteprensa && 
                                Severity: Minor
                                Found in lib/sivel2_gen/concerns/models/caso.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

                                Severity
                                Category
                                Status
                                Source
                                Language