Function need_run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Wontfix
def need_run(self, now: datetime.datetime = datetime.datetime.now()) -> bool:
if self.pending:
return False
if self.start_up():
if self.last_run is not 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 transition
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Wontfix
def transition(self) -> None:
while True:
now = datetime.datetime.now()
if self.last_run is not None and the_same_day(self.last_run, now) is False:
self.new_day()
- 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 load
has 5 arguments (exceeds 4 allowed). Consider refactoring. Wontfix
def load(self, last_run: str = '', idx: int = 0, pending: bool = False, total: int = 1, finish: int = 0):
Function load_from_disk
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_from_disk(self, cmd_list=None, matcher: Callable = None) -> bool:
if cmd_list is None:
cmd_list = []
try:
with self.schedule_log_path.open('r', encoding='utf8') as f:
- 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 False
Avoid too many return
statements within this function. Wontfix
return True
Avoid too many return
statements within this function. Wontfix
return False
Avoid too many return
statements within this function. Wontfix
return True
Avoid too many return
statements within this function. Wontfix
return False
Function run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run(self) -> bool:
logger.info(f'task: {self.cmd.__name__} {self.cmd_args}')
if self.cmd.__name__ == 'operation':
if operation_one(self.cmd_args, self.device):
self.finish += 1
- 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"