File session.rb
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_dependency 'aircasting/username_param'
class Session < ApplicationRecord
self.skip_time_zone_conversion_for_attributes = %i[
start_time_local
Class Session
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Session < ApplicationRecord
self.skip_time_zone_conversion_for_attributes = %i[
start_time_local
end_time_local
]
Method as_json
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def as_json(opts = nil)
opts ||= {}
methods = opts[:methods] || %i[notes]
methods << :type
Method generate_link
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_link(stream)
threshold_min = stream.threshold_set.threshold_very_low.to_i
threshold_low = stream.threshold_set.threshold_low.to_i
threshold_middle = stream.threshold_set.threshold_medium.to_i
threshold_high = stream.threshold_set.threshold_high.to_i
Method filter_
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.filter_(data = {})
sessions =
order('sessions.start_time_local DESC')
.where(contribute: true)
.joins(:user)
Method as_json
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def as_json(opts = nil)
opts ||= {}
methods = opts[:methods] || %i[notes]
methods << :type
- 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 filter_
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.filter_(data = {})
sessions =
order('sessions.start_time_local DESC')
.where(contribute: true)
.joins(:user)
- 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 sync
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sync(session_data)
tag_list = session_data[:tag_list] || ''
session_data =
session_data.merge(tag_list: SessionBuilder.normalize_tags(tag_list))
Method sync
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sync(session_data)
tag_list = session_data[:tag_list] || ''
session_data =
session_data.merge(tag_list: SessionBuilder.normalize_tags(tag_list))
- 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"