Showing 272 of 272 total issues
Method item_acordeon_bs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
acid, idit, titulo, expandido = false, opciones_ps = {}, &bloque
Method caja_de_verificacion_bs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def caja_de_verificacion_bs(idit, clase_div, valor, at_nombre,
etiqueta, opciones = {})
Method agregar_actualizar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.agregar_actualizar(
request, indparam1, indparam2, usuario_id, params,
modelo, registro_id
)
# Se intentó implementar a nivel de modelo con
- Read upRead up
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 rehabilita_centropoblado
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
id, municipio_id, cplocal_cod, nombre, observacion, fechacreacion
Method asociacion_llave_foranea
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.asociacion_llave_foranea(atr)
aso = reflect_on_all_associations
bel = aso.select { |a| a.macro == :belongs_to }
fk = bel.map do |e|
e.foreign_key.to_s
- Read upRead up
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 mostrar_portada
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def mostrar_portada
if !params[:id].nil?
@anexo = Anexo.find(params[:id].to_i)
ruta = @anexo.adjunto_file_name
# ls = %x(ls -l #{Msip.ruta_anexos})
- Read upRead up
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_gen
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def new_gen
if cannot?(:new, clase.constantize)
# Supone alias por omision de https://github.com/CanCanCommunity/cancancan/blob/develop/lib/cancan/ability/actions.rb
authorize!(:create, clase.constantize)
end
- Read upRead up
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 flotante_localizado
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def flotante_localizado(*fields)
fields.each do |f|
define_method("#{f}_localizado") do
val = if attribute_method?(f)
read_attribute(f)
- Read upRead up
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
def index
c = nil
if params[:municipio_id]
idmun = params[:municipio_id].to_i > 0 ?
params[:municipio_id].to_i : nil
- Read upRead up
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 38.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def index
c = nil
if params[:municipio_id]
idmun = params[:municipio_id].to_i > 0 ?
params[:municipio_id].to_i : nil
- Read upRead up
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 38.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Consider simplifying this complex logical expression. Open
if !f || (f.class != String && f.class != Date &&
f.class != ActiveSupport::TimeWithZone) ||
(f.class == String && f == "")
return nil
end
Consider simplifying this complex logical expression. Open
if mesnac > mes || (dianac && dianac > 0 && dia && dia > 0 &&
dianac > dia)
na -= 1
end
Consider simplifying this complex logical expression. Open
if !params || !params[:ubicacionpre] ||
!params[:ubicacionpre][:lugar] ||
!params[:ubicacionpre][:lugar].strip == '' ||
!params[:ubicacionpre][:pais_id] ||
Msip::Pais.where(id: params[:ubicacionpre][:pais_id]).count != 1
Method ampliar_where
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ampliar_where(w, n, v, opcmp = "=", con = "AND")
Method ampliar_where_sinap
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ampliar_where_sinap(w, n, v, opcmp = "=", con = "AND")
Method item_nav_pestaña_bs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def item_nav_pestaña_bs(idit, titulo, elegida = false,
clase_boton = "", &bloque)
Function msip_ubicacionpre_expandible_registra
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function msip_ubicacionpre_expandible_registra(iniid, campoubi, root,
fcamdep = null, fcammun = null) {
Method poromision_con2p
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def poromision_con2p(params, p1, p2, s,
valorsp = "")
Method descarga_anexo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def descarga_anexo
if !params[:id].nil?
@anexo = Anexo.find(params[:id].to_i)
ruta = @anexo.adjunto_file_name
if !ruta.nil?
- Read upRead up
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 cambiar_convencion_sexo
has a Cognitive Complexity of 7 (exceeds 5 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
- Read upRead up
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"