Method extract_chat
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_chat(ev)
data = []
# "peer" attribute was present before 9.0.0
# than has been replaced by "from" and "rcpt"
- 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 extract_call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_call(ev)
data = []
versus = ev.data['incoming'] == 1 ? :in : :out
hash = {:time => ev.da, :versus => versus, :type => ev.data['program'].downcase.to_sym, :size => ev.data['duration'].to_i}
bidirectional = hash[:type] == :skype
- 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 create_suggested_peer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_suggested_peer(target_id, params)
time = Time.parse(params[:day])
peer = params[:data][:peer]
type = params[:type]
versus = params[:data][:versus]
Method extract_chat
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.extract_chat(ev)
data = []
# "peer" attribute was present before 9.0.0
# than has been replaced by "from" and "rcpt"
Method create_suggested_peer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.create_suggested_peer(target_id, params)
time = Time.parse(params[:day])
peer = params[:data][:peer]
type = params[:type]
versus = params[:data][:versus]
- 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 data
Method extract_sms_or_mms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_sms_or_mms ev
data = []
hash = {:time => ev.da, type: ev.data['type'].downcase.to_sym, size: ev.data['content'].length}
if ev.data['incoming'] == 1
- 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"