Method filterByRecommendations
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filterByRecommendations(events, user_id)
events_attended = []
tags_list = []
tag_count = [0,0,0,0,0,0,0,0,0]
recommended_events = []
Method initialize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user_id, location, near_me, other, time, tag, recommend)
@events = Event.all
if recommend == "true"
@events = filterByRecommendations(@events, user_id)
@events = Filter.addAttendancestoEvents(@events)
- 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 filterByOther
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filterByOther(events, user_id, other)
friend_events = []
my_friends = []
@users_friendships = Friendship.where(user_id: user_id)
@users_friendships.each do |friendship|
Method filterByRecommendations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def filterByRecommendations(events, user_id)
events_attended = []
tags_list = []
tag_count = [0,0,0,0,0,0,0,0,0]
recommended_events = []
- 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 filterByOther
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def filterByOther(events, user_id, other)
friend_events = []
my_friends = []
@users_friendships = Friendship.where(user_id: user_id)
@users_friendships.each do |friendship|
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(user_id, location, near_me, other, time, tag, recommend)
Method search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.search(searchValue)
#@events = Event.all; for each event, check each of the three in turn and add it to
#actual_events array to return
#select distinct * from events where
@events = []
- 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"