Showing 2,015 of 18,390 total issues
Avoid deeply nested control flow statements. Open
if (rule.host_protocol === undefined) {
rule.host_protocol = null;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (rule.source_security_group_id === undefined || rule.source_security_group_id === null) {
rule.source_security_group_id = null;
} else {
rule.source_ip_range = '';
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (rule.network_protocol === undefined) {
rule.network_protocol = null;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (values.selectedItems[i].value !== 'all') {
tempItems.push(values.selectedItems[i]);
}
- Create a ticketCreate a ticket
Function setDiskFormSubmit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const setDiskFormSubmit = (data, setData, formData, roles, renderData) => {
const dataTableData = data.dataTable.disks || [];
if (data.form.action === 'add') {
// code for add
const id = `disk${dataTableData.length}`;
- 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 HostInitiatorGroupForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const HostInitiatorGroupForm = ({ recordId, storageManagerId }) => {
const [state, setState] = useState({});
const { isLoading, initialValues } = state;
const submitLabel = !!recordId ? __('Save') : __('Add');
- 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 formatSetData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const formatSetData = (setData, buttonIcon, appliesToClass, appliesToId, groupIndex) => {
if (appliesToId) {
return ({
...setData,
button_color: (setData && setData.button_color) ? setData.button_color : '#000',
- 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 getInitialValues
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getInitialValues = (ownershipItems) => new Promise((resolve) => {
if (ownershipItems.length > 1) {
resolve({ group: 'dont-change', user: 'dont-change' });
} else if (ownershipItems.length === 1) {
const item = ownershipItems[0];
- 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 prepareRequestObject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const prepareRequestObject = (values, formId) => {
const requestObject = { ...values };
// if price property is not there add price property if its present convert the value into string
if (!Object.prototype.hasOwnProperty.call(requestObject, 'price')) {
- 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 createSchema
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const createSchema = (state, setState, ems, initialValues, storageId, setStorageId) => {
let emsId = state.ems_id;
if (initialValues && initialValues.ems_id) {
emsId = initialValues.ems_id;
}
- 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 notificationReducer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const notificationReducer = (state = notificationInitialState, action) => {
switch (action.type) {
case INIT_NOTIFICATIONS:
return {
...state,
- 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 dataHelper
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const dataHelper = (values, timeProfileId, action, userid) => {
let data = {};
let APIaction = 'edit';
let metrics = values.rollup_daily_metrics;
let profileType = values.profile_type;
- 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 model
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const model = (isLoading, widgetId, widgetModel, widgetType) => {
let widget;
if (isLoading) {
widget = (
<div className="loadingSpinner">
- 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_fields_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def chart_fields_options
chart_data_columns = if @edit[:new][:group] != 'No'
groupings = @edit[:new][:col_options].find_all do |_field, col_options|
col_options[:grouping].present? && !col_options[:grouping].empty?
end
- 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 update_from_miq_schedule
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_from_miq_schedule(run_at, timezone)
self.typ = run_at[:interval][:unit].titleize
self.months = run_at[:interval][:value] if run_at[:interval][:unit] == 'monthly'
self.weeks = run_at[:interval][:value] if run_at[:interval][:unit] == 'weekly'
self.days = run_at[:interval][:value] if run_at[:interval][:unit] == 'daily'
- 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 PxeCustomizationTemplateForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const PxeCustomizationTemplateForm = ({ recordId, copy }) => {
const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!recordId });
const submitLabel = !!recordId ? __('Save') : __('Add');
const disableSubmit = copy && copy !== recordId ? ['invalid'] : ['pristine'];
- 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 select_by_roles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def select_by_roles(record)
if record.instance_of?(ServerRole)
data = {:mode => "selected_server_by_role_details"}
rows = [{:cells => [{:icon => "ff ff-user-role settings-icn"}]},
row_data(_('Role'), record.description)]
- 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 TenantQuotaForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const TenantQuotaForm = ({ recordId }) => {
const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!recordId });
const [enforced, setEnforced] = useState({});
const [values, setValues] = useState({});
const [disabled, setDisabled] = useState(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
Function subscribeToSubject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const subscribeToSubject = (dispatch) =>
listenToRx(
(event) => {
if (event.toolbarEvent && (event.toolbarEvent === 'itemClicked')) {
// TODO
- 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 widget_timer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def widget_timer(schedule, timezone, sb_data)
if sb_data[:wtype] == "m"
data = {:title => _('Timer'), :mode => "miq_widget_timer"}
rows = []
- 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"