Showing 6 of 6 total issues
Function clear
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def clear(self, everything=False):
if everything:
app_data_path = self.app_data_path
if os.path.exists(app_data_path):
shutil.rmtree(app_data_path)
- 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 prepare_ext
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def prepare_ext(ext: Optional[str]):
if ext and len(ext) != 0:
while ext.startswith('..'):
ext = ext[1:]
if len(ext) == 1 and ext[0] == '.':
- 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_config_path
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_config_path(self, name=None, ext=None, create=False):
"""
Allows to get app config path.
:param name: name of the application. Uses app name as default.
:return: path to the config.
- 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_for_exceptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_for_exceptions(self, raise_exceptions=False):
try:
if not os.path.exists(self.app_data_path):
raise RuntimeError('App data folder should exist. Run setup(...) to initialize the required files.')
if not os.path.exists(self.config_path):
- 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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function setup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def setup(self, override=False):
if override:
self.clear()
app_data_path = self.app_data_path
if not os.path.exists(app_data_path):
- 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"