Showing 5 of 5 total issues
Method update_profile
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update_profile
if people_params[:avatar]
if people_params[:avatar].size >5.megabytes
redirect_to edit_error_path and 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 create_account
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_account
# use oauth login first
# check user exists or not
p "people, ",@people
- 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
Avoid too many return
statements within this method. Open
redirect_to profile_path and return
Method signed_in
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def signed_in
# p "filter is called every controller",myEmail
p "myEmail ",myEmail
if (not myEmail) || myEmail==""
# if direct access this url, goto root_path after login
- 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 showprofile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def showprofile
@people= People.select{|p| p.email==cookies[:email]}
@otheruser= People.select{|p| p.url==params[:url]}
# if otheruser not exist
if @otheruser.first.nil? or @otheruser.first.role=="mentee"
- 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"