File assets.py
has 470 lines of code (exceeds 250 allowed). Consider refactoring. Open
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Function _parse_args
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Wontfix
def _parse_args(self, node):
"""Parse the AST fetch_asset node and build the arguments dictionary.
:param node: AST node to be evaluated
:type node: ast.Attribute
- 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 pre_tests
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Wontfix
def pre_tests(self, job):
if not job.config.get("stdout_claimed_by", None):
logger = job.log
else:
logger = 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 handle_fetch
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Wontfix
def handle_fetch(config):
exitcode = exit_codes.AVOCADO_ALL_OK
# fetch assets from instrumented tests
cache = {}
for test_file in config.get("assets.fetch.references"):
- 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 visit_Assign
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Wontfix
def visit_Assign(self, node): # pylint: disable=C0103
"""Visit Assign on AST and build assignments.
This method will visit and build list of assignments that matches the
pattern pattern `name = string`.
- 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 handle_list
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Invalid
def handle_list(self, config):
days = config.get("assets.list.days")
size_filter = config.get("assets.list.size_filter")
if self._count_filter_args(config) == 2:
msg = (
- 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 visit_Call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Wontfix
def visit_Call(self, node): # pylint: disable=C0103
"""Visit Calls on AST and build list of calls that matches the pattern.
:param node: AST node to be evaluated
:type node: ast.*
- 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 fetch_assets
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fetch_assets(
Function fetch_assets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Wontfix
def fetch_assets(
test_file, test_file_parse_cache, klass=None, method=None, logger=None
):
"""Fetches the assets based on keywords listed on FetchAssetHandler.calls.
- 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 handle_purge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Wontfix
def handle_purge(self, config):
days = config.get("assets.purge.days")
size_filter = config.get("assets.purge.size_filter")
overall_limit = config.get("assets.purge.overall_limit")
- 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 too many return
statements within this function. Wontfix
return exit_codes.UTILITY_FAIL