Function install_updates
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def install_updates(self) -> None:
"""Install requirements updates"""
for updated_file in self.updated_files:
if updated_file in REQUIREMENTS_FILES:
command = ['pip', 'install', '-r', updated_file]
- 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 write_dependency_update_lines
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def write_dependency_update_lines(
self, dependency: str, version: str, lines: list[str], file_type: str,
) -> bool:
"""
Given a dependency and some lines, update the lines. Return a
- 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 check_applicable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_applicable(self) -> bool:
# Make sure pip is recent enough
command = ['pip', '--version']
try:
result = self.util.execute_shell(
- 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. Open
return True
Function write_dependency_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_dependency_update(self, dependency: str, version: str) -> bool:
"""Given a dependency, update it to a given version"""
updated = False
for reqfile in REQUIREMENTS_FILES:
with Python.edit_requirements(reqfile, self.util.dry_run) as lines:
- 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"