src/util/test_utils.py
Possible hardcoded password: '1234' Open
Open
password = "1234"
- Exclude checks
Function mock_module_attrs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def mock_module_attrs(module_and_attrname_to_newattr: dict[tuple[Any, str], Any]):
"""
A decorator for monkey patching attributes of modules while the decorated function is executed;
the original module attributes are monkey patched back after execution.
- 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 _do_request_assertion_for_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def _do_request_assertion_for_path(self, path: str, language_prefix: str, client: Client, is_superuser: bool, test_case: SimpleTestCase):
response = client.get(path)
if self.redirect:
test_case.assertIn(response.status_code, {HTTPStatus.MOVED_PERMANENTLY, HTTPStatus.FOUND},
- 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"