Showing 102 of 130 total issues
Method find_or_create_user
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_or_create_user(ldap_user, ldap_configs)
Rails.logger.info "LDAP: finding or creating user"
# get the username, full name and email from the data returned by the server
username, email, name = user_info(ldap_user, ldap_configs)
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def create
if @space.save
respond_with @space do |format|
# the user that created the space is always an admin
- 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_invitation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_invitation
if params[:invite][:title].blank?
flash[:error] = t('events.send_invitation.error_title')
elsif params[:invite][:users].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
Method format_date
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def format_date(date, format=:short, include_time=true)
if date.present?
if date.is_a?(Integer) && date.to_s.length == 13
value = Time.at(date/1000)
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 unique_mconf_id
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.unique_mconf_id(base_value)
new_value = base_value
new_value = new_value.parameterize unless base_value.nil?
base = new_value
- 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 user_info
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def user_info(ldap_user, ldap_configs)
if ldap_user[ldap_configs.ldap_username_field] && !ldap_user[ldap_configs.ldap_username_field].empty?
username = ldap_user[ldap_configs.ldap_username_field].first
else
username = ldap_user['uid'].first
- 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 select
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def select
# try to get already set collection (@spaces) or use the class name for a query (Space)
klass = if controller_name == "tags"
ActsAsTaggableOn::Tag
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 social_login_enabled?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def social_login_enabled?(method=nil)
if method == "google"
Rails.application.config.omniauth_google_key.present? && Rails.application.config.omniauth_google_secret.present?
elsif method == "facebook"
Rails.application.config.omniauth_facebook_key.present? && Rails.application.config.omniauth_facebook_secret.present?
- 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 convert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.convert(value)
if value.blank?
nil
elsif Mconf::Filesize.is_number?(value)
begin
- 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 deeply nested control flow statements. Open
case invalid_fields
when :username
Rails.logger.error "LDAP: authentication failed: the user has no username set in the LDAP server"
fail(I18n.t('devise.strategies.ldap_authenticatable.missing_username'))
when :name
Method user_can_end_meeting
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def user_can_end_meeting(user, room)
if (room.owner_type == "User" && room.owner.id == user.id)
true
elsif (room.owner_type == "Space")
space = Space.find(room.owner.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
@participant.event = @event
if current_user
@participant.owner = current_user
@participant.email = current_user.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 wrapped_button
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def wrapped_button(*args, &block)
options = args.extract_options!
wrapper_class = ['form-actions', options[:wrapper_class]].compact
options.delete(:wrapper_class)
template.content_tag :div, :class => wrapper_class do
- 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 deeply nested control flow statements. Open
if user.nil?
Rails.logger.error "LDAP: authentication failed: application wasn't able to create a new user"
fail(I18n.t('devise.strategies.ldap_authenticatable.create_failed'))
else
# if user.active_for_authentication?
Method invitation_email
has a Cognitive Complexity of 8 (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"
Further reading
Method validate_and_adjust_max_upload_size
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_and_adjust_max_upload_size
if max_upload_size_changed?
if self.max_upload_size.blank?
write_attribute(:max_upload_size, nil)
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
Avoid deeply nested control flow statements. Open
if !room.is_running? || room.user_created_meeting?(current_user)
:moderator
else
:attendee
end
Avoid deeply nested control flow statements. Open
if room.private
:key
else
guest_role
end
Method load_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_data(env_variables, filters='')
filter = split_into_regexes(filters)
filter = [/^shib-/] if filter.empty?
shib_data = {}
- 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 deeply nested control flow statements. Open
version_name = :logo168x128 unless resource.logo_image.send(version_name).file.exists?