pasosdeJesus/msip

View on GitHub

Showing 272 of 272 total issues

Function enviarAutomaticoFormulario has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  static enviarAutomaticoFormulario(f, metodo = 'GET', tipo = 'script', alertaerror = true, vcommit = 'Enviar', agenviarautom = true) {
    const root = window;
    const t = Date.now();
    let d = -1;
    if (root.msip_enviarautomatico_t) {
Severity: Minor
Found in app/javascript/controllers/motor.js - About 2 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 nomenclatura has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

          def nomenclatura(pais, departamento, municipio,
            centropoblado, vereda, lugar, sitio)
            if pais.to_s.strip == ""
              return ['', '']
            end
Severity: Minor
Found in lib/msip/concerns/models/ubicacionpre.rb - About 2 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 create has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

          def create
            @respaldo7z = Respaldo7z.new(respaldo7z_params)
            respond_to do |format|
              if @respaldo7z.valid?
                Rake::Task["msip:vuelca"].reenable
Severity: Minor
Found in lib/msip/concerns/controllers/respaldo7z_controller.rb - About 2 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

File motor.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open


export default class Msip__Motor {
  /* 
   * Librería de funciones comunes.
   * Aunque no es un controlador lo dejamos dentro del directorio
Severity: Minor
Found in app/javascript/controllers/motor.js - About 2 hrs to fix

    Function msip_ubicacionpre_expandible_registra has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function msip_ubicacionpre_expandible_registra(iniid, campoubi, root, 
      fcamdep = null, fcammun = null) {
      msip_arregla_puntomontaje(root)
    
      // Buscador en campo lugar
    Severity: Major
    Found in app/assets/javascripts/msip/ubicacionpre.js - About 2 hrs to fix

      Method filtrar has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def filtrar(reg, params_filtro)
                  # Control para fecha podría no estar localizado aunque
                  # campos por presentar si
                  latr1 = atributos_index.map do |a|
                    if a.to_s.end_with?("_localizada")
      Severity: Major
      Found in lib/msip/concerns/controllers/modelos_controller.rb - About 2 hrs to fix

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

            document.querySelectorAll('.btn-primary').forEach((element) => {
              element.style.backgroundImage = `linear-gradient(to bottom, ${tema.btn_primario_fondo_ini}, ${tema.btn_primario_fondo_fin})`;
              element.style.color = tema.btn_primario_fuente;
            });
        Severity: Major
        Found in app/javascript/controllers/motor.js and 2 other locations - About 2 hrs to fix
        app/javascript/controllers/motor.js on lines 101..104
        app/javascript/controllers/motor.js on lines 109..112

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

        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

            document.querySelectorAll('.btn').forEach((element) => {
              element.style.backgroundImage = `linear-gradient(to bottom, ${tema.btn_accion_fondo_ini}, ${tema.btn_accion_fondo_fin})`;
              element.style.color = tema.btn_accion_fuente;
            });
        Severity: Major
        Found in app/javascript/controllers/motor.js and 2 other locations - About 2 hrs to fix
        app/javascript/controllers/motor.js on lines 105..108
        app/javascript/controllers/motor.js on lines 109..112

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

        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

            document.querySelectorAll('.btn-danger').forEach((element) => {
              element.style.backgroundImage = `linear-gradient(to bottom, ${tema.btn_peligro_fondo_ini}, ${tema.btn_peligro_fondo_fin})`;
              element.style.color = tema.btn_peligro_fuente;
            });
        Severity: Major
        Found in app/javascript/controllers/motor.js and 2 other locations - About 2 hrs to fix
        app/javascript/controllers/motor.js on lines 101..104
        app/javascript/controllers/motor.js on lines 105..108

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

        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 validar_conjunto_municipios_biyeccion has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def validar_conjunto_municipios_biyeccion(validaciones)
                    if Msip::Municipio.all.count != Msip::Ubicacionpre.
                        where(lugar: nil).where.not(municipio_id: nil).
                        where(centropoblado_id: nil).where(vereda_id: nil).count
                      validaciones << {
        Severity: Major
        Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix

          Method cambiar_convencion_sexo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def cambiar_convencion_sexo(convencion_final)
                unless Msip::Persona::CONVENCIONES_SEXO.keys.include?(convencion_final)
                  Rails.logger.debug { "Conveción desconocida: #{convecion_final}" }
                  exit(1)
                end
          Severity: Major
          Found in app/helpers/msip/sql_helper.rb - About 2 hrs to fix

            File formato_fecha_helper.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Msip
              module FormatoFechaHelper
                MESES = [
                  "",
                  "Enero",
            Severity: Minor
            Found in app/helpers/msip/formato_fecha_helper.rb - About 2 hrs to fix

              Method create_gen has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        def create_gen(registro = nil)
                          c2 = clase.demodulize.underscore
                          if registro
                            @registro = registro
                          else
              Severity: Major
              Found in lib/msip/concerns/controllers/modelos_controller.rb - About 2 hrs to fix

                Method fecha_ddMyyyy has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def fecha_ddMyyyy(*fields)
                        fields.each do |f|
                          define_method("#{f}_ddMyyyy") do
                            val = read_attribute(f)
                            unless val
                Severity: Major
                Found in lib/ext/ActiveRecord/base.rb - About 2 hrs to fix

                  File modelo.rb has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Msip
                    module Modelo
                      extend ActiveSupport::Concern
                      include Msip::Localizacion
                  
                  
                  Severity: Minor
                  Found in app/models/msip/modelo.rb - About 2 hrs to fix

                    Method opciones_tabla_basica has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def opciones_tabla_basica(clase, f, campo)
                          col1 = clase.all
                          if col1.respond_to?(:habilitados)
                            col1 = col1.habilitados
                          end
                    Severity: Minor
                    Found in app/helpers/msip/modelo_helper.rb - About 2 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 item_acordeon_bs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def item_acordeon_bs(
                          acid, idit, titulo, expandido = false, opciones_ps = {}, &bloque
                        )
                          opciones = opciones_ps.stringify_keys
                          content_tag(
                    Severity: Major
                    Found in app/helpers/msip/bootstrap_helper.rb - About 2 hrs to fix

                      Method validar_conjunto_departamentos_biyeccion has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def validar_conjunto_departamentos_biyeccion(validaciones)
                                  if Msip::Departamento.all.count != Msip::Ubicacionpre.
                                      where(lugar: nil).where.not(departamento_id: nil).
                                      where(municipio_id: nil).count
                                    validaciones << {
                      Severity: Major
                      Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix

                        Method validar_conjunto_veredas_biyeccion has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                  def validar_conjunto_veredas_biyeccion(validaciones)
                                    if Msip::Vereda.all.count != Msip::Ubicacionpre.
                                        where(lugar: nil).where.not(vereda_id: nil).
                                        where(centropoblado_id: nil).count
                                      validaciones << {
                        Severity: Major
                        Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix

                          Method validar_conjunto_centrospoblados_biyeccion has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    def validar_conjunto_centrospoblados_biyeccion(validaciones)
                                      if Msip::Centropoblado.all.count != Msip::Ubicacionpre.
                                          where(lugar: nil).where.not(centropoblado_id: nil).
                                          where(vereda_id: nil).count
                                        validaciones << {
                          Severity: Major
                          Found in lib/msip/concerns/controllers/ubicacionespre_controller.rb - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language