From 282f29520b40f63971d6dfc2e8f276e85eb56347 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Fri, 21 Mar 2025 13:43:46 +0100 Subject: [PATCH] since there are multiple jacoco.xml files possible and it's too hard to understand which one is the correct one for the class, I just log in the coverages each one that have the fully qualified class that is commented, it will then be up to us to filter out what's needed --- dataset.py | 2 +- pull_requests.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dataset.py b/dataset.py index 7673a29..8fdce86 100644 --- a/dataset.py +++ b/dataset.py @@ -13,7 +13,7 @@ class Metadata: pr_number: int merge_commit_sha: str # to checkout for the tests commented_file : str - commented_file_coverage: float = 0 + commented_file_coverages: Dict[str, float] = field(default_factory=dict) successful: bool = True build_system: str = "" reason_for_failure: str = "" diff --git a/pull_requests.py b/pull_requests.py index 5fc5a5f..20ff424 100644 --- a/pull_requests.py +++ b/pull_requests.py @@ -143,12 +143,16 @@ def process_pull(repo: Repository, pr: PullRequest, dataset: Dataset, repos_dir: entry.metadata.build_system = build_handler.get_type() build_handler.set_client(docker_client) + def _check_coverages(): + for coverage_file, coverage in build_handler.check_coverage(commented_file_path): + entry.metadata.commented_file_coverages[coverage_file] = coverage + steps = [ ("Checking for tests...", build_handler.check_for_tests), ("Compiling...", build_handler.compile_repo), ("Running tests...", build_handler.test_repo), ("Generating coverage...", build_handler.generate_coverage_report), - ("Checking coverage...", lambda: build_handler.check_coverage(commented_file_path)), + ("Checking coverage...", _check_coverages), ] with build_handler, tqdm(total=len(steps), desc="Processing PR", leave=False) as pbar: