pasosdeJesus/mr519_gen

View on GitHub

Showing 22 of 30 total issues

Method presenta_valor has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

          def presenta_valor(con_nombre_campo = true)
            r = ""
            r = "#{campo.presenta_nombre}: " if con_nombre_campo
            if !campo.tipo ||
                campo.tipo == Mr519Gen::ApplicationHelper::TEXTO ||
Severity: Minor
Found in lib/mr519_gen/concerns/models/valorcampo.rb - About 7 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 presenta_gen_mr519 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

      def presenta_gen_mr519(atr)
        if atr.to_s.include?(".")
          pa = atr.split(".")
          f = Mr519Gen::Formulario
            .where(nombreinterno: pa[0])
Severity: Minor
Found in app/models/mr519_gen/modelo.rb - About 3 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 analiza_respuestas has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def analiza_respuestas(respuestafor_ids, titulo, consolidado, _menserr)
      resps = Mr519Gen::Respuestafor.where(id: respuestafor_ids)
      if resps.count == 0
        menserr = "No hay encuestas respondidas"
        return false
Severity: Major
Found in app/helpers/mr519_gen/application_helper.rb - About 3 hrs to fix

    Function mr519ef_prepara has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function mr519ef_prepara() {
    
      var opciones = {
        float: true,
        auto: false,
    Severity: Major
    Found in app/assets/javascripts/mr519_gen/edita_formulario.js - About 2 hrs to fix

      Method analiza_respuestas has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def analiza_respuestas(respuestafor_ids, titulo, consolidado, _menserr)
            resps = Mr519Gen::Respuestafor.where(id: respuestafor_ids)
            if resps.count == 0
              menserr = "No hay encuestas respondidas"
              return false
      Severity: Minor
      Found in app/helpers/mr519_gen/application_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 presenta_valor has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def presenta_valor(con_nombre_campo = true)
                  r = ""
                  r = "#{campo.presenta_nombre}: " if con_nombre_campo
                  if !campo.tipo ||
                      campo.tipo == Mr519Gen::ApplicationHelper::TEXTO ||
      Severity: Major
      Found in lib/mr519_gen/concerns/models/valorcampo.rb - About 2 hrs to fix

        Method copia has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

                  def copia
                    if !params || !params[:formulario_id]
                      render(inline: "Falta parámetro formulario_id")
                      return
                    end
        Severity: Minor
        Found in lib/mr519_gen/concerns/controllers/formularios_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 resultados has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def resultados
                    authorize!(:manage, Mr519Gen::Encuestapersona)
                    if !params || !params[:formulario_id]
                      render(inline: "Falta parámetro formulario_id")
                      return
        Severity: Minor
        Found in lib/mr519_gen/concerns/controllers/encuestaspersona_controller.rb - About 1 hr to fix

          Method creartodousuario has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def creartodousuario
                      if !params || !params[:encuestausuario_id]
                        render(inline: "Falta parámetro encuestausuario_id")
                        return
                      end
          Severity: Minor
          Found in lib/mr519_gen/concerns/controllers/encuestasusuario_controller.rb - About 1 hr to fix

            Method presenta_gen_mr519 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def presenta_gen_mr519(atr)
                    if atr.to_s.include?(".")
                      pa = atr.split(".")
                      f = Mr519Gen::Formulario
                        .where(nombreinterno: pa[0])
            Severity: Minor
            Found in app/models/mr519_gen/modelo.rb - About 1 hr to fix

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

                        def copia
                          if !params || !params[:formulario_id]
                            render(inline: "Falta parámetro formulario_id")
                            return
                          end
              Severity: Minor
              Found in lib/mr519_gen/concerns/controllers/formularios_controller.rb - About 1 hr to fix

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

                function mr519ef_texto_a_visual() {
                  document.querySelectorAll('[id^=formulario_campo_attributes_][id$=_id]').forEach((i) => {
                    console.log(i)
                    if (i.parentElement.parentElement.parentElement.getAttribute('style') === null  || !i.parentElement.parentElement.parentElement.getAttribute('style').includes('display: none')) {
                      // No agrega a esquema visual los eliminados
                Severity: Minor
                Found in app/assets/javascripts/mr519_gen/edita_formulario.js - About 1 hr to fix

                  Method update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def update
                              params[:encuestapersona][:fechacambio_localizada] =
                                Msip::FormatoFechaHelper.fecha_estandar_local(Date.today)
                              @encuestapersona = @registro =
                                Mr519Gen::Encuestapersona.find(params[:id])
                  Severity: Minor
                  Found in lib/mr519_gen/concerns/controllers/encuestaspersona_controller.rb - About 55 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 fechas_en_orden has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def fechas_en_orden
                              if fechafin && fechainicio && fechafin < fechainicio
                                errors.add(:fechainicio, "La fecha de inicio debe ser " +
                                           " anterior a la de terminación")
                              end
                  Severity: Minor
                  Found in lib/mr519_gen/concerns/models/encuestausuario.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

                                r += op.take.nombre if op.count == 1
                  Severity: Major
                  Found in lib/mr519_gen/concerns/models/valorcampo.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                elsif campo.tipo == Mr519Gen::ApplicationHelper::SMTABLABASICA
                                  if campo.tablabasica.nil?
                                    r += "Problema tablabasica es nil"
                                  else
                                    ab = ::Ability.new
                    Severity: Major
                    Found in lib/mr519_gen/concerns/models/valorcampo.rb - About 45 mins to fix

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

                                def resultados
                                  authorize!(:manage, Mr519Gen::Encuestapersona)
                                  if !params || !params[:formulario_id]
                                    render(inline: "Falta parámetro formulario_id")
                                    return
                      Severity: Minor
                      Found in lib/mr519_gen/concerns/controllers/encuestaspersona_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 presenta_mr519_gen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def presenta_mr519_gen(atr)
                                  case atr.to_s
                                  when "valorcampo"
                                    if respuestafor.nil?
                                      ""
                      Severity: Minor
                      Found in lib/mr519_gen/concerns/models/encuestausuario.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

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

                                def new
                                  if params[:formulario_campo_id]
                                    @opcioncs = Opcioncs.new
                                    @opcioncs.campo_id = params[:formulario_campo_id]
                                    @opcioncs.nombre = "N"
                      Severity: Minor
                      Found in lib/mr519_gen/concerns/controllers/opcionescs_controller.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

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

                                def presenta_mr519_gen(atr)
                                  case atr.to_s
                                  when "valorcampo"
                                    if respuestafor.nil?
                                      ""
                      Severity: Minor
                      Found in lib/mr519_gen/concerns/models/encuestapersona.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