Revert "ci: only block on configured i18n locales"
This reverts commit 7a3c649fb4.
This commit is contained in:
@@ -51,44 +51,12 @@ def _cta_issue_is_allowed_now(locale: str, issue: dict) -> bool:
|
|||||||
return issue.get("severity") == "block" and issue.get("issue_type") == "cta_language_mismatch"
|
return issue.get("severity") == "block" and issue.get("issue_type") == "cta_language_mismatch"
|
||||||
|
|
||||||
|
|
||||||
def enabled_locales_from_config() -> set[str] | None:
|
|
||||||
"""
|
|
||||||
If the project config declares a limited set of i18n languages, use it to
|
|
||||||
scope CI blocking checks.
|
|
||||||
"""
|
|
||||||
|
|
||||||
config_path = PROJECT_ROOT / "mandelstudio" / "ocyan.json"
|
|
||||||
if not config_path.exists():
|
|
||||||
return None
|
|
||||||
|
|
||||||
try:
|
|
||||||
payload = load_json(config_path)
|
|
||||||
except Exception:
|
|
||||||
return None
|
|
||||||
|
|
||||||
languages = (
|
|
||||||
(payload.get("settings") or {})
|
|
||||||
.get("i18n", {})
|
|
||||||
.get("languages")
|
|
||||||
)
|
|
||||||
if not languages or not isinstance(languages, list):
|
|
||||||
return None
|
|
||||||
|
|
||||||
enabled = {str(code).split("-")[0] for code in languages if code}
|
|
||||||
return enabled or None
|
|
||||||
|
|
||||||
|
|
||||||
def effective_block_count(payload: dict) -> tuple[int, int]:
|
def effective_block_count(payload: dict) -> tuple[int, int]:
|
||||||
"""Return (effective_block, ignored_block) after applying allowlists."""
|
"""Return (effective_block, ignored_block) after applying allowlists."""
|
||||||
enabled_locales = enabled_locales_from_config()
|
|
||||||
ignored = 0
|
ignored = 0
|
||||||
block = 0
|
block = 0
|
||||||
issues = payload.get("issues") or {}
|
issues = payload.get("issues") or {}
|
||||||
for locale, data in locale_rows(payload):
|
for locale, data in locale_rows(payload):
|
||||||
if enabled_locales is not None and locale not in enabled_locales:
|
|
||||||
locale_issues = issues.get(locale) or []
|
|
||||||
ignored += sum(int(issue.get("count") or 1) for issue in locale_issues if issue.get("severity") == "block")
|
|
||||||
continue
|
|
||||||
locale_issues = issues.get(locale) or []
|
locale_issues = issues.get(locale) or []
|
||||||
for issue in locale_issues:
|
for issue in locale_issues:
|
||||||
if issue.get("severity") != "block":
|
if issue.get("severity") != "block":
|
||||||
|
|||||||
Reference in New Issue
Block a user