aklaiber/activepayment

View on GitHub

Showing 3 of 3 total issues

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

      def add_optional_node(xml, name, value = nil)
        if value.blank? && self.transaction_params.include?(name) && !self.transaction_params[name].blank?
          value = self.transaction_params[name]
        end
        unless value.blank?
Severity: Minor
Found in lib/activepayment/wirecard/gateway.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 purchase_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def purchase_request(credit_card, pares = nil, guwid = nil)
        build_request(:purchase) do |xml|
          xml.tag! 'TransactionID', self.transaction_id
          xml.tag! 'Currency', Gateway.default_currency
          xml.tag! 'Amount', self.amount.cents
Severity: Minor
Found in lib/activepayment/wirecard/gateway.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 post_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def post_request(xml)
        http_connection do |http|
          request = Net::HTTP::Post.new(self.url.path)
          unless request.blank?
            request.content_type = "text/xml"
Severity: Minor
Found in lib/activepayment/wirecard/gateway.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