ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method quota has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def quota
    @project.container_quota_items.collect do |quota_item|
      enforced = quota_item.quota_enforced
      observed = quota_item.quota_observed
      enforced = (enforced % 1).zero? ? enforced.to_i : enforced
Severity: Minor
Found in app/services/container_project_dashboard_service.rb - About 55 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 servers_group has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def servers_group
    # Get recent Servers
    all_servers = Hash.new(0)
    servers_with_host = Hash.new(0)
    valid_servers = Hash.new(0)
Severity: Minor
Found in app/services/ems_physical_infra_dashboard_service.rb - About 55 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 merge_sections has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_sections(sections)
      sections.each do |section|
        position = nil

        parent = if section.parent_id && @id_to_section.key?(section.parent_id)
Severity: Minor
Found in app/presenters/menu/manager.rb - About 55 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 x_get_tree_roots has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def x_get_tree_roots
    obj = if @assign_to.blank? || @assign_to == "enterprise"
            []
          elsif @cat_tree
            @cat ? Classification.find(@cat).entries : []
Severity: Minor
Found in app/presenters/tree_builder_alert_profile_obj.rb - About 55 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 miqBuildChartMenu has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

window.miqBuildChartMenu = function(col, row, _value, category, series, id, _message) {
Severity: Major
Found in app/javascript/oldjs/miq_application.js - About 50 mins to fix

Function miqBuildChartMenuEx has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

window.miqBuildChartMenuEx = function(col, row, _value, category, series, chart_set, chart_index) {
Severity: Major
Found in app/javascript/oldjs/miq_application.js - About 50 mins to fix

Function miqChartLinkData has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

window.miqChartLinkData = function(col, row, value, category, series, id, message) {
Severity: Major
Found in app/javascript/oldjs/miq_application.js - About 50 mins to fix

Function createSchema has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function createSchema(fieldss, recordId, emsId, mode, loadSchema, alertState, alertOptions) {

Method _build_whatever_grid has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def _build_whatever_grid(what, list, headers, sort_order, sort_by, integer_fields = [], state = @edit)
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 50 mins to fix

Function chartData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

window.chartData = function(type, data, data2) {
  if (type === undefined) {
    return emptyChart();
  }

Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 45 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

Avoid deeply nested control flow statements.
Open

          if (rule.end_port === undefined) {
            rule.end_port = null;
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

Function reportSortDirection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const reportSortDirection = (sortKey, sortingColumns) => {
  if (sortingColumns && sortingColumns[sortKey]) {
    const { direction } = sortingColumns[sortKey];
    if (direction === ReportSortDirections.DEFAULT) return ReportSortDirections.DESC;
    if (direction === ReportSortDirections.ASC) return ReportSortDirections.DESC;
Severity: Minor
Found in app/javascript/components/data-tables/report-data-table/helper.js - About 45 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 dataHelper has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const dataHelper = (values) => {
  const vd = values.description;
  const vt = values.action_type;
  const optionValue = values.options ? values.options : {};
  delete values.action_type;
Severity: Minor
Found in app/javascript/components/action-form/helper.js - About 45 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 validateMinMax has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

window.validateMinMax = function(min, max, minShowed, maxShowed) {
  var invalid = false;
  // if there are no valid values or there is only single values big enough, then not change formating function
  if (max <= min || maxShowed < minShowed) {
    if (max < min || max > 10) {
Severity: Minor
Found in app/javascript/oldjs/miq_c3.js - About 45 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

Avoid deeply nested control flow statements.
Open

          if (rule.port === undefined) {
            rule.port = null;
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

Function miqBuildChartMenuEx has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

window.miqBuildChartMenuEx = function(col, row, _value, category, series, chart_set, chart_index) {
  const chart_data = ManageIQ.charts.chartData[chart_set];
  const chart_el = $(`#miq_chart_parent_${chart_set}_${chart_index}`);
  const chartmenu_el = $(`#miq_chartmenu_${chart_set}_${chart_index}`);
  chartmenu_el.empty();
Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 45 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

Avoid deeply nested control flow statements.
Open

          if (rule.direction === undefined) {
            rule.direction = null;
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (rule.source_ip_range === undefined) {
            rule.source_ip_range = null;
          }
Severity: Major
Found in app/javascript/components/network-security-groups-form/helper.js - About 45 mins to fix

Function customJsAction has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const customJsAction = ({ action }) => {
  switch (action.name) {
    case 'miqTreeActivateNode':
      if (action.nodeTree && action.nodeKey) {
        window.miqTreeActivateNode(action.nodeTree, action.nodeKey);
Severity: Minor
Found in app/javascript/helpers/custom-click-handler.js - About 45 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 add_flash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

window.add_flash = function(msg, level, options) {
  level = level || 'success';
  options = options || {};
  var cls = { alert: '', icon: '' };

Severity: Minor
Found in app/javascript/oldjs/miq_flash.js - About 45 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