fabiolnm/cieloz

View on GitHub

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
Severity: Minor
Found in lib/cieloz/requisicao.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 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
Severity: Minor
Found in lib/cieloz/requisicao_transacao.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 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|
Severity: Minor
Found in lib/cieloz/helpers.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 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
Severity: Minor
Found in lib/cieloz/helpers.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 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
Severity: Minor
Found in lib/cieloz/requisicao_transacao/dados_pedido.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 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
Severity: Minor
Found in lib/cieloz/helpers.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