CI / Format and clippy (push) Successful in 1m13s
CI / Dependency audit (push) Successful in 13s
CI / Tests (Linux) (push) Successful in 1m35s
Release / Create release (push) Successful in 7s
CI / Check desktop app (Linux) (push) Successful in 3m19s
Release / CLI (linux-aarch64) (push) Successful in 1m3s
Release / CLI (linux-x86_64) (push) Successful in 1m28s
Release / Desktop app (linux-aarch64) (push) Successful in 7m16s
Release / Desktop app (linux-x86_64) (push) Successful in 10m17s
Release / Desktop app (windows) (push) Successful in 4m54s
Completes the English-only standardization for code, comments, scripts and CI templates (UI/CLI-facing strings stay bilingual pt-BR/en, untouched). Covers the remaining crates/, apps/gui/ui/ and apps/gui/src-tauri/ comments, .gitea/ workflow and template comments, .githooks/ hooks, and the scripts/ source comments for the files already renamed in a prior commit (check.sh, generate-logo.py, install-hooks.sh). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
43 lines
1.4 KiB
Bash
Executable File
43 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Enforces Conventional Commits 1.0.0 and English-only commit messages.
|
|
set -euo pipefail
|
|
|
|
msg_file="${1:?usage: commit-msg <file>}"
|
|
python3 - "$msg_file" <<'PY'
|
|
import re, sys
|
|
from pathlib import Path
|
|
|
|
raw = Path(sys.argv[1]).read_text(encoding="utf-8")
|
|
lines = [l for l in raw.splitlines() if not l.startswith("#")]
|
|
while lines and not lines[0].strip():
|
|
lines.pop(0)
|
|
if not lines:
|
|
sys.exit("commit-msg: empty commit message")
|
|
|
|
subject = lines[0].strip()
|
|
if subject.startswith(("Merge ", "Revert \"")):
|
|
sys.exit(0)
|
|
|
|
conv_re = re.compile(
|
|
r"^(feat|fix|chore|ci|docs|refactor|test|perf|build|style|revert)(\([a-z0-9_./-]+\))?!?: .+$"
|
|
)
|
|
if not conv_re.match(subject):
|
|
sys.exit(
|
|
f"commit-msg: invalid Conventional Commit header: {subject!r}\n"
|
|
"Expected: <type>[optional scope]: <description in English>\n"
|
|
"Allowed types: feat, fix, chore, ci, docs, refactor, test, perf, build, style, revert"
|
|
)
|
|
|
|
body = "\n".join(lines)
|
|
cleaned = re.sub(r"\b(Guará|Sabiá|Acauã|Ciberfauna)\b", "", body)
|
|
pt_accents = re.search(r"[áàâãéêíóôõúçÁÀÂÃÉÊÍÓÔÕÚÇ]", cleaned)
|
|
pt_words = re.search(
|
|
r"\b(não|para|como|quando|então|pelos|pelas|pelo|pela|estão|está|também|versão|"
|
|
r"corrige|adiciona|atualiza|remove|padroniza|implementa|ajusta|arquivo|arquivos)\b",
|
|
cleaned,
|
|
re.I,
|
|
)
|
|
if pt_accents or pt_words:
|
|
sys.exit("commit-msg: commit messages must be written 100% in English.")
|
|
PY
|