Method has too many lines. [34/30] Open
def propose(team, team_preferences)
team_preferences.each do |app|
puts "Team preferences: " + team_preferences.to_s
puts "Team " + team + " proposing to App " + app
# Check if the app is currently matched
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method propose
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def propose(team, team_preferences)
team_preferences.each do |app|
puts "Team preferences: " + team_preferences.to_s
puts "Team " + team + " proposing to App " + app
# Check if the app is currently matched
Method propose
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def propose(team, team_preferences)
team_preferences.each do |app|
puts "Team preferences: " + team_preferences.to_s
puts "Team " + team + " proposing to App " + app
# Check if the app is currently matched
- 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 find_last_edit_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_last_edit_user(matching, engagement)
matching.last_edit_users.each do |team, last_edit_user_id|
if (team == engagement.team_number)
if (last_edit_user_id == 0)
return "Your team has not responded yet!"
- 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 find_user_engagement_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_user_engagement_id(user_id)
dev_engagement = User.find(user_id).developing_engagement
if !dev_engagement.nil?
matching = dev_engagement.matching
if !matching.nil?
- 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
Unused block argument - v
. If it's necessary, use _
or _v
as an argument name to indicate that it won't be used. Open
new_result.each do |k, v|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused block argument - v
. If it's necessary, use _
or _v
as an argument name to indicate that it won't be used. Open
new_preferences.each do |k, v|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused block argument - team
. If it's necessary, use _
or _team
as an argument name to indicate that it won't be used. Open
last_edit_users.each do |team, last_edit_user|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused block argument - v
. If it's necessary, use _
or _v
as an argument name to indicate that it won't be used. Open
new_last_edit_users.each do |k, v|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end