ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method change_tab has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def change_tab(new_tab_id = nil)
    assert_privileges(x_active_tree == :settings_tree ? "ops_settings" : "ops_diagnostics")

    @explorer = true
    params[:miq_grid_checks] = []
Severity: Minor
Found in app/controllers/ops_controller.rb - About 1 hr to fix

Method ab_button_save has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ab_button_save
    assert_privileges("ab_button_edit")
    @resolve = session[:resolve]
    attrs = {}
    @sb[:active_tab] = "ab_options_tab"
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 1 hr to fix

Method update_instance has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update_instance
    assert_privileges("miq_ae_instance_edit")
    return unless load_edit("aeinst_edit__#{params[:id]}", "replace_cell__explorer")

    get_instances_form_vars
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

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"

Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/miq_policy_rsop_controller.rb - About 1 hr to fix

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] = {}

Severity: Minor
Found in app/controllers/miq_action_controller.rb - About 1 hr to fix

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 ||= {}
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 hr to fix

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"
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 hr to fix

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;
Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 1 hr to fix

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) ||
Severity: Minor
Found in app/javascript/oldjs/miq_browser_detect.js - About 1 hr to fix

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 ({

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 ({

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 {

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: [],
Severity: Minor
Found in app/javascript/components/network-security-groups-form/index.jsx - About 1 hr to fix

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: [],

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) => ({

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)))
Severity: Minor
Found in app/helpers/report_helper/report_schedule_helper.rb - About 1 hr to fix

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');
Severity: Minor
Found in app/javascript/components/storage-service-form/index.jsx - About 1 hr to fix

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');
Severity: Minor
Found in app/javascript/components/physical-storage-form/index.jsx - About 1 hr to fix

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 = {};
Severity: Minor
Found in app/javascript/components/remove-catalog-item-modal.jsx - About 1 hr to fix

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

Severity
Category
Status
Source
Language