pasosdeJesus/msip

View on GitHub

Showing 272 of 272 total issues

Method barra_navegacion has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def barra_navegacion(opciones, &bloque)
      r = content_tag(
        :nav,
        class: "navbar navbar-expand-lg navbar-light bg-light",
      ) do
Severity: Minor
Found in app/helpers/msip/bootstrap_helper.rb - About 1 hr to fix

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

        if (typeof el.tomselect == 'undefined' && 
          (el.tagName == "INPUT" || el.tagName == "SELECT") &&
          window.TomSelect) {
          new window.TomSelect(el, window.configuracionTomSelect)
        }
    Severity: Major
    Found in app/javascript/controllers/motor.js and 1 other location - About 1 hr to fix
    app/javascript/controllers/motor.js on lines 164..168

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

    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 (typeof el.tomselect == 'undefined' &&
          (el.tagName == "INPUT" || el.tagName == "SELECT") &&
          window.TomSelect) {
          new window.TomSelect(el, window.configuracionTomSelect)
        }
    Severity: Major
    Found in app/javascript/controllers/motor.js and 1 other location - About 1 hr to fix
    app/javascript/controllers/motor.js on lines 43..47

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

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

              def presenta_msip(atr)
                case atr.to_s
                when "{:orgsocial_persona=>[]}"
                  if orgsocial_persona
                    orgsocial_persona.inject("") do |memo, s|
    Severity: Minor
    Found in lib/msip/concerns/models/orgsocial.rb - About 1 hr to fix

      Method index_msip has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def index_msip(c = nil)
                  if c.nil?
                    c = Msip::Persona.all
                  end
                  if params[:term]
      Severity: Minor
      Found in lib/msip/concerns/controllers/personas_controller.rb - About 1 hr to fix

        Method poner_nombre_estandar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                  def poner_nombre_estandar
                    self.nombre, self.nombre_sin_pais = Msip::Ubicacionpre.nomenclatura(
                      pais.nombre,
                      departamento ? departamento.nombre : "",
                      municipio ? municipio.nombre : "",
        Severity: Minor
        Found in lib/msip/concerns/models/ubicacionpre.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 formato_ubicacion_partes has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def formato_ubicacion_partes(pais_id, departamento_id, municipio_id,
              centropoblado_id, con_centropoblado, con_pais)
              r = ""
              if pais_id.nil? || Msip::Pais.where(id: pais_id).count != 1
                return r
        Severity: Minor
        Found in app/helpers/msip/ubicacion_helper.rb - About 1 hr to fix

          Function msip_ubicacionpre_expandible_busca_lugar has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function msip_ubicacionpre_expandible_busca_lugar(s, ubi) {
            root = window
            msip_arregla_puntomontaje(root)
            cnom = s.attr('id')
            v = $("#" + cnom).data('autocompleta')
          Severity: Minor
          Found in app/assets/javascripts/msip/ubicacionpre.js - About 1 hr to fix

            Method importa_gen has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def importa_gen(datosent, datossal, menserror, opciones = {})
                    datosent.keys.each do |ll|
                      case ll.to_sym
                      when :actualizado_en
                        self.updated_at = datosent[ll.to_sym]
            Severity: Minor
            Found in app/models/msip/modelo.rb - About 1 hr to fix

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

                  document.querySelectorAll('.alert-success').forEach((element) => {
                    element.style.color = tema.alerta_exito_fuente;
                    element.style.backgroundColor = tema.alerta_exito_fondo;
                  });
              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 97..100
              app/javascript/controllers/motor.js on lines 117..120

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

              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('.alert-danger').forEach((element) => {
                    element.style.color = tema.alerta_problema_fuente;
                    element.style.backgroundColor = tema.alerta_problema_fondo;
                  });
              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 93..96
              app/javascript/controllers/motor.js on lines 117..120

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

              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('.msip-sf-bs-input:not(.form-check-input)').forEach((element) => {
                    element.style.backgroundColor = tema.fondo;
                    element.style.color = tema.color_fuente;
                  });
              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 93..96
              app/javascript/controllers/motor.js on lines 97..100

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

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

                    def campofecha_mesanio(*fields)
                      fields.each do |f|
                        define_method("#{f}_anio") do
                          val = self[f]
                          val&.year ? val.year : nil
              Severity: Minor
              Found in app/models/msip/localizacion.rb - About 1 hr to fix

                Method index has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def index
                            if !params[:term]
                              respond_to do |format|
                                format.html { render(inline: "Falta variable term") }
                                format.json { render(inline: "Falta variable term") }
                Severity: Minor
                Found in lib/msip/concerns/controllers/gruposper_controller.rb - About 1 hr to fix

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

                    module Concerns
                      module Controllers
                        module TrivalentesController
                          extend ActiveSupport::Concern
                  
                  
                  Severity: Major
                  Found in lib/msip/concerns/controllers/trivalentes_controller.rb and 1 other location - About 1 hr to fix
                  lib/msip/concerns/controllers/sectoresorgsocial_controller.rb on lines 4..39

                  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 2 locations. Consider refactoring.
                  Open

                    module Concerns
                      module Controllers
                        module SectoresorgsocialController
                          extend ActiveSupport::Concern
                  
                  
                  lib/msip/concerns/controllers/trivalentes_controller.rb on lines 4..39

                  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

                  Method opciones_tabla_basica has 33 lines of code (exceeds 25 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 1 hr to fix

                    Method genera_asociacion has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def genera_asociacion
                          puts "Para asociarla en #{options.asocia}:"
                          puts <<~EOF
                            Cree migracion que incluya
                              add_column :#{options.asocia}, :#{nom_arch}_id, :integer
                    Severity: Minor
                    Found in lib/generators/msip/tablabasica_generator.rb - About 1 hr to fix

                      Method tema_usuario has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def tema_usuario(current_usuario)
                            t = if !current_usuario || !current_usuario.tema_id
                              if Msip::Tema.where(id: 1).count == 1
                                Msip::Tema.find(1)
                              else
                      Severity: Minor
                      Found in app/helpers/msip/temas_helper.rb - About 1 hr to fix

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

                                  def msip_presenta(atr)
                                    case atr.to_s
                                    when "centro_poblado"
                                      centropoblado ? centropoblado.nombre : ""
                                    when "nacionalde"
                        Severity: Minor
                        Found in lib/msip/concerns/models/persona.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