Showing 18,390 of 18,390 total issues
Method rbac_edit_save_or_add
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rbac_edit_save_or_add(what, rbac_suffix = what)
key = what.to_sym
id = params[:id] || "new"
add_pressed = params[:button] == "add"
- Create a ticketCreate a ticket
Method rsop
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rsop
assert_privileges('policy_simulation')
if params[:button] == "submit"
if params[:task_id] # First time thru, kick off the report generate task
miq_task = MiqTask.find(params[:task_id]) # Not first time, read the task record
- Create a ticketCreate a ticket
Method action_build_edit_screen
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action_build_edit_screen
@edit = {}
@edit[:new] = {}
@edit[:current] = {}
- Create a ticketCreate a ticket
Method widget_set_record_vars
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def widget_set_record_vars(widget)
widget.title = @edit[:new][:title]
widget.description = @edit[:new][:description]
widget.enabled = @edit[:new][:enabled]
widget.options ||= {}
- Create a ticketCreate a ticket
Method widget_edit
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def widget_edit
assert_privileges("widget_edit")
case params[:button]
when "cancel"
- Create a ticketCreate a ticket
Function miq_tabs_init
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
window.miq_tabs_init = function(id, url, parms) {
$(`${id} > ul.nav-tabs a[data-toggle="tab"]`).on('show.bs.tab', (e) => {
if ($(e.target).parent().hasClass('disabled')) {
e.preventDefault();
return false;
- 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 miqBrowserDetect
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
window.miqBrowserDetect = function() {
var BrowserDetect = {
init: function() {
this.browser = this.searchString(this.dataBrowser) || 'An unknown browser';
this.version = this.searchVersion(navigator.userAgent) ||
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
const createSchema = (credentials, credentialReferences, payloadCredentials, workflowAuthentications, setState) => {
// Saves a new credential mapping to 'credentials'
const mapCredentials = () => setState((state) => {
if (state.workflowCredentials && state.credentialField) {
return ({
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
const createSchema = (credentials, credentialReferences, payloadCredentials, workflowAuthentications, setState) => {
// Saves a new credential mapping to 'credentials'
const mapCredentials = () => setState((state) => {
if (state.workflowCredentials && state.credentialField) {
return ({
- 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 NotificationDrawer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const NotificationDrawer = ({ jsRequest }) => {
const dispatch = useDispatch();
const drawerTitle = __('Notifications');
const [isDrawerExpanded, setDrawerExpanded] = useState(false);
const {
- 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 NetworkSecurityGroupsForm
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const NetworkSecurityGroupsForm = ({ securityGroupId }) => {
const [{
initialValues, isLoading, fields, subnets,
}, setState] = useState({
isLoading: !!securityGroupId, fields: [], subnetSelect: [], subnets: [],
- 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 AnsiblePlayBookEditCatalogForm
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const AnsiblePlayBookEditCatalogForm = ({ initialData }) => {
const [data, setData] = useState({
isLoading: true,
formData: {},
currencies: [],
- 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 AttachDetachCloudVolumeForm
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const AttachDetachCloudVolumeForm = ({ recordId, isAttach, dropdownChoices, dropdownLabel }) => {
const [{ isLoading, fields }, setState] = useState({ isLoading: true, fields: [] });
const loadSchema = (appendState = {}) => ({ data: { form_schema: { fields } } }) => {
setState((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
Method report_schedule_summary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def report_schedule_summary(schedule, email_to, rep_filter, timezone)
data = {:title => _('Schedule Info'), :mode => "miq_report_schedule_info"}
rows = []
rows.push(row_data(_('Description'), schedule.description))
rows.push(row_data(_('Active'), _(schedule.enabled.to_s.capitalize)))
- 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 StorageServiceForm
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const StorageServiceForm = ({ recordId, storageManagerId }) => {
const [{ fields, initialValues, isLoading }, setState] = useState({
fields: [], isLoading: !!recordId || !!storageManagerId,
});
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 PhysicalStorageForm
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const PhysicalStorageForm = ({ recordId, storageManagerId }) => {
const [state, setState] = useState({});
const { isLoading, initialValues } = state;
const [familyId, setFamilyId] = useState(undefined);
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 render
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
render() {
const usedServicesMessage = (data) => {
let warningItems = [];
if (data.length === 1) { // We're deleting just one catalog item
const services = {};
- 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 delete_elements
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def delete_elements(model_class, destroy_method, model_name = nil)
model_name ||= model_class.table_name
elements = find_records_with_rbac(model_class, checked_or_params)
send(destroy_method, elements.ids, 'destroy')
if params[:miq_grid_checks].present? || @lastaction == "show_list" || (@lastaction == "show" && @layout != model_name.singularize) # showing a list
- 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 timeline_current
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def timeline_current(chart_click_data, ts)
@record = identify_tl_or_perf_record
@perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record
new_opts = tl_session_data(request.parameters["controller"]) || ApplicationController::Timelines::Options.new
new_opts[:model] = @perf_record.class.base_class.to_s
- 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 button_set_record_vars
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def button_set_record_vars(button)
button.name = @edit[:new][:name]
button.description = @edit[:new][:description]
button.applies_to_class = x_active_tree == :ab_tree ? @resolve[:target_class] : "ServiceTemplate"
button.applies_to_id = x_active_tree == :ab_tree ? nil : @sb[:applies_to_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"