ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method miq_summary_rbac_details has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_summary_rbac_details(users, groups, roles, tenants)
    data = {:title => _("Access control"), :mode => "miq_access_control"}
    rows = []
    if role_allows?(:feature => "rbac_user_view", :any => true)
      rows.push({
Severity: Minor
Found in app/helpers/ops_helper.rb - About 1 hr to fix

Method center_toolbar_filename_pxe has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def center_toolbar_filename_pxe
    if x_active_tree == :pxe_servers_tree
      if x_node == "root"
        return "pxe_servers_center_tb"
      elsif x_node.split('-').first == "pi"
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 1 hr to fix

Method explorer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def explorer
    @explorer = true
    @trees = []
    return if perfmenu_click?

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

Method git_refresh has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def git_refresh
    @in_a_form = true
    @explorer = true

    session[:changed] = true
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method policy_edit_save has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def policy_edit_save
    assert_privileges("miq_policy_#{@policy.id ? "edit" : "new"}")
    policy = @policy.id.blank? ? MiqPolicy.new : MiqPolicy.find(@policy.id) # Get new or existing record
    policy.mode = @edit[:new][:mode]
    policy.updated_by = session[:userid]
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 1 hr to fix

Method ap_show has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ap_show
    # identify_scanitemset
    if @selected_scan.nil?
      flash_to_session(_("Error: Record no longer exists in the database"), :error)
      redirect_to(:action => 'show_list_set')
Severity: Minor
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 1 hr to fix

Method resizevms has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def resizevms
          case params[:pressed]
          when "instance_resize"
            assert_privileges("instance_resize")
          when "miq_request_edit"
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/resize.rb - About 1 hr to fix

Method set_form_vars has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_form_vars
    case @tabform
    when 'ui_1'
      @edit = {
        :current => {},
Severity: Minor
Found in app/controllers/configuration_controller.rb - About 1 hr to fix

Method get_form_vars has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_form_vars
    copy_params_if_present(@edit[:new], params, %i[st_prov_type name description provision_cost catalog_id dialog_id generic_subtype long_description zone_id price retire_fqname reconfigure_fqname fqname])

    @edit[:new][:display] = params[:display] == "1" if params[:display] # @edit[:new][:display] should't be changed if params[:display] is not set
    # saving it in @edit as well, to use it later because prov_set_form_vars resets @edit[:new]
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 1 hr to fix

Method import has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def import
    assert_privileges('policy_import_export')
    @breadcrumbs = []
    @layout = "miq_policy_export"
    @import_file_upload_id = params[:import_file_upload_id]
Severity: Minor
Found in app/controllers/miq_policy_export_controller.rb - About 1 hr to fix

Method alert_set_record_vars has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def alert_set_record_vars(alert)
    alert.description = @edit[:new][:description]
    alert.enabled = @edit[:new][:enabled]
    alert.severity = @edit[:new][:severity]
    alert.db = @edit[:new][:db]
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 1 hr to fix

Method show_list has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def show_list
    @breadcrumbs = []
    bc_name = _("Requests")
    @request_tab = params[:typ] if params[:typ] # set this to be used to identify which Requests subtab was clicked
    @layout = layout_from_tab_name(@request_tab)
Severity: Minor
Found in app/controllers/miq_request_controller.rb - About 1 hr to fix

Method prov_continue has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def prov_continue
    assert_privileges("miq_request_edit")
    if params[:button] == "continue" # Continue the request from the workflow with the new options
      id = params[:id] || "new"
      return unless load_edit("prov_edit__#{id}", "show_list")
Severity: Minor
Found in app/controllers/miq_request_controller.rb - About 1 hr to fix

Method attributes_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def attributes_data
    attributes = %i[cloud_object_store_containers miq_templates vms security_groups cloud_networks cloud_subnets network_ports cloud_volumes]

    attr_icon = {
      :cloud_object_store_containers => 'ff ff-cloud-object-store',
Severity: Minor
Found in app/services/cloud_tenant_dashboard_service.rb - About 1 hr to fix

Method attributes_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def attributes_data
    attributes = %i[flavors cloud_tenants miq_templates vms availability_zones security_groups cloud_networks cloud_volumes]

    attr_icon = {
      :flavors            => "pficon pficon-flavor",
Severity: Minor
Found in app/services/ems_cloud_dashboard_service.rb - About 1 hr to fix

Function newInstance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function newInstance(name, initialProps = {}, mountTo = undefined) {
  // clean all left over components
  cleanVirtualDom();
  // validate inputs
  const definition = getDefinition(name);
Severity: Minor
Found in app/javascript/miq-component/registry.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 MiqCustomTab has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const MiqCustomTab = ({ containerId, tabLabels, type }) => {
  const dispatch = useDispatch();
  const [data, setData] = useState({ loading: false });

  /** Labels used for a Tab found from the 'type'. */
Severity: Minor
Found in app/javascript/components/miq-custom-tab/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 WidgetWrapper has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const WidgetWrapper = ({
  widgetId, widgetType, widgetButtons, widgetLastRun, widgetNextRun, widgetTitle,
}) => {
  const [{
    widgetModel, href, isLoading, showConfirm, error,

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 TerraformTemplateCatalogForm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const TerraformTemplateCatalogForm = ({ initialData }) => {
  const [data, setData] = useState({
    isLoading: true,
    formData: {},
    currencies: [],
Severity: Minor
Found in app/javascript/components/terraform-template-catalog-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

Method select_by_servers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def select_by_servers(record)
    if record.instance_of?(MiqServer)
      select_server_details(record)
    else
      data = {:mode => "selected_server_role_details"}
Severity: Minor
Found in app/helpers/ops_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

Severity
Category
Status
Source
Language