Method create_new_teams_for_bidding_response
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def create_new_teams_for_bidding_response(teams, assignment, priority_info)
# Structure of teams variable: [[user_id1, user_id2], [user_id3, user_id4]]
teams.each do |user_ids|
# Create new team and team node
new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s, parent_id: assignment.id)
- 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 run_intelligent_assignment
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def run_intelligent_assignment
priority_info = []
assignment = Assignment.find_by(id: params[:id])
topics = assignment.sign_up_topics
teams = assignment.teams
- 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 match_new_teams_to_topics
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def match_new_teams_to_topics(assignment)
unless assignment.is_intelligent
flash[:error] = "This action is not allowed. The assignment #{assignment.name} does not enable intelligent assignments."
return
end
Method merge_bids_from_different_previous_teams
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def merge_bids_from_different_previous_teams(assignment, team_id, user_ids, priority_info)
# Select data from `priority_info` variable that only related to team members in current team and transpose it.
# For example, below matrix shows 4 topics (key) and correponding priorities given by 3 team members (value).
# {
# 1: [1, 2, 3],
- 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 match_new_teams_to_topics
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def match_new_teams_to_topics(assignment)
unless assignment.is_intelligent
flash[:error] = "This action is not allowed. The assignment #{assignment.name} does not enable intelligent assignments."
return
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 run_intelligent_assignment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_intelligent_assignment
priority_info = []
assignment = Assignment.find_by(id: params[:id])
topics = assignment.sign_up_topics
teams = assignment.teams