Answer stability round 3: an empty argument separates no command, and two overrides on one line are read apart
This commit is contained in:
@@ -67,7 +67,7 @@ def main(argv: list[str], stdin: str) -> int:
|
||||
return 0
|
||||
text, directory, breaches = checked
|
||||
what = text.split("\n", 1)[0] if tool == "Bash" else str(given.get("file_path"))
|
||||
granted = overrides(text)
|
||||
granted, malformed = overrides(text)
|
||||
for breach in breaches:
|
||||
if breach.rule in granted:
|
||||
log_override(directory, breach.rule, granted[breach.rule], what)
|
||||
@@ -75,11 +75,13 @@ def main(argv: list[str], stdin: str) -> int:
|
||||
if not blocking:
|
||||
return 0
|
||||
where = "the command" if tool == "Bash" else "the text you write, as a comment line"
|
||||
if "rule-override" in text and not granted:
|
||||
print("The rule-override in this call names no rule below, or gives no reason.", file=sys.stderr)
|
||||
markdown = tool != "Bash" and str(given.get("file_path")).endswith(".md")
|
||||
for marker in malformed:
|
||||
print(f"`{marker}` names no rule below, or gives no reason.", file=sys.stderr)
|
||||
for rule in sorted({breach.rule for breach in blocking}):
|
||||
details = "; ".join(breach.detail for breach in blocking if breach.rule == rule)
|
||||
print(f"Blocked by rule {rule}: {details}. The rule: {RULES[rule]}. Where it does not fit this case, add `# rule-override {rule}: <reason>` to {where}; larv-review's judge rules on the reason.", file=sys.stderr)
|
||||
marker = f"<!-- rule-override {rule}: <reason> -->" if markdown else f"# rule-override {rule}: <reason>"
|
||||
print(f"Blocked by rule {rule}: {details}. The rule: {RULES[rule]}. Where it does not fit this case, add `{marker}` to {where}; larv-review's judge rules on the reason.", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user