Method apply_oauth
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def apply_oauth(oauth)
case oauth[:provider]
when 'github'
self.github = oauth[:info][:nickname]
self.github_id = oauth[:uid]
- 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 for_omniauth
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def for_omniauth(auth)
if user = find_with_oauth(auth)
user.apply_oauth(auth)
user.save! if user.changed?
else
- 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 avatar_url_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def avatar_url_for(oauth)
if oauth[:extra] && oauth[:extra][:raw_info] && oauth[:extra][:raw_info][:gravatar_id]
"https://secure.gravatar.com/avatar/#{oauth[:extra][:raw_info][:gravatar_id]}"
elsif oauth[:info]
if oauth['provider'] == 'twitter'
- 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_with_oauth
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_with_oauth(oauth)
case oauth[:provider]
when 'github'
(oauth[:uid] ? find_by_github_id(oauth[:uid]) : find_by_github(oauth[:info][:nickname]))
when 'linkedin'
- 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"