Showing 722 of 1,271 total issues
Function computeResourceSelected
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function computeResourceSelected(item) {
providerSpecificNICInfo = null;
var compute = $(item).val();
if (compute == '' && /compute_resource/.test($(item).attr('name'))) {
//Bare metal compute resource
- 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 ProvisioningCard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const ProvisioningCard = ({ status, hostDetails }) => {
const {
initiated_at: initiatedAt,
installed_at: installedAt,
token,
- 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 logReduxToConsole
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const logReduxToConsole = () => {
const isProduction = process.env.NODE_ENV === 'production';
const isLogger = process.env.REDUX_LOGGER;
if (!isProduction && !global.__testing__) {
- 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 TokenLifeTime
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const TokenLifeTime = ({ value, onChange, handleInvalidField, isLoading }) => {
const minValue = 1;
const maxValue = 999999;
const isValid = v => {
- 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 HostPowerStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const HostPowerStatus = ({ hostName }) => {
const key = `HOST_POWER_STATUS_${hostName}`;
const existingResponse = useSelector(state => selectAPIResponse(state, key));
const useExistingResponse = !!existingResponse.state;
const response = useAPI(
- 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 PersonalAccessToken
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const PersonalAccessToken = ({
revokePersonalAccessToken,
id,
name,
created_at: createdAt,
- 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 useTableSort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const useTableSort = ({
allColumns,
columnsToSortParams,
initialSortColumnName,
onSort: _onSort,
- 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 taxed_and_untaxed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def taxed_and_untaxed
clauses = []
if filter_taxonomy?(Organization)
clauses << org_join_arel[:taxonomy_id].in(user_taxonomy_ids(Organization))
end
- 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 sortableHeaderFormatter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const sortableHeaderFormatter = sortController => (label, { property }) => {
const isSorter = property === sortController.property;
const currentOrder = isSorter ? sortController.order : '';
const nextOrder = currentOrder === 'ASC' ? 'DESC' : 'ASC';
- 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 to_export
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_export(include_blank = true)
return unless self.class.exportable_attributes.present?
self.class.exportable_attributes.keys.inject({}) do |hash, attribute|
value = export_attr(self.class.exportable_attributes[attribute], include_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 fix_auditable_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fix_auditable_type
# STI Host class should use the stub module instead of Host::Base
self.auditable_type = "Host::Base" if auditable_type =~ /^(::)?Host::/
self.associated_type = "Host::Base" if associated_type =~ /^(::)?Host::/
self.auditable_type = auditable.type if ["Taxonomy", "LookupKey"].include?(auditable_type) && auditable
- 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 EmptyStatePattern
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const EmptyStatePattern = props => {
const {
documentation,
action,
secondaryActions,
- 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 queue_external_ipam_destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def queue_external_ipam_destroy
return unless (external_ipam?(subnet) || external_ipam?(subnet6)) && errors.empty?
logger.debug "Removing IP reservation(s) in external IPAM for #{self}"
queue.create(id: generate_external_ipam_task_id("remove", "IPv4"), name: _("Removing IPv4 in External IPAM for %s") % self, priority: 5, action: [self, :set_remove_external_ip, {:ip => ip, :subnet => subnet}]) if requires_delete? && external_ipam?(subnet)
queue.create(id: generate_external_ipam_task_id("remove", "IPv6"), name: _("Removing IPv6 in External IPAM for %s") % self, priority: 5, action: [self, :set_remove_external_ip, {:ip => ip6, :subnet => subnet6}]) if requires_delete6? && external_ipam?(subnet6)
- 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 log_audit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def log_audit
telemetry_increment_counter(:audit_records_created, 1, type: auditable_type)
audit_logger = Foreman::Logging.logger('audit')
return unless (audited_changes && audit_logger.info?)
audited_changes.each_pair do |attribute, 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_add_external_ip
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_add_external_ip(params)
ip, subnet = params[:ip], params[:subnet]
if ip_is_available?(ip, subnet)
subnet.external_ipam_proxy.add_ip_to_subnet(ip, subnet.network_address, subnet.externalipam_group)
- 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 current=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current=(location)
unless location.nil? || location.is_a?(self) || location.is_a?(Array)
raise(ArgumentError, "Unable to set current location, expected class '#{self}'. got #{location.inspect}")
end
- 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 load
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load(record)
raise TypeError, "#{model} loader can't load association for #{record.class}" unless record.is_a?(model)
if association_loaded?(record) && (!base_scope || base_scope.empty_scope?)
Promise.resolve(record.public_send(association_name))
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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute(opts = {})
obj, met, param = opts[:action]
rollback = opts[:rollback] || false
# at the moment, rollback are expected to replace set with del in the method name
if rollback
- 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 save_object
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_object(resource)
User.as(context[:current_user]) do
errors = if resource.save
[]
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 current=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current=(organization)
unless organization.nil? || organization.is_a?(self) || organization.is_a?(Array)
raise(ArgumentError, "Unable to set current organization, expected class '#{self}', got #{organization.inspect}")
end
- 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"