(entries: list[DiffEntry])
| 735 | |
| 736 | |
| 737 | def _classify_diff_entries(entries: list[DiffEntry]) -> dict[str, Any]: |
| 738 | added_files: list[str] = [] |
| 739 | modified_files: list[str] = [] |
| 740 | deleted_files: list[str] = [] |
| 741 | renamed_files: list[dict[str, Any]] = [] |
| 742 | analyzable_files: list[str] = [] |
| 743 | analyzable_seen: set[str] = set() |
| 744 | modified_seen: set[str] = set() |
| 745 | |
| 746 | for entry in entries: |
| 747 | path = entry.path |
| 748 | if not path: |
| 749 | continue |
| 750 | |
| 751 | if entry.status == "D": |
| 752 | deleted_files.append(path) |
| 753 | continue |
| 754 | |
| 755 | if entry.status == "A": |
| 756 | added_files.append(path) |
| 757 | _append_unique(analyzable_files, analyzable_seen, path) |
| 758 | continue |
| 759 | |
| 760 | if entry.status == "M": |
| 761 | _append_unique(modified_files, modified_seen, path) |
| 762 | _append_unique(analyzable_files, analyzable_seen, path) |
| 763 | continue |
| 764 | |
| 765 | if entry.status == "R": |
| 766 | renamed_files.append( |
| 767 | { |
| 768 | "old_path": entry.old_path, |
| 769 | "new_path": path, |
| 770 | "similarity": entry.similarity, |
| 771 | } |
| 772 | ) |
| 773 | _append_unique(analyzable_files, analyzable_seen, path) |
| 774 | if entry.similarity is None or entry.similarity < 100: |
| 775 | _append_unique(modified_files, modified_seen, path) |
| 776 | continue |
| 777 | |
| 778 | if entry.status == "C": |
| 779 | _append_unique(modified_files, modified_seen, path) |
| 780 | _append_unique(analyzable_files, analyzable_seen, path) |
| 781 | continue |
| 782 | |
| 783 | _append_unique(modified_files, modified_seen, path) |
| 784 | _append_unique(analyzable_files, analyzable_seen, path) |
| 785 | |
| 786 | return { |
| 787 | "added_files": added_files, |
| 788 | "modified_files": modified_files, |
| 789 | "deleted_files": deleted_files, |
| 790 | "renamed_files": renamed_files, |
| 791 | "analyzable_files": analyzable_files, |
| 792 | } |
| 793 | |
| 794 |
no test coverage detected