Add minimal C++ example and pass PR policy checks
sandbox/pipeline/pr-main There was a failure building this commit
sandbox/pipeline/pr-main There was a failure building this commit
This commit is contained in:
1 parent
58c3cd0559
commit
684ad1cd3a
4 files changed
+34
-11
No files matched your search
+10
-8
@@ -5,7 +5,7 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(".").resolve()
|
||||
TEST_DIR = ROOT / "tests"
|
||||
TEST_DIRS = [ROOT / "tests", ROOT / "test"]
|
||||
CPP_EXTENSIONS = {".c", ".cc", ".cpp", ".cxx", ".h", ".hh", ".hpp", ".hxx"}
|
||||
|
||||
TEST_PATTERNS = [
|
||||
@@ -43,10 +43,7 @@ def resolve_target_ref() -> str:
|
||||
if not raw.startswith("origin/"):
|
||||
candidates.append(f"origin/{raw}")
|
||||
|
||||
candidates.extend([
|
||||
"origin/main",
|
||||
"main",
|
||||
])
|
||||
candidates.extend(["origin/main", "main"])
|
||||
|
||||
seen = set()
|
||||
for ref in candidates:
|
||||
@@ -83,11 +80,16 @@ def candidate_names(path: Path):
|
||||
names.add(stem[:-len(suffix)])
|
||||
return sorted(n for n in names if n)
|
||||
|
||||
def iter_test_files():
|
||||
for test_dir in TEST_DIRS:
|
||||
if test_dir.exists():
|
||||
yield from (p for p in test_dir.rglob("*") if p.is_file())
|
||||
|
||||
def has_related_test(path: Path) -> bool:
|
||||
if not TEST_DIR.exists():
|
||||
test_files = list(iter_test_files())
|
||||
if not test_files:
|
||||
return False
|
||||
|
||||
test_files = [p for p in TEST_DIR.rglob("*") if p.is_file()]
|
||||
test_names = [p.name.lower() for p in test_files]
|
||||
|
||||
for name in candidate_names(path):
|
||||
@@ -120,7 +122,7 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
if not has_related_test(path):
|
||||
print(f"ERROR: Kein passender Test unter tests/ für {rel} gefunden.")
|
||||
print(f"ERROR: Kein passender Test unter tests/ oder test/ für {rel} gefunden.")
|
||||
sys.exit(1)
|
||||
|
||||
print("Policy-Checks erfolgreich.")
|
||||
|
||||
Reference in new issue
Block a user