Showing 102 of 130 total issues
Class User
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
include PublicActivity::Common
include Mconf::ApprovalModule
include Mconf::DisableModule
Method authenticate!
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def authenticate!
if ldap_enabled? && valid_params_sent?
Rails.logger.info "LDAP: LDAP is enabled, trying to connect to LDAP server"
configs = ldap_configs
ldap = ldap_connection(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
File user.rb
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'devise/encryptors/station_encryptor'
require 'digest/sha1'
require './lib/mconf/approval_module'
class User < ActiveRecord::Base
Method bigbluebutton_role
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def bigbluebutton_role(room)
if BigbluebuttonRails.configuration.guest_support
guest_role = :guest
else
guest_role = :attendee
- 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
Class Space
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Space < ActiveRecord::Base
include PublicActivity::Common
include Mconf::ApprovalModule
include Mconf::DisableModule
Method logo_image
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def logo_image(resource, options={})
options[:size] = validate_logo_size(options[:size])
if resource.is_a?(User)
model_type = :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 login
has a Cognitive Complexity of 24 (exceeds 5 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
- 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 24 (exceeds 5 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])
- 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 24 (exceeds 5 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
- 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 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register_abilities(user)
abilities_for_bigbluebutton_rails(user)
# Users
can [:index, :show, :fellows, :current, :select], User
Class Event
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ActiveRecord::Base
extend FriendlyId
include PublicActivity::Common
Class SpacesController
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class SpacesController < InheritedResources::Base
include Mconf::ApprovalControllerModule # for approve, disapprove
include Mconf::DisableControllerModule # for enable, disable
include Mconf::SelectControllerModule # select
Method link_to_trackable
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def link_to_trackable(trackable, cls, options = {})
if trackable.nil?
# e.g. 'MyModule::Event' to 'my_module_event'
cls = cls.underscore.gsub(/\//, '_')
- 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 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authenticate!
if ldap_enabled? && valid_params_sent?
Rails.logger.info "LDAP: LDAP is enabled, trying to connect to LDAP server"
configs = ldap_configs
ldap = ldap_connection(configs)
Class Shibboleth
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Shibboleth
# the key used to indicate in the session if the user is signed in
# via shibboleth or not
SESSION_KEY = :shib_login
Method call
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
ssl_failed = false
if /^\/users\/certificate(.json)/.match env['REQUEST_URI']
ENV['SSL_CLIENT_CERT'] ||= ''
- 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
Class SSLClientCert
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class SSLClientCert
# the key used to indicate in the session if the user is signed in
# via certificate or not
SESSION_KEY = :certificate_login
Method process_additions
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def process_additions
errors = []
success = []
ids = params[:candidates].try(:split, ',') || []
ids.each do |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 users
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def users
words = params[:q].try(:split, /\s+/)
query = User.with_disabled.search_by_terms(words, can?(:manage, User)).search_order
[:disabled, :approved, :can_record].each do |filter|
- 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 bigbluebutton_role
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bigbluebutton_role(room)
if BigbluebuttonRails.configuration.guest_support
guest_role = :guest
else
guest_role = :attendee