Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Function to run all i18n tests locally #995

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ repos:
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: local
hooks:
- id: run-i18n-checks
name: Run i18n Checks
entry: python frontend/i18n/check/run_i18n_checks.py
language: python
stages: [pre-commit]

# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: "v4.0.0-alpha.8"
# hooks:
Expand Down
26 changes: 26 additions & 0 deletions frontend/i18n/check/run_i18n_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import subprocess


def run_check(script_name):
try:
subprocess.run(["python", f"./frontend/i18n/check/{script_name}"], check=True)
print(f"{script_name} ran successfully.")
except subprocess.CalledProcessError as e:
print(f"Error running {script_name}: {e}")
raise


def main():
checks = [
"i18n_check_key_identifiers.py",
"i18n_check_non_source_keys.py",
"i18n_check_repeat_values.py",
"i18n_check_unused_keys.py",
]

for check in checks:
run_check(check)


if __name__ == "__main__":
main()