Showing 722 of 1,271 total issues
Class Setting
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Setting < ApplicationRecord
audited :except => [:name]
extend FriendlyId
friendly_id :name
include ActiveModel::Validations
Class HostsController
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class HostsController < V2::BaseController
include Api::Version2
include Api::V2::BulkHostsExtension
include ScopesPerAction
include Foreman::Controller::SmartProxyAuth
File compute.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'socket'
require 'timeout'
module Orchestration::Compute
extend ActiveSupport::Concern
Function useBulkSelect
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const useBulkSelect = ({
results,
metadata,
initialArry = [],
initialExclusionArry = [],
- Read upRead up
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 ColumnSelector
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
const ColumnSelector = props => {
const {
data: { url, controller, categories, hasPreference },
} = props;
- Read upRead up
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 search_by_os_minor
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def search_by_os_minor(key, operator, value)
y, z = value.split(".")
z ||= 0
operatingsystem_ids = []
Operatingsystem.where.not(minor: [nil, '']).find_each do |os|
- Read upRead up
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 method_missing
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.method_missing(method, *args, **kwargs, &block)
type = "Host::Managed"
case method.to_s
when /create/, 'new'
# in this case args should contain a hash with host attributes
- Read upRead up
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 details
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def details(audit, path = audits_path(:search => "id=#{audit.id}"))
if audit.action == 'update'
return [] unless audit.audited_changes.present?
audit.audited_changes.map do |name, change|
next if change.nil? || change.to_s.empty?
- Read upRead up
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
File PersonalAccessTokenModal.js
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable max-lines */
import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
DatePicker,
fixtures
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
const fixtures = {
'should return editor': () => selectEditor(state),
'should return selected host': () => selectChosenHost(state),
'should return selectPreviewResult': () => selectPreviewResult(state),
'should return selectErrorText': () => selectErrorText(state),
Class LookupKey
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class LookupKey < ApplicationRecord
audited :associated_with => :audit_class
include Authorizable
include HiddenValue
include Classification
Class ComputeResourcesController
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class ComputeResourcesController < V2::BaseController
include Api::Version2
include Foreman::Controller::Parameters::ComputeResource
wrap_parameters ComputeResource, :include => compute_resource_params_filter.accessible_attributes(parameter_filter_context)
Function ErrorsTree
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ErrorsTree = props => {
const [expandedNodeNames, setExpandedNodeNames] = React.useState([]);
const [
expandedDetailsNodeNames,
setExpandedDetailsNodeNames,
Function TableIndexPage
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
const TableIndexPage = ({
apiOptions,
apiUrl,
beforeToolbarComponent,
breadcrumbOptions,
- Read upRead up
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
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def process(queue_name)
processed = 0
return true if skip_orchestration?
# queue is empty - nothing to do.
- Read upRead up
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 sanitize_inherited_vm_attributes
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def sanitize_inherited_vm_attributes(args, template, instance_type)
# Override memory an cores values if template and/or instance type is/are provided.
# Take template values if blank values for VM attributes, because oVirt will fail if empty values are present in VM definition
# Instance type values always take precedence on templates or vm provided values
if template
- Read upRead up
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 nested_attribute_for
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def nested_attribute_for(*fields)
@nested_attribute_fields = fields
@nested_attribute_fields.each do |field|
# Example method
# def inherited_compute_profile_id
- Read upRead up
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 base_host_overview_fields
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def base_host_overview_fields(host)
fields = []
fields << { :field => [_("Build duration"), build_duration(host)], :priority => 90 }
fields << { :field => [_("Build errors"), link_to("Logs from OS installer", build_errors_host_path(:id => host.id))], :priority => 91 } if host.build_errors.present?
fields << { :field => [_("Token"), host.token || _("N/A")], :priority => 92 } if User.current.admin
- Read upRead up
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 interfaces
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def interfaces
interfaces = {}
facts.each do |fact, value|
next unless value && fact.to_s =~ /^ip_interfaces/
- Read upRead up
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 render
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
breadcrumbItems,
isSwitchable,
resource,