Class InfoRequestEvent
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class InfoRequestEvent < ApplicationRecord
extend XapianQueries
EVENT_TYPES = [
'sent',
File info_request_event.rb
has 445 lines of code (exceeds 250 allowed). Consider refactoring. Open
class InfoRequestEvent < ApplicationRecord
extend XapianQueries
EVENT_TYPES = [
'sent',
Method params_for_jsonb
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def params_for_jsonb(params)
params.inject({}) do |memo, (k, v)|
key = k.to_s
# look for keys ending in `_id` and attempt to map to a Ruby class
- 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 display_status
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def display_status
if is_incoming_message?
status = calculated_state
return status.nil? ? _("Response") : InfoRequest.get_status_description(status)
end
- 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 indexed_by_search?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def indexed_by_search?
if %w[sent followup_sent response comment].include?(event_type)
return false unless info_request.indexed_by_search?
if event_type == 'response' && !incoming_message.indexed_by_search?
return false
- 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 params_diff
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def params_diff
# split out parameters into old/new diffs, and other ones
old_params = {}
new_params = {}
other_params = {}
- 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 search_text_main
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def search_text_main(clipped = false)
text = ''
if event_type == 'sent'
text = text + outgoing_message.get_text_for_indexing + "\n\n"
elsif event_type == 'followup_sent'
- 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 is_clarification?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_clarification?
waiting_clarification = false
# A follow up is a clarification only if it's the first
# follow up when the request is in a state of
# waiting for clarification
- 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
Avoid too many return
statements within this method. Open
return true