fix: pass ruff
This commit is contained in:
@@ -306,16 +306,16 @@ class KeywordRuleConfig(ConfigBase):
|
||||
"""验证配置"""
|
||||
if not self.keywords and not self.regex:
|
||||
raise ValueError("关键词规则必须至少包含keywords或regex中的一个")
|
||||
|
||||
|
||||
if not self.reaction:
|
||||
raise ValueError("关键词规则必须包含reaction")
|
||||
|
||||
|
||||
# 验证正则表达式
|
||||
for pattern in self.regex:
|
||||
try:
|
||||
re.compile(pattern)
|
||||
except re.error as e:
|
||||
raise ValueError(f"无效的正则表达式 '{pattern}': {str(e)}")
|
||||
raise ValueError(f"无效的正则表达式 '{pattern}': {str(e)}") from e
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user