Showing 5 of 5 total issues
Method send_requests_with_get
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_requests_with_get(events)
success_count = 0
unsent_requests = []
events.each do |event|
- 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 finalise_payload
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def finalise_payload(payload, context, tstamp, event_subject, page)
Method finalise_payload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def finalise_payload(payload, context, tstamp, event_subject, page)
payload.add_json(build_context(context), @encode_base64, 'cx', 'co') unless context.nil? || context.empty?
payload.add_hash(page.details) unless page.nil?
if event_subject.nil?
- 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 send_requests_with_post
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_requests_with_post(events)
post_succeeded = false
begin
request = http_post(SelfDescribingJson.new(
'iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4',
- 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 flush
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def flush(async = true)
loop do
@lock.synchronize do
@queue.synchronize { @results_unprocessed += 1 }
@queue << @buffer
- 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"