pasosdeJesus/sivel2_gen

View on GitHub

Showing 228 of 380 total issues

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

                    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

                      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

                        Avoid deeply nested control flow statements.
                        Open

                                              if victima_params[:id] != ""
                                                vic = Sivel2Gen::Victima.find(victima_params[:id].to_i)
                                              else
                                                victima_params_filtrado = victima_params.deep_dup.tap do |params|
                                                  params[:persona_attributes].delete(:persona_trelacion1_attributes)
                        Severity: Major
                        Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 45 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
                                    cr = crt
                                    cv = cvt
                                    ca = cat
                                  end
                          Severity: Major
                          Found in app/helpers/sivel2_gen/vista_helper.rb - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    if cr >= 0 && cr <= 255 && cv >= 0 && cv <= 255 && ca <= 0 && ca <= 255
                                      cr = crt
                                      cv = cvt
                                      ca = cat
                                    end
                            Severity: Major
                            Found in app/helpers/sivel2_gen/vista_helper.rb - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if mesnac > mes || (dianac && dianac > 0 && dia && dia > 0 && 
                                          dianac > dia)
                                        na -= 1
                                      end
                              Severity: Major
                              Found in app/helpers/sivel2_gen/rangoedad_helper.rb - About 40 mins to fix

                                Method importa has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                          def importa(datosent, datossal, formato_sexo,
                                                      menserror, opciones = {})
                                Severity: Minor
                                Found in lib/sivel2_gen/concerns/models/caso.rb - About 35 mins to fix

                                  Method importa has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                            def importa(datosent, datossal, formato_sexo, menserror, opciones = {})
                                  Severity: Minor
                                  Found in lib/sivel2_gen/concerns/models/victima.rb - About 35 mins to fix

                                    Method presenta_arbol_presp_ul_li has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def presenta_arbol_presp_ul_li(nivel, arbol, opciones={})
                                          subarbol = ''
                                          if arbol && arbol[:hijos] && arbol[:hijos].count > 0
                                            subarbol = "<ul>\n".html_safe + arbol[:hijos].map{|h| 
                                              "<li>".html_safe + 
                                    Severity: Minor
                                    Found in app/helpers/sivel2_gen/vista_helper.rb - About 35 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language