match_unmapped_resources ignores matched_extensions and re-sends those files to PurlDB

オープン
#2,338 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@AradhyaTiwari10 がすでに取り組んでいます。

2026年11月16日 から。

  • #2339 @AradhyaTiwari10 による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
backend, databases

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
226
フォーク
222
平均マージ
1日 5時間
マージ済み PR(30日)
32

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aboutcode-org/scancode.io のほかの issue

aboutcode-org/scancode.io の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。