Showing 722 of 1,271 total issues
Method expire
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.expire(conditions, batch_size, sleep_time)
timerange = conditions[:timerange] || 1.week
status = conditions[:status]
created = (Time.now.utc - timerange).to_formatted_s(:db)
logger.info "Starting #{to_s.underscore.humanize.pluralize} expiration before #{created} status #{status || 'not set'} batch size #{batch_size} sleep #{sleep_time}"
Method find_or_create_external_user
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.find_or_create_external_user(attrs, auth_source_name)
external_groups = attrs.delete(:groups)
auth_source = AuthSource.find_by_name(auth_source_name.to_s)
# existing user, we'll update them
Method login
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def login
User.current = nil
if bruteforce_attempt?
inline_error _("Too many tries, please try again in a few minutes.")
Method set_taxonomy
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_taxonomy
TopbarSweeper.expire_cache
user = User.current
return if user.nil?
Method lookup
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.lookup(query, options = {})
return nil unless query.present?
proxy = options.fetch(:proxy, nil)
resolver = options.fetch(:resolver, Resolv::DNS.new)
Function GlobalState
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const GlobalState = ({
responseStatus,
isOKState,
cannotViewStatuses,
allStatusesCleared,
- 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
Function changeLdapPort
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function changeLdapPort(item) {
const port = $('#auth_source_ldap_port');
if (port.length > 0) {
const value = parseInt(port.val(), 10);
- 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_vm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_vm(args = {})
args[:comment] = args[:user_data] if args[:user_data]
args[:template] = args[:image_id] if args[:image_id]
template = template(args[:template]) if args[:template]
instance_type = instance_type(args[:instance_type]) unless args[:instance_type].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 setSSHProvision
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def setSSHProvision
logger.info "SSH connection established to #{provision_host} - executing template"
if client.deploy!
# since we are in a after_commit callback, we need to fetch our host again, and clean up puppet ca on our own
Host.find(id).built
- 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 filter_encrypted
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def filter_encrypted
audited_changes.each do |name, change|
next if change.nil? || change.to_s.empty?
if change.is_a? Array
change.map! { |c| c.to_s.start_with?(EncryptValue::ENCRYPTION_PREFIX) ? REDACTED : c }
- 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 attributes_values
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def attributes_values(entry)
Hash[required_ldap_attributes.merge(optional_ldap_attributes).map do |name, value|
next if value.blank? || (entry[value].blank? && optional_ldap_attributes.key?(name))
if name.eql? :avatar
[:avatar_hash, store_avatar(entry[value].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 rebuild_audit_changes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def rebuild_audit_changes(audit)
css_class_name = css_class_by_action(audit.action == 'destroy')
# update data for created template for better view
if audit.action == 'create' && (change = audit.audited_changes['template']).present?
audit.audited_changes['template'] = ['', change]
- 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_interface
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_interface(attributes, name, iface)
# update bond.attached_interfaces when interface is in the list and identifier has changed
update_bonds(iface, name, attributes) if iface.identifier != name && !iface.virtual? && iface.persisted?
attributes = attributes.clone
iface.mac = attributes.delete(:macaddress)
- 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_vm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_vm(args = { })
args[:tags] = parse_tags(args)
args = vm_instance_defaults.merge(args.to_h.symbolize_keys).deep_symbolize_keys
if (image_id = args[:image_id])
image = images.find_by_uuid(image_id.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_vm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_vm(args = { })
vm = nil
test_connection
return unless errors.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 user_params_filter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def user_params_filter
Foreman::ParameterFilter.new(::User).tap do |filter|
filter.permit :current_password,
:default_location_id,
:default_organization_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 allocation_text_f
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def allocation_text_f(f)
active = 'Size'
active = 'None' if f.object.allocation.to_i == 0
active = 'Full' if f.object.allocation == f.object.capacity
text_f f, :allocation, :class => "input-mini", :label => _("Allocation (GB)"), :label_size => "col-md-2",
- 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 operatingsystem
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def operatingsystem
name = facts['distribution.name']
version = facts['distribution.version']
return nil if name.nil? || version.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 hidden_toggle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def hidden_toggle(hidden, hide_icon = 'eye-slash', unhide_icon = 'eye', strikethrough = false)
return unless can_edit_params?
if strikethrough && !hidden
link_to_function(icon_text(hide_icon, '', :kind => 'fa'), "", :class => "btn btn-default btn-md btn-hide", :disabled => "disabled", :rel => "twipsy", :title => _("This value is not hidden"))
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 find_multiple
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def find_multiple
# Lets search by name or id and make sure one of them exists first
if params.key?(:host_names) || params.key?(:host_ids) || multiple_with_filter?
@hosts = resource_base.search_for(params[:search]) if multiple_with_filter?
@hosts ||= resource_base.merge(Host.where(id: params[:host_ids]).or(Host.where(name: params[:host_names])))
- 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"