Showing 3 of 3 total issues
Method aps
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def aps
{}.tap do |result|
result.merge!(alert: alert) if alert
result.merge!(badge: badge) if badge
result.merge!(sound: sound) if sound
- 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 build_headers_for
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build_headers_for(notification)
h = {}
h.merge!('apns-id' => notification.apns_id) if notification.apns_id
h.merge!('apns-expiration' => notification.expiration) if notification.expiration
h.merge!('apns-priority' => notification.priority) if notification.priority
- 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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options={})
@url = options[:url] || APPLE_PRODUCTION_SERVER_URL
@cert_path = options[:cert_path]
@cert_pass = options[:cert_pass]
@connect_timeout = options[:connect_timeout] || 30
- 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"