ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Function PerformanceChartWidget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const PerformanceChartWidget = ({
  // eslint-disable-next-line no-unused-vars
  data, id, size, title,
}) => {
  let convertedData = getLineConvertedData(data);
Severity: Minor
Found in app/javascript/components/performance-charts/index.jsx - About 25 mins 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_availability_zone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def textual_availability_zone
    return nil unless @record.kind_of?(ManageIQ::Providers::Openstack::InfraManager::Host)

    availability_zone = @record.availability_zone
    h = {:label => _('Availability Zone'),
Severity: Minor
Found in app/helpers/host_helper/textual_summary.rb - About 25 mins 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 hide_button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def hide_button(button, opt)
    if opt == "on"
      button ? '' : 'display:none'
    else
      button ? 'display:none' : ''
Severity: Minor
Found in app/helpers/ops_helper.rb - About 25 mins 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 TreeViewBase has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const TreeViewBase = ({
  actionMapper: overrideActionMapper,
  loadData,
  lazyLoadData,
  isMulti,
Severity: Minor
Found in app/javascript/components/tree-view/base.jsx - About 25 mins 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 KebabListItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const KebabListItem = (item, props) => {
  if (item.type === 'separator') {
    return <SideNavDivider key={item.id} />;
  }

Severity: Minor
Found in app/javascript/components/toolbar/ToolbarKebab.jsx - About 25 mins 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_condition_expression has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_summary_condition_expression(expression_table)
    rows = []
    data = {:title => _('Expression'), :mode => "miq_condition_expression"}
    if !expression_table.nil?
      expression_table.each do |token|
Severity: Minor
Found in app/helpers/condition_helper.rb - About 25 mins 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 TreeViewField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const TreeViewField = ({
  loadData, lazyLoadData, validateOnMount, helperText, identifier, ...props
}) => {
  const {
    labelText,
Severity: Minor
Found in app/javascript/components/tree-view/field.jsx - About 25 mins 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 MenuSearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MenuSearch = ({
  expanded, menu, onSearch, toggle,
}) => {
  if (!expanded) {
    return (
Severity: Minor
Found in app/javascript/menu/search.jsx - About 25 mins 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_reports_menu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_reports_menu(hide_custom = false, group = current_group)
    reports = group.try(:settings).try(:[], :report_menus) || default_reports_menu
    unless hide_custom
      # Select all custom reports
      query = {:template_type => 'report', :rpt_type => 'Custom'}
Severity: Minor
Found in app/helpers/report_helper.rb - About 25 mins 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 report_widget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def report_widget(widget_nodes)
    data = {:title => _('Widgets'), :mode => "miq_report_widgets bordered-list simple_table", :rows => []}
    if widget_nodes.blank?
      data[:message] = _("Report doesn't belong to Widgets.")
    else
Severity: Minor
Found in app/helpers/report_helper/report_information_helper.rb - About 25 mins 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 onViewClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const onViewClick = (button) => {
  if (button.url && (button.url.indexOf('/') === 0)) {
    const delimiter = (button.url === '/') ? '' : '/';
    const tail = (ManageIQ.record.recordId) ? delimiter + ManageIQ.record.recordId : '';

Severity: Minor
Found in app/javascript/components/miq-toolbar.jsx - About 25 mins 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 dateRangeValidator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const dateRangeValidator = (validatorSchema) => (value, allValues) => {
  if (allValues.startDate && allValues.endDate) {
    if (allValues.startDate[0] > allValues.endDate[0]) {
      return __(`Start Date must come before End Date`);
    }
Severity: Minor
Found in app/javascript/forms/mappers/validatorMapper.jsx - About 25 mins 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_condition_scope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_summary_condition_scope(applies_to_exp_table)
    rows = []
    data = {:title => _('Scope'), :mode => "miq_condition_scope"}
    if !applies_to_exp_table.nil?
      applies_to_exp_table.each do |token|
Severity: Minor
Found in app/helpers/condition_helper.rb - About 25 mins 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 common_list_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def common_list_data(details_data)
    details_data.each do |record|
      next if record.name == '$'

      cells = []
Severity: Minor
Found in app/helpers/miq_ae_class_helper.rb - About 25 mins 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_analysis_profile_summary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def settings_analysis_profile_summary(selected_scan, categories, files, file_stats, registry, nteventlog)
    summary = [settings_analysis_basic_info(selected_scan)]
    summary.push(settings_analysis_categories(categories)) if categories && selected_scan.mode != "Host"
    summary.push(settings_analysis_files(files, file_stats)) if files
    summary.push(settings_analysis_registry_items(registry)) if registry && selected_scan.mode != "Host"
Severity: Minor
Found in app/helpers/settings_analysis_profile_helper.rb - About 25 mins 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 catalog_tab_configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def catalog_tab_configuration(record)
    condition = catalog_tab_conditions(record)
    tab_labels = [:basic]
    tab_labels.push(:detail) if condition[:detail]

Severity: Minor
Found in app/helpers/catalog_helper.rb - About 25 mins 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_device has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def textual_device
    device = @record.device
    if device.kind_of?(VmOrTemplate)
      instance = @record.device
      h        = nil
Severity: Minor
Found in app/helpers/network_port_helper/textual_summary.rb - About 25 mins 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 disabled? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def disabled?
    super
    @error_message ||= _("Unable to refresh the provider while it is suspended") unless @record.enabled?
    @error_message ||= _("Credentials must be valid to refresh a provider") unless @record.authentication_status.downcase == "valid"
    @error_message.present?
Severity: Minor
Found in app/helpers/application_helper/button/ems_refresh.rb - About 25 mins 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 catalog_tab_conditions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def catalog_tab_conditions(record)
    {
      :detail     => record.display && !record.prov_type.try(:start_with?, "generic_"),
      :resource   => record.composite?,
      :request    => !record.prov_type || (record.prov_type && need_prov_dialogs?(record.prov_type)),
Severity: Minor
Found in app/helpers/catalog_helper.rb - About 25 mins 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 disabled? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def disabled?
    @error_message = if @record.class == AssignedServerRole
                       if @record.active
                         _("This Role is already active on this Server")
                       elsif !@record.miq_server.started?
Severity: Minor
Found in app/helpers/application_helper/button/role_start.rb - About 25 mins 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