Showing 6 of 6 total issues
Method to_xml
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def to_xml
x = Builder::XmlMarkup.new
x.instruct!
name = self.class.name.demodulize
@xml = x.tag! name.underscore.dasherize, id: id, versao: versao do
- 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 valida_digitos_numero_cartao
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def valida_digitos_numero_cartao
if dados_portador and forma_pagamento and bandeira = forma_pagamento.bandeira
numero = dados_portador.numero.to_s
case bandeira.to_s
when Cieloz::Bandeiras::DINERS
- 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 valid?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def valid?
valid = _valid?
unless @source.nil?
unless valid
errors.messages.each { |attr,attr_errors|
- 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 attrs_from
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def attrs_from source, opts, *keys
attrs = keys.map { |k|
value_or_attr_name = opts[k] || k
if value_or_attr_name.is_a? Symbol
source.send value_or_attr_name if source.respond_to? value_or_attr_name
- 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 map
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.map(source, opts={})
mappings = attrs_from source, opts, :numero, :valor,
:descricao, :data_hora, :moeda, :idioma, :soft_descriptor
num, val, desc, time, cur, lang, soft = mappings
- 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 hattr_writer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def hattr_writer *attrs
attrs.each { |attr|
define_method "#{attr}=" do |value|
if value.is_a? Hash
name = attr.to_s.camelize
- 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"