INNER CODE UNIT · Python
is_advisory_match
uvwt/agentdock · core-skills/skill-authoring/run.py:179
def is_advisory_match(relative: str, content: str, start: int, end: int) -> bool:
if relative.startswith("tests/"):
return True
# lint 实现自身会包含规则正则;这里只跳过完整 Rule(...) 定义,不跳过普通脚本中的真实使用。
rule_start = content.rfind("Rule(", 0, start)
if rule_start >= 0:
rule_end = content.find("\n ),", rule_start)
if rule_end >= start:
return True
line_start = content.rfind("\n", 0, start) + 1
line_end = content.find("\n", end)
if line_end < 0:
line_end = len(content)
line = content[line_start:line_end]
if "re.compile(" in line and "Rule(" in content[max(0, line_start - 240):line_start]:
return True