Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if line and not line.startswith('#'):
append_to_package_conf('accept_keywords', string=line)
os.remove(old_path)
Function _parse_settings_bond
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _parse_settings_bond(opts, iface):
'''
Filters given options and outputs valid settings for requested
operation. If an option has a value that is not expected, this
function will log what the Interface, Setting and what it was
- 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
Avoid deeply nested control flow statements. Open
if _attrmaps_contain_attr(attr):
if '-' in attr:
attrname = attr.replace('-', '_')
else:
attrname = attr
Avoid deeply nested control flow statements. Open
for word in line.split()[1:]:
if word not in adapters:
adapters[word] = salt.utils.odict.OrderedDict()
adapters[word]['enabled'] = True
Function _gluster_xml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _gluster_xml(cmd):
'''
Perform a gluster --xml command and log result.
'''
# We will pass the command string as stdin to allow for much longer
- 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 _get_ssl_opts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_ssl_opts():
'''
Parse out ssl_options for Cassandra cluster connection.
Make sure that the ssl_version (if any specified) is valid.
'''
- 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
Avoid deeply nested control flow statements. Open
if not isinstance(value, (set, list, dict)):
value = six.text_type(value)
values[key] = value
Avoid deeply nested control flow statements. Open
if f_tmp:
flags.extend(f_tmp)
else:
flags.append('~ARCH')
Function _zfs_image_create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _zfs_image_create(vm_name,
pool,
disk_name,
hostname_property_name,
sparse_volume,
- 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 defaults
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def defaults(model,
defaults_,
delim='//',
flipped_merge=False):
'''
- 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
Avoid deeply nested control flow statements. Open
if key != 'this':
print(_parse_config(val, six.text_type(key)), file=ret)
print('</{0}>'.format(slot), file=ret)
Function _get_merged_nics
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_merged_nics(hypervisor, profile, interfaces=None, dmac=None):
'''
Get network devices from the profile and merge uer defined ones with them.
'''
nicp = _nic_profile(profile, hypervisor, dmac=dmac) if profile 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
Function signal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def signal(signal=None):
'''
Signals httpd to start, restart, or stop.
CLI Example:
- 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
Avoid deeply nested control flow statements. Open
if current_value['vdata'] == _PERMISSION_TYPES[permission_name]:
permissions = permission_name
break
ret[current_value['vname']] = permissions
Function _servicegroup_get_server
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _servicegroup_get_server(sg_name, s_name, s_port=None, **connection_args):
'''
Returns a member of a service group or None
'''
ret = None
- 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 _dmi_cast
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _dmi_cast(key, val, clean=True):
'''
Simple caster thingy for trying to fish out at least ints & lists from strings
'''
if clean and not _dmi_isclean(key, val):
- 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 network_define
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def network_define(name, bridge, forward, **kwargs):
'''
Create libvirt network.
:param name: Network name
- 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 _check_pkg
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _check_pkg(target):
'''
Return name, version and if rpm package for specified target
'''
ret = {}
- 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
Avoid deeply nested control flow statements. Open
if value is not None:
# On the rare occasion
# (I counted 1 on all systems we have)
# that there's both a value <and> a list
# just insert the value on top of the list
Function _parse_snapshot_description
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _parse_snapshot_description(vm_snapshot, unix_time=False):
'''
Parse XML doc and return a dict with the status values.
:param xmldoc:
- 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"