Method submit_file
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def submit_file
participant = AssignmentParticipant.find(params[:id])
unless current_user_id?(participant.user_id)
flash[:error] = "Authentication Error"
redirect_to action: 'edit', id: participant.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 submit_file
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def submit_file
participant = AssignmentParticipant.find(params[:id])
unless current_user_id?(participant.user_id)
flash[:error] = "Authentication Error"
redirect_to action: 'edit', id: participant.id
Method download
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def download
folder_name = params['current_folder']['name']
file_name = params['download']
raise 'Folder_name is nil.' if folder_name.nil?
raise 'File_name is nil.' if file_name.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
Method folder_action
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def folder_action
@participant = AssignmentParticipant.find(params[:id])
return unless current_user_id?(@participant.user_id)
@current_folder = DisplayOption.new
- 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 submit_hyperlink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def submit_hyperlink
@participant = AssignmentParticipant.find(params[:id])
return unless current_user_id?(@participant.user_id)
team = @participant.team
- 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
unexpected token error
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
file_extension = original_filename&.split('.')&.last&.downcase
- Exclude checks
unexpected token error
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
file_extension = original_filename&.split('.')&.last&.downcase
- Exclude checks