ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method condition_build_edit_screen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def condition_build_edit_screen
    @edit = {}
    @edit[:new] = {}
    @edit[:current] = {}

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

Method post_check has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def post_check(tree)
    stack = tree.map(&:itself)
    nodes = []
    parents = []

Severity: Minor
Found in app/presenters/tree_builder.rb - About 1 hr to fix

Function aeMethodFormController has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

function aeMethodFormController($http, $scope, aeMethodFormId, currentRegion, miqService, playbookReusableCodeMixin, location, API) {
Severity: Major
Found in app/javascript/angular/miq_ae_class/ae_method_form_controller.js - About 1 hr to fix

Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(typ = nil, months = 1, weeks = 1, days = 1, hours = 1, start_date = nil, start_hour = '00',
                   start_min = '00')
Severity: Major
Found in app/helpers/report_helper/timer.rb - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if @edit && @edit[:expression] &&
       (default_search?(search.name) && expression_selected_nil_or_id(search.id) ||
        (@edit[:expression][:selected].nil? && search.id.to_i.zero? ||
         expression_selected_id_or_name(:name, search.name)))
      'active'
Severity: Major
Found in app/helpers/application_helper.rb - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    unless session[:view] && # A view exists and
           session[:view].db.downcase == dbname && # the DB matches and
           params[:refresh] != "y" && # refresh not being forced and
           (
             params[:ppsetting] || params[:page] || # changed paging or
Severity: Major
Found in app/controllers/application_controller.rb - About 1 hr to fix

Function miqSparkleOn has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

window.miqSparkleOn = function() {
  if (miqDomElementExists('advsearchModal')
      && ($('#advsearchModal').hasClass('modal fade in'))) {
    if (miqDomElementExists('searching_spinner_center')) {
      miqSearchSpinner(true);
Severity: Minor
Found in app/javascript/oldjs/miq_application.js - 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 setVisibility has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

ManageIQ.explorer.setVisibility = function(data) {
  if (_.isObject(data.setVisibility)) {
    _.forEach(data.setVisibility, function(visible, element) {
      if ( miqDomElementExists(element) ) {
        if ( visible ) {
Severity: Minor
Found in app/javascript/oldjs/miq_explorer.js - 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 miqMenuChangeRow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

window.miqMenuChangeRow = function(action, elem) {
  var grid = $('#folder_grid .panel-group');
  var selected = grid.find('.panel-heading.active').parent();

  switch (action) {
Severity: Minor
Found in app/javascript/oldjs/miq_tree.js - 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 recalculatePrecision has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

window.recalculatePrecision = function(minShowed, maxShowed, format, min, max) {
  var changed = false;
  if (maxShowed - minShowed <= Math.pow(10, 1 - format.options.precision)) {
    // if min and max are close, labels should be more precise
    changed = true;
Severity: Minor
Found in app/javascript/oldjs/miq_c3.js - 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 miqTreeClearState has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

window.miqTreeClearState = function(tree) {
  if (tree === undefined) {
    // Clear all tree state objects
    var to_remove = [];
    for (var i = 0; i < sessionStorage.length; i++) {
Severity: Minor
Found in app/javascript/oldjs/miq_tree.js - 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 OpsTenantForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const OpsTenantForm = ({
  recordId,
  divisible,
  redirectUrl,
  ancestry,
Severity: Minor
Found in app/javascript/components/ops-tenant-form/ops-tenant-form.jsx - 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 PxeImageForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PxeImageForm = ({ recordId }) => {
  const [{ initialValues, isLoading }, setState] = useState({ isLoading: !!recordId });
  const submitLabel = !!recordId ? __('Save') : __('Add');

  useEffect(() => {
Severity: Minor
Found in app/javascript/components/pxe-image-type-form/index.jsx - 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 ActionForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const ActionForm = ({
  recordId, inheritTags, availableAlerts, tags, ansibleInventory, snapshotAge, parentType, inventoryType,
}) => {
  const [{ initialValues, isLoading }, setState] = useState({
    isLoading: !!recordId,
Severity: Minor
Found in app/javascript/components/action-form/index.jsx - 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 PolicyProfileForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PolicyProfileForm = ({ recordId }) => {
  const [{ isLoading, options, initialValues }, setState] = useState({ isLoading: !!recordId });
  const addDescription = (string1, string2) => `${string1} : ${string2}`;

  useEffect(() => {
Severity: Minor
Found in app/javascript/components/policy-profile-form/index.js - 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 HostEditForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const HostEditForm = ({ ids }) => {
  const [{
    initialValues, isLoading, fields,
  }, setState] = useState({
    isLoading: (ids.length <= 1),
Severity: Minor
Found in app/javascript/components/host-edit-form/host-edit-form.jsx - 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 ReportChartWidget has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const ReportChartWidget = ({ data, id }) => {
  if (data.miqChart === 'Area') {
    return (<AreaChartGraph data={sampleData} />);
  }
  if (data.miqChart === 'Bar') {
Severity: Minor
Found in app/javascript/components/create-report-chart-form/index.jsx - 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 TreeViewSelector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const TreeViewSelector = ({
  loadData,
  lazyLoadData,
  identifier,
  isClearable,
Severity: Minor
Found in app/javascript/components/tree-view/selector.jsx - 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 AddRemoveSecurityGroupForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const AddRemoveSecurityGroupForm = ({
  recordId, redirectURL, isAdd,
}) => {
  const [{
    isLoading, securityGroups,

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

    def miq_accordion_panel(title, condition, id, &block)
      id = valid_html_id(id)
      control_id = "control_#{id}"
      content_tag(:div, :class => "panel panel-default") do
        out = content_tag(:div, :class => "panel-heading", 'role' => 'tab', 'tabindex' => 0, :id => control_id) do
Severity: Minor
Found in app/helpers/application_helper/listnav.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

Severity
Category
Status
Source
Language