Showing 58 of 185 total issues
Method host_interfaces_attrs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def host_interfaces_attrs(host)
host.interfaces.select(&:physical?).each.with_index.reduce({}) do |hash, (nic, index)|
set_nic_identifier(nic, index)
set_container_interface_name(host, nic, index) if container?(host)
ForemanFogProxmox::HashCollection.remove_empty_values(nic.compute_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
Function NetworkInterface
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const NetworkInterface = ({
id,
networks,
bridges,
data,
- 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 addCDRom
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
(event, initialData = null, isPreExisting = false) => {
if (event) event.preventDefault();
if (!initialData && cdRom) return;
const deviceInfo = initialData
Function handleChange
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleChange = e => {
const { name, type, checked, value: targetValue } = e.target;
let value;
if (type === 'checkbox') {
value = checked ? '1' : '0';
Method proxmox_cpus_map
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def proxmox_cpus_map
[OpenStruct.new(id: '486', name: '486'),
OpenStruct.new(id: 'athlon', name: 'athlon'),
OpenStruct.new(id: 'core2duo', name: 'core2duo'),
OpenStruct.new(id: 'coreduo', name: 'coreduo'),
Method new_typed_vm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def new_typed_vm(new_attr, type)
convert_config_attributes(new_attr) if new_attr.key?(:config_attributes)
node_id = new_attr['node_id']
node = node_id ? client.nodes.get(node_id) : default_node
new_attr_type = new_attr['type']
- 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 updateOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function updateOptions(options_path, start_options_id, end_options_id, start_second_options_id, end_second_options_id, option_id, node_id, second_id) {
var select_ids = selectIds(start_options_id, end_options_id);
var select_second_ids;
if ( start_second_options_id != undefined && end_second_options_id != undefined) {
- 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 password_proxmox_f
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def password_proxmox_f(f, attr, options = {})
unset_button = options.delete(:unset)
value = f.object[attr] if options.delete(:keep_value)
password_field_tag(:fakepassword, value, :style => 'display: none', :autocomplete => 'new-password-fake') +
field(f, attr, options) 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 add_or_delete_typed_interface
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_or_delete_typed_interface(interface_attributes, interfaces_to_delete, interfaces_to_add, type)
logger.debug("add_or_delete_typed_interface(#{type}): interface_attributes=#{interface_attributes}")
ForemanFogProxmox::HashCollection.remove_empty_values(interface_attributes)
if interface_attributes['compute_attributes']
ForemanFogProxmox::HashCollection.remove_empty_values(interface_attributes['compute_attributes'])
Function updateOptions
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function updateOptions(options_path, start_options_id, end_options_id, start_second_options_id, end_second_options_id, option_id, node_id, second_id) {
Function CDRom
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const CDRom = ({ onRemove, data, storages, nodeId }) => {
const [cdrom, setCdrom] = useState(data);
const storagesMap = createStoragesMap(storages, 'iso', nodeId);
const imagesMap = imagesByStorage(
storages,
- 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 extract_id
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_id(vm, volume_attributes)
id = ''
if volume_exists?(vm, volume_attributes)
id = volume_attributes['id']
else
- 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 volume_type?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def volume_type?(args, type)
if args.key?('storage_type')
args['storage_type'] == type
else
Fog::Proxmox::DiskHelper.cloud_init?(args['volid']) if type == 'cloud_init'
- 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 version
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def version
v = identity_client.read_version if identity_client
v ? v['version'] : 'Unknown'
rescue ::Foreman::Exception => e
'Unkown' if e.message == 'User token expired'
- 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 save_volume
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save_volume(vm, volume_attributes)
logger.debug("save_volume(#{vm.identity}) volume_attributes=#{volume_attributes}")
id = extract_id(vm, volume_attributes)
if volume_exists?(vm, volume_attributes)
if volume_to_delete?(volume_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
Function ProxmoxContainerNetwork
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const ProxmoxContainerNetwork = ({ network, bridges, paramScope }) => {
const [interfaces, setInterfaces] = useState([]);
const [nextId, setNextId] = useState(0);
const [availableIds, setAvailableIds] = useState([]);
const [usedIds, setUsedIds] = useState(new Set());
- 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 ProxmoxServerNetwork
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const ProxmoxServerNetwork = ({ network, bridges, paramScope }) => {
const [interfaces, setInterfaces] = useState([]);
const [nextId, setNextId] = useState(0);
const [availableIds, setAvailableIds] = useState([]);
const [usedIds, setUsedIds] = useState(new Set());
- 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 additional_attrs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def additional_attrs(vms, param_scope, start_checked)
attributes = {
pool: vms.pool,
image_id: vms.image_id,
cpu_type: vms.config.cpu_type,
- 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 save_vm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save_vm(uuid, new_attributes)
vm = find_vm_by_uuid(uuid)
templated = new_attributes['templated']
node_id = new_attributes['node_id']
if templated == '1' && !vm.templated?
- 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 add_and_format_element
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.add_and_format_element(dest, dest_key, origin, origin_key, format = :to_s)