Showing 102 of 130 total issues
Method register_abilities
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def register_abilities(user)
can :manage, :all
cannot [:leave], Space do |space|
!space.users.include?(user) || space.is_last_admin?(user)
- 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 validate_each
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
unless value.blank?
# all rooms with the same slug
rooms = BigbluebuttonRoom.where("lower(slug) = ?", value.downcase)
- 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 force_modal
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def force_modal
if !request.xhr?
if request.referer.blank?
if user_signed_in?
redirect_to my_home_path(automodal: request.path)
- 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 login
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def login
# to force a redirect back to where the user was
# needed because the app would block a redirect since the auth is in an external url
params["return_to"] = user_return_to
Method delete_collection
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def delete_collection
if @attachments.blank?
flash[:error] = t("attachment.error.malformed")
redirect_to space_attachments_path(@space)
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 save_for_accept_and_decline
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def save_for_accept_and_decline(msg)
respond_to do |format|
if @join_request.save
format.html {
flash[:success] = msg
- 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 append_info_to_payload
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def append_info_to_payload(payload)
super
payload[:session] = {
id: session.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 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
# if it's an admin creating new requests (inviting) for his space
if params[:type] == 'invite' && can?(:manage_join_requests, @space)
success, errors, already_invited = process_invitations
Method authenticate!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def authenticate!
resource = mapping.to.find_for_database_authentication(authentication_hash)
return fail(:not_found_in_database) unless resource
# only superusers are allowed to sign in if the local authentication is disabled
- 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 register_abilities
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def register_abilities(user)
abilities_for_bigbluebutton_rails(user)
# Users
can [:index, :show, :fellows, :current, :select], User
- 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 application_revision
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.application_revision(full=false)
unless @@revision or @@revision_full != full
if File.exists?("REVISION")
@@revision = File.read("REVISION")
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 update
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
# map cropping attributes to be attributes of the profile
[:crop_x, :crop_y, :crop_w, :crop_h, :crop_img_w, :crop_img_h].each do |attr|
if params['user'] && params['user'][attr.to_s]
@user.profile.send("#{attr}=", params['user'][attr.to_s])
Method process_additions
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_additions
errors = []
success = []
ids = params[:candidates].try(:split, ',') || []
ids.each do |id|
Method associate_with_existent_account
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def associate_with_existent_account(shib)
# try to authenticate the user with his login and password
valid = false
if params.has_key?(:user)
- 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 check_invitations
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.check_invitations(invitations)
success = []
error = []
# the invitation will only be invalid if the user or their email is invalid
- 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 abilities_for_bigbluebutton_rails
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def abilities_for_bigbluebutton_rails(user)
# Can do the actions below if he's the owner or if he belongs to the space (with any role)
# that owns the room.
# `:create_meeting` is a custom name, not an action that exists in the controller
Method space_join_button
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def space_join_button(space, options={})
# no user logged, renders a register button
if !user_signed_in?
options[:class] = "#{options[:class]} btn btn-large btn-block btn-success"
Method to_ical
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_ical
if self.is_a? EventInvitation
target.to_ical
else
event = Icalendar::Event.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 validate_each
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
unless value.blank?
spaces = Space.with_disabled.where("lower(slug) = ?", value.downcase)
if record.is_a?(Space) && !record.new_record?
spaces = spaces.where.not(id: record.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 invitation_email
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def invitation_email(invitation)
@invitation = Invitation.find(invitation)
if @invitation.recipient.nil?
if @invitation.recipient_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"