Showing 15 of 21 total issues
Class User
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
attr_accessor :passwd_confirmation, :passwd_new, :remember_me
has_many :teams
has_many :emails
Method deploy
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def deploy
yaml = params[:deploy]
errors = Project.evaluate yaml
num_errors = errors.nil? || errors.empty? ? 0 : errors.length
- 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 transfer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def transfer(user, user_member_id)
raise StandardError, 'The member is not valid' if
user.nil? || user_member_id.nil?
raise StandardError, 'The member is not valid' unless
- 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 reset_passwd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reset_passwd(params)
passwd_confirmation = params[:passwd_new] == params[:passwd_confirmation]
passwd_is_short = params[:passwd_new].nil? || params[:passwd_new].length < 8
raise StandardError, 'Password has less than 8 characters' if passwd_is_short
- 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 send_forgot_notification
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.send_forgot_notification(criteria)
return if criteria.nil? || criteria.empty?
user = User.find_by_username criteria # find by username
email = Email.find_primary_by_email(criteria).take # find by primary email
- 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 authenticate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.authenticate(email, passwd)
return if passwd.nil? || passwd.empty? || email.nil? || email.empty?
user_email = Email.find_primary_by_email(email).take
user = user_email.user unless user_email.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 find_email_forgot
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_email_forgot (email_s)
emails = Email.where(email: email_s.downcase).all
return if emails.nil? || emails.empty?
return emails.first if emails.length == 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 find_or_create_member
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_or_create_member(email_member)
return if email_member.nil?
emails = Email.where(email: email_member).all
# if dont exist create a new account
return User.create_new_account(email_member) if emails.nil? || emails.empty?
- 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 name_format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def name_format
self.name.gsub!(/[^0-9a-z\-_ ]/i, '_') unless self.name.nil?
self.name.gsub!(/\s+/, '-') unless self.name.nil?
self.name = self.name.downcase unless self.name.nil?
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 change_passwd
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def change_passwd(params)
old_password = BCrypt::Engine.hash_secret(params[:passwd], self.passwd_salt)
passwd_confirmation = params[:passwd_new] == params[:passwd_confirmation]
same_old_passwd = self.passwd == old_password
passwd_is_short = params[:passwd_new].nil? || params[:passwd_new].length < 8
- 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 save_user_and_email
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.save_user_and_email(user, email, checked = false)
passwd_confirm = user.passwd == user.passwd_confirmation
passwd_is_short = user.passwd.nil? || user.passwd.length < 8
raise StandardError, 'Password has less than 8 characters' if passwd_is_short
- 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 allow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def allow
@user = User.find_by_username(params[:username]) || not_found
@user if auth? && @user.username == me.username ||
Team.find_member(@user.id, me.id).exists? || unauthorized
@spaces = Space.find_by_user_order(@user.id).all
- 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 do_login
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def do_login
@user = User.new(user_params)
user = User.login(user_params[:username], user_params[:passwd])
cookies[:auth_token] = user.auth_token unless params[:remember_me]
- 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 allow_me
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def allow_me
@user = User.find_by_username(params[:username]) || not_found
@user if auth? && me.username == @user.username || unauthorized
@spaces = Space.find_by_user_order(@user.id).all
rescue Errors::UnauthorizedError
- 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 name_format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def name_format
self.name.gsub!(/[^0-9a-z\-_ ]/i, '_') unless self.name.nil?
self.name.gsub!(/\s+/, '-') unless self.name.nil?
self.name = self.name.downcase unless self.name.nil?
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"