Showing 9,400 of 17,590 total issues
Avoid deeply nested control flow statements. Open
if insert_after_match:
match_idx += 1
new_file.insert(match_idx, line)
Avoid deeply nested control flow statements. Open
if matched_type is None:
# There was a match, but it's not of the correct length
# to match one of the supported hash types.
matched = None
else:
Avoid deeply nested control flow statements. Open
if urlparsed_single_src.scheme.lower() in string.ascii_lowercase:
urlparsed_single_src = _urlparse('file://' + single_src)
proto = urlparsed_single_src.scheme
Avoid deeply nested control flow statements. Open
if urlparsed_src.scheme.lower() in string.ascii_lowercase:
urlparsed_src = _urlparse('file://' + single)
proto = urlparsed_src.scheme
Avoid deeply nested control flow statements. Open
if salt.utils.platform.is_windows():
contents = os.linesep.join(
_splitlines_preserving_trailing_newline(contents))
log.debug('File will be encoded with %s', encoding)
Avoid deeply nested control flow statements. Open
if (path, saltenv) in mfiles or (path, saltenv) in mdirs:
ret = (single_src, single_hash)
break
elif proto.startswith('http') or proto == 'ftp':
Avoid deeply nested control flow statements. Open
if line[source_idx] in filename_separators:
_add_to_matches(found, line, 'source',
source, matched)
hash_matched = True
except IndexError:
Avoid deeply nested control flow statements. Open
if not selinux_error:
ret['comment'].append('The file {0} is set to be changed'.format(name))
if requested_seuser:
if current_seuser != requested_seuser:
Avoid deeply nested control flow statements. Open
if not __opts__['test']:
if touch(name):
ret['changes']['new'] = 'file {0} created'.format(name)
ret['comment'] = 'Empty file'
else:
Avoid deeply nested control flow statements. Open
if not __opts__['test']:
if touch(name):
ret['changes']['diff'] = 'New file'
else:
return _error(
Avoid deeply nested control flow statements. Open
if diff_attrs.added:
chattr(
name,
operator="add",
attributes=diff_attrs.added,
Avoid deeply nested control flow statements. Open
if line[file_name_idx] in filename_separators:
_add_to_matches(found, line, 'file_name',
file_name, matched)
hash_matched = True
except IndexError:
Function _render_filenames
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _render_filenames(path, dest, saltenv, template, **kw):
'''
Process markup in the :param:`path` and :param:`dest` variables (NOT the
files under the paths they ultimately point to) according to the markup
format provided by :param:`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
Function mount
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def mount(location, access='rw', root=None):
'''
Mount an image
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 'inet' in host['interfaces'][interface]:
for item in host['interfaces'][interface]['inet']:
host_ips.append(item['address'])
host_ips = list(set(host_ips))
Function get_service_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_service_name(*args):
'''
The Display Name is what is displayed in Windows when services.msc is
executed. Each Display Name has an associated Service Name which is the
actual name of the service. This function allows you to discover 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"
Further reading
Avoid deeply nested control flow statements. Open
for fun in functions:
if fun in data:
ret.setdefault(fun, {})[__opts__['id']] = data.get(fun)
Avoid deeply nested control flow statements. Open
for ip_ in info['inet']:
host_ips.append(ip_['address'])
else:
Function cmd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cmd(tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
- 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 _fh.read(1) != b'\n':
_fh.write(b'\n')
_fh.write(salt.utils.stringutils.to_bytes(auth_line))