NicosKaralis/pushmeup

View on GitHub

Showing 2 of 2 total issues

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

  def self.with_connection
    attempts = 1
  
    begin      
      # If no @ssl is created or if @ssl is closed we need to start it
Severity: Minor
Found in lib/pushmeup/apns/core.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 prepare_and_send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.prepare_and_send(n)
    if n.device_tokens.count < 1 || n.device_tokens.count > 1000
      raise "Number of device_tokens invalid, keep it betwen 1 and 1000"
    end
    if !n.collapse_key.nil? && n.time_to_live.nil?
Severity: Minor
Found in lib/pushmeup/gcm/core.rb - About 45 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