match_unmapped_resources ignores matched_extensions and re-sends those files to PurlDB

Đang mở
#2,338 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@AradhyaTiwari10 đang làm issue này rồi.

Từ ngày 16/11/2026.

  • #2339 của @AradhyaTiwari10 — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend, databases

Hướng nghiên cứu

Read match_unmapped_resources() in scanpipe/pipes/d2d.py and the corresponding tests in test_d2d.py. The issue reports that the result of .exclude() is discarded; confirm which resources reach the mocked PurlDB matcher when matched_extensions=[".java"]. Done means only the unmatched extension reaches the matcher and the test passes; a linked pull request is already open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug

match_unmapped_resources() in scanpipe/pipes/d2d.py is supposed to skip the extensions that were already looked up in PurlDB by the match_resources_to_purldb step (matched_extensions=self.ecosystem_config.matchable_resource_extensions), but the filter is never applied:

if matched_extensions:
    to_unmapped.exclude(extension__in=matched_extensions)

The result of .exclude() is discarded, so to_unmapped still contains every file with a matched extension (for example all the .class files of a Java project) and they are sent to PurlDB a second time.

System configuration

  • ScanCode.io main (39acd55)
  • Local install, macOS
  • Pipeline: map_deploy_to_develop

To Reproduce

  1. Create a project with two to/ files that have no status, for example Baz.java and expected.json.
  2. Call d2d.match_unmapped_resources(project, matched_extensions=[".java"], logger=print) with _match_purldb_resources mocked.
  3. The log says Mapping 2 to/ resources with empty status in PurlDB using SHA1 and Baz.java is passed to the PurlDB matcher.

Expected behavior

Only expected.json is sent to PurlDB (Mapping 1 to/ resources ...). Files with a matched extension still get the requires-review status at the end of the step, as they do today.

Proposed fix: assign the result, to_unmapped = to_unmapped.exclude(extension__in=matched_extensions), plus a unit test in test_d2d.py that calls match_unmapped_resources with matched_extensions and checks which resources reach the matcher. I have the change and the test ready locally and can open a PR.

Ngôn ngữ chính
Python
Star
226
Fork
222
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
32

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aboutcode-org/scancode.io

Tất cả issue của aboutcode-org/scancode.io

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.