comverted code to have instead of one comment,

have a list of them
This commit is contained in:
Karma Riuk
2025-03-26 12:41:46 +01:00
parent 4c6522ae63
commit fa3b7f82a1
2 changed files with 7 additions and 8 deletions

View File

@ -12,8 +12,8 @@ class Metadata:
repo: str # the name of the repo, with style XXX/YYY
pr_number: int
merge_commit_sha: str # to checkout for the tests
commented_file : str
commented_file_coverages: Dict[str, float] = field(default_factory=dict)
commented_files : Dict[str, str] # comment -> filename
commented_files_coverages: Dict[str, Dict[str, float]] = field(default_factory=dict) # filename -> jacoco-report -> coverage
successful: bool = True
build_system: str = ""
reason_for_failure: str = ""
@ -24,7 +24,7 @@ class DatasetEntry:
metadata: Metadata
files: Dict[str, FileData] # filename -> file data, files before the PR (before the first PR commits)
diffs_before: Dict[str, str] # filename -> diff, diffs between the opening of the PR and the comment
comment: str
comments: List[str]
diffs_after: Dict[str, str] # filename -> diff, changes after the comment
@dataclass
@ -59,10 +59,9 @@ class Dataset:
metadata=metadata,
files=files,
diffs_before=entry_data["diffs_before"],
comment=entry_data["comment"],
comments=entry_data["comments"],
diffs_after=entry_data["diffs_after"]
)
entries.append(entry)
return Dataset(entries=entries)

View File

@ -96,10 +96,10 @@ def process_pull(repo: Repository, pr: PullRequest, dataset: Dataset, repos_dir:
return
entry = DatasetEntry(
metadata=Metadata(repo.full_name, pr.number, pr.merge_commit_sha, commented_file_path, reason_for_failure="Was still being processed"),
metadata=Metadata(repo.full_name, pr.number, pr.merge_commit_sha, {comment_text: commented_file_path}, reason_for_failure="Was still being processed"),
files={file.filename: FileData(file.filename) for file in pr.get_files()},
diffs_before=diffs_before,
comment=comment_text,
comments=[comment_text],
diffs_after=diffs_after,
)
dataset.entries.append(entry)
@ -149,7 +149,7 @@ def process_pull(repo: Repository, pr: PullRequest, dataset: Dataset, repos_dir:
def _check_coverages():
for coverage_file, coverage in build_handler.check_coverage(commented_file_path):
entry.metadata.commented_file_coverages[coverage_file] = coverage
entry.metadata.commented_files_coverages[commented_file_path][coverage_file] = coverage
steps = [
("Checking for tests...", build_handler.check_for_tests),