ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Function UtilizationChartGraph has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const UtilizationChartGraph = ({
  providerId, title, cpuConfig, memoryConfig, dashboard,
}) => {
  const [data, setCardData] = useState({ loading: true });

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

const getItemIcon = (item) => {
  if (item.FinishedTime) {
    if (item.Output && item.Output.Error) {
      if (item.RetryCount) {
        return { icon: 'carbon--RetryFailed' }
Severity: Minor
Found in app/javascript/components/request-workflow-status/data.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 toBytes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const toBytes = (value) => {
  if (!value) return undefined;

  if (typeof value !== 'number') {
    const sizeValue = value.match(/^\d+(\.\d+)*/)[0];
Severity: Minor
Found in app/javascript/components/workers-form/helpers.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 DataTable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const DataTable = ({
  rows,
  columns,
  inEditMode,
  noCheckboxes,
Severity: Minor
Found in app/javascript/components/data-tables/gtl/DataTable.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 deleteNetwork has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const deleteNetwork = (row, data, setData, roles) => {
  let dataTableData = data.dataTable.networkAdapters || [];
  let submitNetworks = data.submitParams.networks.add || [];
  let addNetworkIds = data.submitParams.networkIds.add || [];
  const deleteNetworksData = data.submitParams.networks.delete || [];
Severity: Minor
Found in app/javascript/components/reconfigure-vm-form/helpers/network.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 CustomButtonForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const CustomButtonForm = ({
  recId, url, appliesToClass, appliesToId, customButtonGroupId, distinctInstances, ansiblePlaybooks,
}) => {
  const [{
    isLoading, initialValues, buttonIcon, roles, serviceDialogs,

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

export const setNetworkFormSubmit = (data, setData, formData, roles, renderData) => {
  if (data.form.action === 'add') {
    // code for add function
    const id = `network${data.dataTable.networkAdapters.length}`;
    const networkData = {
Severity: Minor
Found in app/javascript/components/reconfigure-vm-form/helpers/network.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 ToolbarList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const ToolbarList = (props) => {
  const count = useContext(CountContext);
  const { items, title, id } = props;
  // Set this true for overflowmenu keydown event
  const [overflowTab, setOverflowTab] = useState(false);
Severity: Minor
Found in app/javascript/components/toolbar/ToolbarList.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 MiqAeCustomization has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const MiqAeCustomization = ({ dialogRecord, dialogTypes }) => {
  const [data, setData] = useState({
    isLoading: true,
    initialValues: undefined,
  });
Severity: Minor
Found in app/javascript/components/miq-ae-customization/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 PxeServersForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const PxeServersForm = ({ id }) => {
  const [initialValues, setInitialValues] = useState({});
  const [isLoading, setIsLoading] = useState(!!id);

  useEffect(() => {
Severity: Minor
Found in app/javascript/components/pxe-servers-form/pxe-server-form.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 update_from_hash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def update_from_hash(params)
      %w[typ moths weeks days hours].each do |i|
        self[i] = params[:"timer_#{i}"] if params[:"timer_#{i}"]
      end
      %w[start_hour start_min].each do |i|
Severity: Minor
Found in app/helpers/report_helper/timer.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_compliance_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def textual_compliance_status
    h = {:label => _("Status")}
    if @record.number_of(:compliances).zero?
      h[:value] = _("Never Verified")
    else
Severity: Minor
Found in app/helpers/compliance_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 multiple_relationship_link has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def multiple_relationship_link(record, table_name)
      return unless role_allows?(:feature => "#{table_name}_show_list")
      return if table_name == 'container_route' && !record.respond_to?(:container_routes)

      plural = ui_lookup(:tables => table_name.to_s)
Severity: Minor
Found in app/helpers/application_helper/listnav.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 ns_list_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def ns_list_data(grid_data)
    has_options = User.current_user.super_admin_user?
    datastore_options(has_options)
    grid_data.each do |record|
      next if record.name == '$'
Severity: Minor
Found in app/helpers/miq_ae_class_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 visible? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def visible?
    # TODO: @feature.nil? || @record.nil? || @record.supports?(@feature)
    # TODO: ensure start stop are supported in openstack
    unless @feature.nil? || @record.nil?
      if @record.kind_of?(ManageIQ::Providers::Openstack::InfraManager)
Severity: Minor
Found in app/helpers/application_helper/button/host_feature_button.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 process_resourcepools has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def process_resourcepools(rps, task)
    rps, _rps_out_region = filter_ids_in_region(rps, "Resource Pool")
    return if rps.empty?

    if task == "destroy"
Severity: Minor
Found in app/controllers/application_controller/ci_processing.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 miq_summary_alert_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_summary_alert_info(alert, event, sb_data)
    rows = []
    data = {:title => _('Info'), :mode => "miq_alert_info", :rows => []}
    rows.push({:cells => {:label => _("Description"), :value => alert.description}})
    rows.push({:cells => {:label => _("Active"), :value => alert.enabled ? _("Yes") : _("No")}})
Severity: Minor
Found in app/helpers/miq_alert_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 settings_users_basic_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def settings_users_basic_info(record)
    rows = [
      row_data(_('ID'), record.id),
      row_data(_('Full Name'), record.name),
      row_data(_('Username'), record.userid),
Severity: Minor
Found in app/helpers/settings_users_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 disks_attributes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def disks_attributes
      disks = []
      return disks if @record.hardware.disks.empty?

      # HDDs
Severity: Minor
Found in app/helpers/textual_mixins/textual_devices.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 process_clusters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def process_clusters(clusters, task, _ = nil)
    clusters, _clusters_out_region = filter_ids_in_region(clusters, _("Cluster"))
    return if clusters.empty?

    if task == "destroy"
Severity: Minor
Found in app/controllers/application_controller/ci_processing.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