Showing 34 of 79 total issues
Method load_token
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.load_token(token, request, verbose=true)
token = token.to_s.strip
if DoorMat::Regex.session_guid.match(token).blank?
DoorMat.configuration.logger.warn "WARN: #{request.remote_ip} Attempted to use token with invalid format #{token}" if verbose
return 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 create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
before_sign_up
@sign_up = DoorMat::SignUp.new(sign_up_params)
sign_up_failed = true
- 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 around_save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def around_save(record)
return yield if DoorMat::Crypto.current_skip_crypto_callback.skip?
clear_attribute = record.send("#{@attribute}")
actor = record.send("#{@actor_column}")
- 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 with
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.with(email, password, is_public, remember_me, request, cookies)
Method with
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.with(address, password, request, cookies, controller)
Method add
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.add(email, actor, controller)
return false unless email.valid?
actor.with_lock do
return false unless actor.can_add_email? 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 with
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.with(address, password, request, cookies, controller)
# Destroy any session linked to existing cookies before
# replacing it by a new session
DoorMat::Session.destroy_if_linked_to(cookies)
- 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 set_primary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.set_primary(encoded_address, actor)
actor.with_lock do
email = actor.email_from_urlsafe_encoded(encoded_address)
return false if email.blank?
- 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
return nil
Avoid too many return
statements within this method. Open
return access_token
Avoid too many return
statements within this method. Open
return access_token
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return nil
Method owned_by
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.owned_by(owner)
password = DoorMat::Crypto::SymmetricStore.random_key
anonymous_actor = Actor.create_with(password)
return nil if anonymous_actor.blank?
- 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"