Showing 722 of 1,271 total issues
Method available?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def available?
return false unless Setting['authorize_login_delegation']
return false if controller.api_request? && !(Setting['authorize_login_delegation_api'])
return false if http_token.present?
return false if controller.api_request? && request.env[CAS_USERNAME].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 boot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def boot(args)
# valid additional arguments args[:reboot] = true|false, args[:persistent] = true|false
# put "/bmc/:host/chassis/config/?:function?/?:action?" do
case args[:function]
when "bootdevice"
- 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 can?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def can?(permission, subject = nil, cache = true)
return false if user.nil? || user.disabled?
return true if user.admin?
if subject.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 snippet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def snippet(name, options = {}, variables: {})
template = source.find_snippet(name)
unless template
raise "The specified snippet '#{name}' does not exist, or is not a snippet." unless options[:silent]
return
- 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 valid_json_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def valid_json_type(cell)
if cell.is_a?(String) || [true, false].include?(cell) || cell.is_a?(Numeric) || cell.nil?
cell
elsif cell.is_a?(Enumerable)
hashify = cell.is_a?(Hash)
- 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 valid_issuer?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def valid_issuer?
logger = Foreman::Logging.logger('app')
payload = jwt_token.decoded_payload
if payload.nil?
logger.error "Invalid JWT received, please check connectivity with the OpenID Provider"
- 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 foreman_server_ca_cert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def foreman_server_ca_cert(server_ca_file_enabled: true, ssl_ca_file_enabled: true)
setting_values = []
setting_values << Setting[:server_ca_file] if server_ca_file_enabled
setting_values << Setting[:ssl_ca_file] if ssl_ca_file_enabled
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authenticate!
payload = jwt_token.decode || {}
user_id = payload['user_id']
unless valid_scope?(payload['scope'])
- 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 ping_cache
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ping_cache
response = {}
if redis_cache_store?
redis = Rails.cache.redis
- 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_packages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_packages
banner = <<~CMD
echo '#'
echo '# Updating packages'
echo '#'
- 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 method_missing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method, *args, &block)
if method.to_s.starts_with?('power_', 'boot_', 'identify_', 'lan_')
margs = args.first
farg = method.to_s.split('_')
# method must contain 2 parts, ie: power_on, boot_disk
- 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_generic_matcher
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_generic_matcher(lookup_values, options)
computed_lookup_value = nil
lookup_values.each do |lookup_value|
element, element_name = get_element_and_element_name(lookup_value)
next if (options[:skip_fqdn] && element == "fqdn")
- 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 function. Open
return state.merge(payload);
Avoid too many return
statements within this function. Open
return state
.set('searchQuery', '')
.set('isFetchingHosts', false)
.set('isSearchingHosts', false);
Avoid too many return
statements within this function. Open
return state.set('templateKindId', payload);
Avoid too many return
statements within this function. Open
return state.set('isLoading', true);
Avoid too many return
statements within this function. Open
return state.merge(payload);
Avoid too many return
statements within this function. Open
return state.set('isFetchingHosts', false).merge(payload);
Avoid too many return
statements within this function. Open
return state.merge({
notifications,
hasUnreadMessages: hasUnreadMessages(notifications),
});
Avoid too many return
statements within this function. Open
return state.set('selectedView', payload);