Function tags_choose
has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring. Wontfix
def tags_choose(self, tags: list[str], priority: list[str]) -> tuple[list[str], RecruitPoss]:
""" 公招标签选择核心逻辑 """
if priority is None:
priority = []
if len(priority) and isinstance(priority[0], str):
- 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 28 (exceeds 5 allowed). Consider refactoring. Wontfix
def transition(self) -> bool:
if self.scene() == Scene.INDEX:
self.tap_element('index_recruit')
elif self.scene() == Scene.RECRUIT_MAIN:
segments = segment.recruit(self.recog.img)
- 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 recruit_tags
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Wontfix
def recruit_tags(self) -> bool:
""" 识别公招标签的逻辑 """
if self.find('recruit_no_ticket') is not None:
self.has_ticket = False
if self.find('recruit_no_refresh') 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
File recruit.py
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import annotations
from ..data import recruit_agent, recruit_tag
from ..ocr import ocr_rectify, ocrhandle
from ..utils import segment
Function recruit_result
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Wontfix
def recruit_result(self) -> bool:
""" 识别公招招募到的干员 """
agent = None
ocr = ocrhandle.predict(self.recog.img)
for x in ocr:
- 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. Wontfix
if x in possibility[o].ls:
agent_level = agent_level_dict[x]
if agent_level == possibility[o].min == 1 and not possibility[o].lv2a3:
# 特殊判断:选中一星和四星干员的 Tag 组合
possibility[o].poss += 1
Avoid deeply nested control flow statements. Wontfix
if x in possibility[o].ls:
agent_level = agent_level_dict[x]
if agent_level != 1 and agent_level == possibility[o].min:
possibility[o].poss += 1
elif agent_level == 1 and agent_level == possibility[o].min == possibility[o].max:
Avoid deeply nested control flow statements. Wontfix
for x in considering:
if x in possibility[o].ls:
possibility[o].poss += 1
possibility[o].poss /= len(possibility[o].ls)
Avoid deeply nested control flow statements. Open
if x in possibility[o].ls:
possibility[o].poss += 1
possibility[o].poss /= len(possibility[o].ls)