Showing 18,390 of 18,390 total issues
Function ActionForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ActionForm = ({
recordId, inheritTags, availableAlerts, tags, ansibleInventory, snapshotAge, parentType, inventoryType,
}) => {
const [{ initialValues, isLoading }, setState] = useState({
isLoading: !!recordId,
- Read upRead up
- Create a ticketCreate a ticket
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 PolicyProfileForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const PolicyProfileForm = ({ recordId }) => {
const [{ isLoading, options, initialValues }, setState] = useState({ isLoading: !!recordId });
const addDescription = (string1, string2) => `${string1} : ${string2}`;
useEffect(() => {
- Read upRead up
- Create a ticketCreate a ticket
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 HostEditForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const HostEditForm = ({ ids }) => {
const [{
initialValues, isLoading, fields,
}, setState] = useState({
isLoading: (ids.length <= 1),
- Read upRead up
- Create a ticketCreate a ticket
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 ReportChartWidget
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ReportChartWidget = ({ data, id }) => {
if (data.miqChart === 'Area') {
return (<AreaChartGraph data={sampleData} />);
}
if (data.miqChart === 'Bar') {
- Read upRead up
- Create a ticketCreate a ticket
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 TreeViewSelector
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const TreeViewSelector = ({
loadData,
lazyLoadData,
identifier,
isClearable,
- Read upRead up
- Create a ticketCreate a ticket
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 AddRemoveSecurityGroupForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const AddRemoveSecurityGroupForm = ({
recordId, redirectURL, isAdd,
}) => {
const [{
isLoading, securityGroups,
- Read upRead up
- Create a ticketCreate a ticket
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 miq_accordion_panel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def miq_accordion_panel(title, condition, id, &block)
id = valid_html_id(id)
control_id = "control_#{id}"
content_tag(:div, :class => "panel panel-default") do
out = content_tag(:div, :class => "panel-heading", 'role' => 'tab', 'tabindex' => 0, :id => control_id) do
- Read upRead up
- Create a ticketCreate a ticket
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 sanitize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const sanitize = function(data) {
if (isPlainObject(data) && (data.error || data.message)) {
return (data.error || '').toString() + ' ' + (data.message || '').toString();
}
- Read upRead up
- Create a ticketCreate a ticket
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 WorkflowEntryPoints
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const WorkflowEntryPoints = ({ field, selected, type }) => {
const [data, setData] = useState({
isLoading: true, list: {}, selectedItemId: selected,
});
- Read upRead up
- Create a ticketCreate a ticket
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 miq_summary_policy_set_notes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def miq_summary_policy_set_notes(record)
data = {:title => _("Notes"), :mode => "miq_policy_set_notes"}
rows = []
if record.set_data.present? && (record.set_data[:notes] || record.set_data["notes"])
if record.set_data[:notes].blank? && record.set_data["notes"].blank?
- Read upRead up
- Create a ticketCreate a ticket
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 visibility
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def visibility(custom_button, sb_items)
show_to = custom_button.visibility.nil? || (custom_button.visibility && custom_button.visibility[:roles] && custom_button.visibility[:roles][0] == "_ALL_") ? _("To All") : _("By Role")
data = {
:title => _('Visibility'),
:mode => _('visibility'),
- Read upRead up
- Create a ticketCreate a ticket
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 check_smart_roles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_smart_roles
my_zone = MiqServer.my_server.my_zone
MiqServer::ServerSmartProxy::SMART_ROLES.each do |role|
next if MiqServer.all.any? do |s|
s.has_active_role?(role) &&
- Read upRead up
- Create a ticketCreate a ticket
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 expand_textual_summary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def expand_textual_summary(summary, context)
case summary
when Hash
summary
when Symbol
- Read upRead up
- Create a ticketCreate a ticket
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 human_size_to_rails_method
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def human_size_to_rails_method(size)
s = size.dup
if size.ends_with?(" Byte")
s[-5..-1] = ""
elsif size.ends_with?(" Bytes")
- Read upRead up
- Create a ticketCreate a ticket
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 mhz_to_human_size
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mhz_to_human_size(size, *args)
precision = args.first
precision = precision[:precision] if precision.kind_of?(Hash)
precision ||= 1
- Read upRead up
- Create a ticketCreate a ticket
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 company_category_rows
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def company_category_rows(categories)
categories.map do |category|
{
:id => category[:id].to_s,
:clickable => true,
- Read upRead up
- Create a ticketCreate a ticket
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 display_selected
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def display_selected(chart_click_data, ts, data_row, bc_model)
dt = @perf_options[:typ] == "Hourly" ? "on #{ts.to_date} at #{ts.strftime("%H:%M:%S %Z")}" : "on #{ts.to_date}"
state = chart_click_data.type == "on" ? _("running") : _("stopped")
if data_row["assoc_ids"][chart_click_data.model.downcase.to_sym][chart_click_data.type.to_sym].blank?
message = _("No %{model} were %{state} %{time}") % {:model => chart_click_data.model, :state => state, :time => dt}
- Read upRead up
- Create a ticketCreate a ticket
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 object_types_for_flash_message
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def object_types_for_flash_message(klass, record_ids)
if klass == VmOrTemplate
object_ary = klass.where(:id => record_ids).collect { |rec| ui_lookup(:model => model_for_vm(rec).to_s) }
obj_hash = object_ary.each.with_object(Hash.new(0)) { |obj, h| h[obj] += 1 }
obj_hash.collect { |k, v| v == 1 ? k : k.pluralize }.sort.to_sentence
- Read upRead up
- Create a ticketCreate a ticket
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 chart_current_daily
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def chart_current_daily
@record = identify_tl_or_perf_record
@perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record
@perf_options[:typ] = "Daily"
perf_set_or_fix_dates(false) unless params[:task_id] # Set dates if first time thru
- Read upRead up
- Create a ticketCreate a ticket
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 chart_selected
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def chart_selected(chart_click_data, data_row, ts)
@record = find_record_with_rbac(data_row["resource_type"].constantize, data_row["resource_id"])
return [true, nil] unless @record
# Set the perf options in the selected controller's sandbox
- Read upRead up
- Create a ticketCreate a ticket
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"