Skip to content

Commit f87c878

Browse files
committed
refactor: split the forbid advice into plain statements
1 parent bc8413e commit f87c878

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

‎commit_check/engine.py‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,19 +1533,24 @@ def _judge_under_forbid(self, message: str, not_a_commit: bool) -> ValidationRes
15331533
return ValidationResult.PASS
15341534

15351535
fix = strip_lines_containing(message, [s["matched_text"] for s in signatures])
1536+
if not_a_commit:
1537+
suggest = (
1538+
"This project does not accept AI attribution. Remove the AI lines."
1539+
)
1540+
else:
1541+
action = (
1542+
"Remove the AI trailer lines and re-commit."
1543+
if fix
1544+
else "Remove AI trailers and re-commit."
1545+
)
1546+
suggest = (
1547+
"This project does not accept AI attribution in commit messages. "
1548+
+ action
1549+
)
15361550
self._print_failure(
15371551
_tools(signatures),
15381552
error=f"AI attribution is forbidden in this project — detected: {_tools(signatures)}",
1539-
suggest=(
1540-
"This project does not accept AI attribution. Remove the AI lines."
1541-
if not_a_commit
1542-
else "This project does not accept AI attribution in commit messages. "
1543-
+ (
1544-
"Remove the AI trailer lines and re-commit."
1545-
if fix
1546-
else "Remove AI trailers and re-commit."
1547-
)
1548-
),
1553+
suggest=suggest,
15491554
fix=fix,
15501555
)
15511556
return ValidationResult.FAIL

0 commit comments

Comments
 (0)