pasosdeJesus/msip

View on GitHub

Showing 272 of 272 total issues

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

      element.addEventListener('mouseout', () => {
        element.style.color = tema.nav_fuente;
        element.style.backgroundColor = tema.nav_fin;
      });
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 83..86

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

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

Function cambiar_pais has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  cambiar_pais(e) {
    var purl = Msip__Motor.arreglarPuntoMontaje()

    console.log("departamento ahora es", this.departamentoTarget.value)
    let url = purl + '/admin/departamentos.json?pais_id=' + e.target.value
Severity: Minor
Found in app/javascript/controllers/geodep_controller.js - 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 modelos_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def modelos_path(o, posfijo_path = true)
      if o.nil?
        return "#"
      end

Severity: Minor
Found in app/helpers/msip/modelo_helper.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 index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def index(c = nil)
            if c.nil?
              c = Msip::Orgsocial.all
            end
            if params[:term]
Severity: Minor
Found in lib/msip/concerns/controllers/orgsociales_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 separa_apellidos_nombres has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def separa_apellidos_nombres(nombre, menserror)
      apellidos = "N"
      nombres = "N"
      n = nombre.to_s.gsub(/  */, " ").gsub(/^ /, "").gsub(/ $/, "")
      p = n.split(" ")
Severity: Minor
Found in app/helpers/msip/importa_helper.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def update
            if params && params[:orgsocial] &&
                params[:orgsocial][:orgsocial_persona_attributes]
              op_params = params[:orgsocial][:orgsocial_persona_attributes]
              op_params.each do |_clave, valor|
Severity: Minor
Found in lib/msip/concerns/controllers/orgsociales_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 formato_ubicacion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def formato_ubicacion(u, con_centropoblado = true, con_pais = true)
      if u.nil?
        return ""
      end

Severity: Minor
Found in app/helpers/msip/ubicacion_helper.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 par_departamento_municipio has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def par_departamento_municipio
            if (centropoblado_id || vereda_id || municipio_id) && 
                !departamento_id
                errors.add(
                  :departamento_id, "Falta departamento"
Severity: Minor
Found in lib/msip/concerns/models/ubicacionpre.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 par_municipio_centropoblado has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def par_municipio_centropoblado
            if (centropoblado_id || vereda_id ) && !municipio_id
                errors.add(
                  :municipio_id, "Falta municipio"
                )
Severity: Minor
Found in lib/msip/concerns/models/ubicacionpre.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 fecha_estandar_local has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def fecha_estandar_local(f)
      if !f || (f.class != String && f.class != Date &&
          f.class != ActiveSupport::TimeWithZone) ||
          (f.class == String && f == "")
        return nil
Severity: Minor
Found in app/helpers/msip/formato_fecha_helper.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 presenta_fechanac has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def presenta_fechanac
            r = ""
            r += dianac.to_s if dianac
            r += "/"
            r += FormatoFechaHelper::ABMESES[mesnac] if mesnac &&
Severity: Minor
Found in lib/msip/concerns/models/persona.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

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

                if params_filtro["bus#{i}ini"] &&
                    params_filtro["bus#{i}ini"] != "" &&
                    reg.respond_to?("filtro_#{i}ini")
                  reg = reg.send(
                    "filtro_#{i}ini",
Severity: Minor
Found in lib/msip/concerns/controllers/modelos_controller.rb and 1 other location - About 55 mins to fix
lib/msip/concerns/controllers/modelos_controller.rb on lines 80..88

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

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

          def edit_gen
            @registro = clase.constantize.find(params[:id])
            if @registro.respond_to?("current_usuario=")
              @registro.current_usuario = current_usuario
            end
Severity: Minor
Found in lib/msip/concerns/controllers/modelos_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

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

                if params_filtro["bus#{i}fin"] &&
                    params_filtro["bus#{i}fin"] != "" &&
                    reg.respond_to?("filtro_#{i}fin")
                  reg = reg.send(
                    "filtro_#{i}fin",
Severity: Minor
Found in lib/msip/concerns/controllers/modelos_controller.rb and 1 other location - About 55 mins to fix
lib/msip/concerns/controllers/modelos_controller.rb on lines 71..79

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

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

          def index(c = nil)
            if c.nil?
              c = Msip::Ubicacionpre.all
            end
            if params[:term]
Severity: Minor
Found in lib/msip/concerns/controllers/ubicacionespre_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

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

  module Concerns
    module Controllers
      module TiposorgController
        extend ActiveSupport::Concern

Severity: Minor
Found in lib/msip/concerns/controllers/tiposorg_controller.rb and 1 other location - About 55 mins to fix
lib/msip/concerns/controllers/estadossol_controller.rb on lines 4..35

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

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 EstadossolController
        extend ActiveSupport::Concern

Severity: Minor
Found in lib/msip/concerns/controllers/estadossol_controller.rb and 1 other location - About 55 mins to fix
lib/msip/concerns/controllers/tiposorg_controller.rb on lines 4..35

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

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

          def nomenclatura(pais, departamento, municipio,
            centropoblado, vereda, lugar, sitio)
Severity: Major
Found in lib/msip/concerns/models/ubicacionpre.rb - About 50 mins to fix

    Method agregar_actualizar has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                request, indparam1, indparam2, usuario_id, params,
                modelo, registro_id
    Severity: Major
    Found in lib/msip/concerns/models/bitacora.rb - About 50 mins to fix

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

                  if !municipio_id ||
                      Msip::Municipio.where(
                        id: municipio_id.to_i,
                        departamento_id: odepartamento.id,
                      ).count == 0
      Severity: Minor
      Found in lib/msip/concerns/models/ubicacionpre.rb and 1 other location - About 50 mins to fix
      lib/msip/concerns/models/ubicacionpre.rb on lines 252..262

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

      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

      Severity
      Category
      Status
      Source
      Language