pasosdeJesus/sivel2_gen

View on GitHub

Showing 380 of 380 total issues

Method personas_procesa_filtros_sivel2_gen has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

          def personas_procesa_filtros_sivel2_gen(que1, tablas1, where1, que3, 
                                                  tablas3, where3)
Severity: Minor
Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 45 mins to fix

    Method personas_consulta_final has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              def personas_consulta_final(i, que3, tablas3, where3, qc, gb)
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if usuario.observadorffechafin
                      ffin = usuario.observadorffechafin
                    end
      Severity: Major
      Found in app/models/sivel2_gen/ability.rb - About 45 mins to fix

        Method embeber_mapacalordepcol_svg has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def embeber_mapacalordepcol_svg(titulo, subtitulo, titulorangos, fuente,
                                            cantidadesdep, opciones = {})
        Severity: Minor
        Found in app/helpers/sivel2_gen/vista_helper.rb - About 45 mins to fix

          Method personas_procesa_filtros has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                    def personas_procesa_filtros(que1, tablas1, where1, que3, 
                                                 tablas3, where3)
          Severity: Minor
          Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 45 mins to fix

            Method personas_segun_tipico has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                      def personas_segun_tipico(tabla, nomtabla, que1, que3, tablas3, where3)
            Severity: Minor
            Found in lib/sivel2_gen/concerns/controllers/conteos_controller.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if usuario.filtrodepartamento_ids.count > 0
                              dicc_filtro[:ubicacion]={ 
                                departamento_id: usuario.filtrodepartamento_ids
                              }
                            end
              Severity: Major
              Found in app/models/sivel2_gen/ability.rb - About 45 mins to fix

                Method edad_de_fechanac_fecha has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def edad_de_fechanac_fecha(anionac, mesnac, dianac, 
                                                  anio, mes, dia)
                Severity: Minor
                Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 45 mins to fix

                  Method desagregarpor_tipico has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                            def desagregarpor_tipico(tabla, nomtabla, que1, que3, tablas3, where3)
                  Severity: Minor
                  Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 45 mins to fix

                    Method procesa_filtros_fechas has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def procesa_filtros_fechas(where1)
                                if (params[:filtro] && params[:filtro]['fechaini'] && 
                                    params[:filtro]['fechaini'] != "") 
                                  @pFechaini = fecha_local_estandar(params[:filtro]['fechaini'])
                                else
                    Severity: Minor
                    Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 45 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 procesa_filtros has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                              def procesa_filtros(que1, tablas1, where1, que3, 
                                                  tablas3, where3)
                    Severity: Minor
                    Found in lib/sivel2_gen/concerns/controllers/graficar_conteo_controller.rb - About 45 mins to fix

                      Method validacion_estandar has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                def validacion_estandar(casos, titulo, where, 
                                                        atr = [:id, :fecha, :nusuario],
                                                        encabezado = [
                                                          'Código', 'Fecha del Hecho', 'Usuario'],
                                                       ordenapor = 'fecha')
                      Severity: Minor
                      Found in lib/sivel2_gen/concerns/controllers/validarcasos_controller.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                              if pt.count > 0
                                                params[:caso][:victima_attributes][victima_indice][:persona_attributes][:persona_trelacion1_attributes][persona_indice][:id] = pt[0].id
                                              else
                                                ptn = Msip::PersonaTrelacion.create(
                                                  persona1: vic.persona.id , persona2: p2_id
                        Severity: Major
                        Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if victima_params[:persona_attributes][:id] != ""
                                                    vics = Sivel2Gen::Victima.where(
                                                      persona_id: victima_params[:persona_attributes][:id])
                                                    if vics.count > 0
                                                      vic = vics[0]
                          Severity: Major
                          Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

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

                              cierraCapaDiv(){
                                if (this.constructor.agregaCapaDiv != undefined) {
                                  this.constructor.agregaCapaDiv.remove(this.constructor.mapa);
                                }
                              };
                            Severity: Minor
                            Found in app/javascript/controllers/mapaosm_controller.js and 1 other location - About 45 mins to fix
                            app/javascript/controllers/mapaosm_controller.js on lines 400..404

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

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

                                      def lista
                                        if params[:tabla]
                                          r = nil
                                          if (params[:tabla] == "departamento" && params[:pais_id].to_i > 0)
                                            r = Msip::Departamento.where(fechadeshabilitacion: nil,
                            Severity: Minor
                            Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 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

                            Avoid deeply nested control flow statements.
                            Open

                                                  if victima_params[:id] == ""
                                                    if victima_creada == false
                                                      vic = Sivel2Gen::Victima.create(victima_params)
                                                      victima_creada = true
                                                    end
                            Severity: Major
                            Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

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

                                cerrarinfo(){
                                  if (this.constructor.info != undefined) {
                                    this.constructor.info.remove(this.constructor.mapa);
                                  }
                                }
                              Severity: Minor
                              Found in app/javascript/controllers/mapaosm_controller.js and 1 other location - About 45 mins to fix
                              app/javascript/controllers/mapaosm_controller.js on lines 476..480

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

                              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 assets
                                      cont = assets.find_asset('svg/plant_mapa_calor.svg').source.force_encoding("UTF-8")
                                    else
                                      rutas = Gem::Specification.stubs.map(&:full_gem_path)
                                      rs = rutas.select {|x| x.include?('sivel2_gen')}.first
                              Severity: Minor
                              Found in app/helpers/sivel2_gen/vista_helper.rb and 1 other location - About 45 mins to fix
                              app/helpers/sivel2_gen/vista_helper.rb on lines 90..97

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

                              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 ajusta_titulos has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                        def ajusta_titulos(pFini, pFfin, pTviolencia, pEtiqueta1,
                                                           pEtiqueta2, pColormax)
                              Severity: Minor
                              Found in lib/sivel2_gen/concerns/controllers/mapadep_controller.rb - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language