Showing 17 of 21 total issues
Method create
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def create
session[:authhash] = nil #ensure no one sets it
omniauth = request.env['omniauth.auth']
provider = request.env['omniauth.auth']['provider']
@authhash = Hash.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 determine_browser_and_os
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def determine_browser_and_os(ua = request.env["HTTP_USER_AGENT"])
ua = (ua||"").downcase
br = case ua
when /opera[\/,\s+](\d+)/
o = %W(opera opera#{$1})
- 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
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create
@story = Story.find(params[:story_id])
@comment = @story.comments.build(comment_params)
@comment.user = nil
@comment.parent_id = comment_params[:parent_id].empty? ? nil : Comment.find(comment_params[:parent_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 create
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
session[:authhash] = nil #ensure no one sets it
omniauth = request.env['omniauth.auth']
provider = request.env['omniauth.auth']['provider']
@authhash = Hash.new
Method create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
if params[:cancel]
delete_sessions
redirect_to root_url, flash: { error: t('controllers.users.create.flash.canceled') }
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
Function drawBubble
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var drawBubble = function(context, label, colour) {
// automatic abbreviation for long (>2 digits) numbers
if (typeof label == 'number' && label > 99 && options.abbreviate) {
label = abbreviateNumber(label);
Method determine_browser_and_os
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def determine_browser_and_os(ua = request.env["HTTP_USER_AGENT"])
ua = (ua||"").downcase
br = case ua
when /opera[\/,\s+](\d+)/
o = %W(opera opera#{$1})
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@story = Story.find(params[:story_id])
@comment = @story.comments.build(comment_params)
@comment.user = nil
@comment.parent_id = comment_params[:parent_id].empty? ? nil : Comment.find(comment_params[:parent_id])
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if params[:cancel]
delete_sessions
redirect_to root_url, flash: { error: t('controllers.users.create.flash.canceled') }
else
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
begin
@rating = Rating.find(votes_params[:rating_id])
@user = current_user
@vote = Vote.new()
Method publish
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def publish
respond_to do |format|
if @story.mark_as_published(current_user, story_url(@story))
rate_user(@story.user, 3) if @story.user #rate for user who wrote a story
- 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 update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
@story.attributes = story_params
respond_to do |format|
if params[:preview_button]
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
if current_user
@user = current_user
@story = @user.stories.build(story_params)
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 new
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def new
if pre_auth.authorizable?
if Doorkeeper::AccessToken.matching_token_for(pre_auth.client, current_resource_owner.id, pre_auth.scopes) || skip_authorization?
auth = authorization.authorize
redirect_to auth.redirect_uri
- 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 show
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show
@story = Story.includes([:tags, :user, :publisher, {:votes => [:rating, :user]}]).find(params[:id])
share_by_mail
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
user = User.where(:email => params[:email]).first
if user && user.authenticate(params[:password])
if params[:remember_me]
cookies.permanent.signed[:user_id] = user.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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
@user = User.find(params[:id])
if params[:cancel]
redirect_to @user, flash: { error: t('controllers.users.update.flash.canceled') }
- 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"