Showing 9,400 of 17,590 total issues
Function _try_func
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _try_func(conn, func, **args):
tries = 30
while True:
try:
return getattr(conn, func)(**args)
- 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 __grant_generate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __grant_generate(grant,
database,
user,
host='localhost',
grant_option=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
Function item
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def item(*args, **kwargs):
'''
Return one or more grains
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 compression in ('bzip2', 'xz'):
data = compressor.compress(buf)
if data:
out.write(data)
else:
Function networks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def networks(names=None, ids=None):
'''
.. versionchanged:: 2017.7.0
The ``names`` and ``ids`` can be passed as a comma-separated list now,
as well as a Python list.
- 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 call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call(name, function, *args, **kwargs):
'''
Executes a Salt function inside a running container
.. versionadded:: 2016.11.0
- 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 lchown
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def lchown(path, user, group):
'''
Chown a file, pass the file the desired user and group without following
symlinks.
- 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 _mod_bufsize_linux
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _mod_bufsize_linux(iface, *args, **kwargs):
'''
Modify network interface buffer sizes using ethtool
'''
ret = {'result': 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 (requested_seuser or requested_serole or requested_serange) and not requested_setype:
requested_setype = current_setype
result = set_selinux_context(name, user=requested_seuser, role=requested_serole,
Function chattr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def chattr(*files, **kwargs):
'''
.. versionadded:: 2018.3.0
Change the attributes of files. This function accepts one or more files and
- 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 senv:
senv = saltenv
if (path, saltenv) in mfiles or (path, saltenv) in mdirs:
Avoid deeply nested control flow statements. Open
if any(attr for attr in cmp_attrs):
ret['result'] = False
ret['comment'].append(
'Failed to change attributes to {0}'.format(attrs)
)
Avoid deeply nested control flow statements. Open
if insert_before_match:
match_idx += 1
block_found = True
Avoid deeply nested control flow statements. Open
if line[source_hash_name_idx] in string.whitespace:
_add_to_matches(found, line, 'source_hash_name',
source_hash_name, matched)
hash_matched = True
except IndexError:
Avoid deeply nested control flow statements. Open
if diff_attrs.removed:
chattr(
name,
operator="remove",
attributes=diff_attrs.removed,
Avoid deeply nested control flow statements. Open
if cmnt:
wline = '{0}{1}'.format(char, line)
else:
wline = line.lstrip(char)
else:
Avoid deeply nested control flow statements. Open
if mode != salt.utils.files.normalize_mode(get_mode(name)):
ret['result'] = False
ret['comment'].append(
'Failed to change mode to {0}'.format(mode)
)
Function _get_bufsize_linux
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_bufsize_linux(iface):
'''
Return network interface buffer information using ethtool
'''
ret = {'result': 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 'label' in inet:
intfnames.append(inet['label'])
else:
intfnames.append(ifname)
return intfnames
Function show_sls
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show_sls(name, saltenv='base'):
r'''
.. versionadded:: 2015.8.0
Display the rendered software definition from a specific sls file in the
- 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"