agile-alliance-brazil/event_registrations

View on GitHub

Showing 3 of 3 total issues

Method read_pag_seguro_body has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def read_pag_seguro_body(response_hash)
    response_hash.each do |transaction|
      Rails.logger.info('code,reference,status,grossAmount,date')
      transaction.second.each do |invoice_params|
        next if invoice_params.is_a?(Array) || invoice_params['reference'].blank?
Severity: Minor
Found in app/adapters/pagseguro_adapter.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 serve_the_queue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.serve_the_queue(event)
    return if event.full?

    event_queue = AttendanceRepository.instance.event_queue(event).to_a

Severity: Minor
Found in app/services/queue_service.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 extract_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_value(attendance, payment_type)
    quota = find_quota
    if payment_type == 'statement_agreement'
      full_price
    elsif attendance.price_band?
Severity: Minor
Found in app/models/event.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