Showing 76 of 163 total issues
Method modify_items
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def modify_items(items, oval_policy, ansible_role, roles_method)
items.reduce(CheckCollection.new) do |memo, item|
role_ids = item.ansible_role_ids + [ansible_role.id]
item.ansible_role_ids = role_ids unless item.send(roles_method).include? ansible_role
item.save if item.changed?
- 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 add_overrides
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_overrides(collection, host_or_hg, config)
model_match = host_or_hg.class.name.underscore =~ /\Ahostgroup\z/ ? "hostgroup" : "fqdn"
collection.where(:override => true).find_each do |override|
return unless host_or_hg.openscap_proxy && (url = host_or_hg.openscap_proxy.url).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 scap_content_profile_selector
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def scap_content_profile_selector(form)
if profiles_selection.length == 1
select_f form, :scap_content_profile_id, profiles_selection, :id, :title,
{ :selected => @policy.scap_content_profile_id },
{ :label => _("XCCDF Profile"),
- 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 assign
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def assign(oval_policy, ids, model_class)
check_collection = ::ForemanOpenscap::Oval::Setup.new.run
return check_collection unless check_collection.all_passed?
ansible_role = @config.find_config_item
- 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 override_param
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def override_param(handler, param_name, param, config, key_type, default_value = nil)
Method populate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def populate
return unless @policy.deploy_by && Policy.deploy_by_variants.include?(@policy.deploy_by)
config = @name_sevice.config_for @policy.deploy_by.to_sym
return unless config.available?
return unless config.managed_overrides?
- 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 ReviewHosts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const ReviewHosts = () => {
const {
hostId,
setHostIdsParam,
defaultFailedHostsSearch,
- 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 Finish
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const Finish = ({ onClose }) => {
const {
fixes,
snippet,
isRebootSelected,
- 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 no_mixed_deployments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def no_mixed_deployments
assets.each do |asset|
assetable = asset.assetable
next unless assetable
unless assetable.policies.where.not(:id => id).pluck(:deploy_by).all? { |deployed_by| deployed_by == deploy_by }
- 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 migrate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def migrate
ForemanOpenscap::Asset.where(:assetable_type => "Host::Base").select { |a| a.host.nil? }.map(&:destroy)
ForemanOpenscap::Asset.where(:assetable_type => "Hostgroup").select { |a| a.hostgroup.nil? }.map(&:destroy)
old_arf_reports = ActiveRecord::Migration.execute("SELECT * FROM foreman_openscap_arf_reports;")
- 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 method. Open
return false
Avoid too many return
statements within this function. Open
return <Component {...rest} {...renameData(data)} />;
Avoid too many return
statements within this method. Open
return false
Function SnippetSelect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const SnippetSelect = () => {
const {
fixes,
snippet,
setSnippet,
- 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_client_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_client_params(model_match, config)
client_item = config.find_config_item self.public_send(config.all_collection_method)
return unless client_item
lookup_keys = client_item.public_send(config.override_method_name)
server_key = lookup_keys.find { |param| param.key == config.server_param }
- 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 references_links
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.references_links(references)
return if references.nil?
html_links = []
references.each do |reference|
next if reference['title'] == 'test_attestation' # A blank url created by OpenSCAP
- 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"