ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

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

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

const ValidateStorageCredentials = ({ ...props }) => {
  const { storageId } = useContext(EditingContext);

  const asyncValidate = (fields, fieldNames) => new Promise((resolve, reject) => {
    const url = storageId ? `/api/physical_storages/${storageId}` : '/api/physical_storages';

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

  def layout_uses_listnav?
    return false if action_name == "show"
    return false if show_list_with_no_provider?

    return false if show_list_ansible?
Severity: Minor
Found in app/helpers/application_helper/page_layouts.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

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

  def create_custom_button(input, model, record)
    button_id = input[:id]
    button_name = input[:name].to_s
    record_id = if cb_send_checked_list
                  'LIST'
Severity: Minor
Found in app/helpers/application_helper/toolbar_builder.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

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

  def textual_object_link(object, as: nil, controller: nil, feature: nil, label: nil)
    return if object.nil?

    klass = as || ui_base_model(object.class)

Severity: Minor
Found in app/helpers/textual_summary_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

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

  def twostate_button_selected(id)
    return true if id.starts_with?("view_") && id.ends_with?("textual") # Summary view buttons
    return true if @ght_type && id.starts_with?("view_") && id.ends_with?(@ght_type)  # GHT view buttons on report show
    return true if id.starts_with?("compare_") && id.ends_with?(settings(:views, :compare).to_s)
    return true if id.starts_with?("drift_") && id.ends_with?(settings(:views, :drift).to_s)
Severity: Minor
Found in app/helpers/application_helper/toolbar_builder.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

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

  def settings_schedule_filter_details(schedule, exp_table)
    data = {
      :title => _('Filter'),
      :mode  => "settings_schedule_filter_details",
    }
Severity: Minor
Found in app/helpers/settings_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

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

  def perf_remove_report_cols(report, charts = nil)
    charts ||= @charts.first
    new_rpt = MiqReport.new(report.attributes) # Make a copy of the report
    new_rpt.table = Marshal.load(Marshal.dump(report.table))
    keepcols = []
Severity: Minor
Found in app/controllers/application_controller/performance.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

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

  def calculate_toolbars
    toolbars = {}
    if display_back_button? # taskbar branch
      toolbars['summary_center_tb'] = controller.restful? ? "summary_center_restful_tb" : "summary_center_tb"
    end
Severity: Minor
Found in app/helpers/application_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

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

  def comp_add_record_field_exists_compressed(idx, val, base_rec, field)
    if @exists_mode
      passed_img = "fa fa-check"
      failed_img = "fa fa-times"
    else
Severity: Minor
Found in app/controllers/application_controller/compare.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

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

  def get_data_size(data, indent = 0)
    begin
      # TODO: (FB 9144) Determine how the session store handles singleton object so it does not throw errors.
      data_size = Marshal.dump(data).size
    rescue StandardError => err
Severity: Minor
Found in app/controllers/application_controller/session_size.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