Showing 895 of 913 total issues
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def render(self, result, job):
json_output = job.config.get("job.run.result.json.output")
json_enabled = job.config.get("job.run.result.json.enabled")
if not (json_enabled or json_output):
- 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 regexp.match(child.name):
remove.append(child)
for child in remove:
Function initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(self, config):
subcommand = config.get("subcommand")
self.variants = None # pylint: disable=W0201
order = config.get(f"{subcommand}.cit.combination_order")
if order and order > 6:
- 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 len(c) > len(constraint_array):
if set(c) > set(constraint_array):
remove.add(c)
if not has_subset:
Function resolve
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def resolve(self, reference):
if not self.config.get("resolver.run_executables"):
return ReferenceResolution(
reference,
ReferenceResolutionResult.NOTFOUND,
- 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 _fetch_asset
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _fetch_asset(name, asset_hash, algorithm, locations, cache_dirs, expire, queue):
Function run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run(self, config):
name = config.get("distro.distro_def_name")
version = config.get("distro.distro_def_version")
release = config.get("distro.distro_def_release")
arch = config.get("distro.distro_def_arch")
- 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 _run_scripts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _run_scripts(self, kind, scripts_dir, job):
config = job.config
if not os.path.isdir(scripts_dir):
if config.get("plugins.jobscripts.warn_non_existing_dir"):
LOG_UI.error(
- 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 candidate not in candidates:
candidates.append(candidate)
Function hash_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def hash_file(filename, size=None, algorithm="md5"):
"""
Calculate the hash value of filename.
If size is not None, limit to first size bytes.
- 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 tokenize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def tokenize(self, s):
pos = 0
n = len(s)
while pos < n:
m = self.re.match(s, pos)
- 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
with open(
os.path.join(root, metadata_file), "r", encoding="utf-8"
) as data:
metadata = json.loads(data.read())
if isinstance(metadata, dict):
Function _save_to_json
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _save_to_json(matrix, filename, verbose=False):
result = []
type_label_mapping = {}
for line in matrix:
- 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_distro
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_distro(self):
"""
:param session: ssh connection between another machine
Returns the :class:`LinuxDistro` this probe detected
- 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 isinstance(metadata, dict):
if metadata.get("type", None) == "vmimage":
provider = None
for p in vmimage.IMAGE_PROVIDERS:
if p.name == metadata["name"]:
Function vg_ramdisk
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def vg_ramdisk(
Avoid deeply nested control flow statements. Open
if nk is not None:
# self.add(cur, (nk, i))
# INLINED --v
new = (nk, i)
if new not in cur:
Function lv_create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def lv_create(
Function _namelist
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _namelist(instance):
namelist, namedict, classlist = [], {}, [instance.__class__]
for c in classlist:
for b in c.__bases__:
classlist.append(b) # pylint: disable=W4701
- 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 new not in next_item:
next_item.append(new)
# INLINED --^
else: