SERVER-103927 switch from scons to bazel (#39284)

GitOrigin-RevId: 698b83c9b64adf5dfe2b670d16052f24342c04e3
This commit is contained in:
Daniel Moody
2025-07-29 12:18:07 -05:00
committed by MongoDB Bot
parent f78c5baef4
commit e54f728ad4
3228 changed files with 152328 additions and 571010 deletions

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env python3
"""Script for validating CODEOWNERS file."""
import os
import subprocess
import sys
def get_validator_env() -> dict:
"""Prepare the environment for the codeowners-validator."""
env = os.environ.copy()
env.update({
"REPOSITORY_PATH": ".",
"CHECKS": "duppatterns,syntax",
"EXPERIMENTAL_CHECKS": "avoid-shadowing",
})
return env
def run_validator(validator_path: str) -> int:
"""Run the codeowners validation."""
if not os.path.isfile(validator_path):
raise RuntimeError(f"Validator was not found at input path: {validator_path}")
print(f"Using validator at: {validator_path}")
env = get_validator_env()
try:
result = subprocess.run([validator_path], env=env, check=True, capture_output=True,
text=True)
if result.stdout:
print(result.stdout)
return 0
except subprocess.CalledProcessError as exc:
if exc.stdout:
print(exc.stdout, file=sys.stderr)
if exc.stderr:
print(exc.stderr, file=sys.stderr)
return exc.returncode
except FileNotFoundError:
print("Error: Failed to run codeowners-validator after installation", file=sys.stderr)
return 1
except Exception:
raise