pasosdeJesus/sivel2_gen

View on GitHub

Showing 228 of 380 total issues

Avoid too many return statements within this method.
Open

                  return
Severity: Major
Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 30 mins to fix

    Method refresca_conscaso has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def refresca_conscaso
                if ARGV.include?("db:migrate")
                  return 'Ejecutando migración'
                end
                if !ActiveRecord::Base.connection.data_source_exists? 'sivel2_gen_conscaso'
    Severity: Minor
    Found in lib/sivel2_gen/concerns/models/conscaso.rb - About 25 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

    Function connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      connect() {
        console.log("Conexion de controlador Mapa osm");
        const usuarioAutenticado = this.data.get("usuarioAutenticado") === 'true';
        if (!this.constructor.marcadores) {
          this.constructor.marcadores = L.markerClusterGroup();
    Severity: Minor
    Found in app/javascript/controllers/mapaosm_controller.js - About 25 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 crea_consexpcaso has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def crea_consexpcaso(conscaso, ordenar_por = nil)
                if ARGV.include?("db:migrate")
                  return
                end
                if !ActiveRecord::Base.connection.data_source_exists? 'sivel2_gen_conscaso'
    Severity: Minor
    Found in lib/sivel2_gen/concerns/models/consexpcaso.rb - About 25 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 error_plantilla_no_autenticado has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def error_plantilla_no_autenticado
                redirect_back fallback_location: Rails.configuration.relative_url_root, flash:{ 
                  error: "La generación de este reporte permite máximo "\
                  "#{Rails.configuration.x.sivel2_consweb_max ?
                  Rails.configuration.x.sivel2_consweb_max.to_s : '0' }"\
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 25 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 reportar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def reportar
                authorize! :read, Sivel2Gen::Caso
                @rango_fechas = 'Fecha del hecho'
                @titulo = 'Reporte de casos repetidos'
                @repetidos = []
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/buscarrepetidos_controller.rb - About 25 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 resolver_solicitud has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def resolver_solicitud
                if params[:solicitud_id]
                  usuario = Msip::Usuario.find(current_usuario.id)
                  solicitud = Msip::Solicitud.find(params[:solicitud_id])
                  creado_por = Msip::Usuario.find(solicitud.usuario_id) 
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 25 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 gen_formato has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

              def gen_formato(formato)
                Consexpcaso.crea_consexpcaso(@conscaso, @campoord)
                if params[:filtro].nil? || params[:idplantilla].nil?
                  head :no_content
                elsif params[:idplantilla].to_i <= 0
    Severity: Minor
    Found in lib/sivel2_gen/concerns/controllers/casos_controller.rb - About 25 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