scancode-config.yml in an input archive is detected differently by scan_codebase and scan_single_package
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start by reading the config discovery logic in scanpipe/models.py and the archive extraction paths in scanpipe/pipes/scancode.py and scanpipe/pipelines/scan_single_package.py. Then review the one-level search test in scanpipe/tests/test_models.py and compare behavior for flat and single-folder archives in both pipelines. Done means the supported layout behaves consistently and any agreed warning appears when a config is found but ignored; the issue leaves those decisions 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
A scancode-config.yml placed inside an input archive is used or ignored depending on the pipeline and on the archive layout. When it is ignored, there is no warning.
System configuration
- Version: v38.2.0 (
mainat 237ea33c) - Docker: yes, dev stack (
docker-compose.yml+docker-compose.dev.yml) - OS: macOS (Apple Silicon)
- Inputs:
flat.zipandwrapped.zip(attached) - Pipelines:
scan_codebaseandscan_single_package
To Reproduce
Two archives with the same content, different layout:
flat.zip: package.json, scancode-config.yml
wrapped.zip: my-app/package.json, my-app/scancode-config.yml
scancode-config.yml:
ignored_dependency_scopes:
- package_type: npm
scope: devDependencies
Run each pipeline on each archive (zips copied to /tmp in the web container):
for pipeline in scan_codebase scan_single_package; do
for zip in flat wrapped; do
docker compose exec -T web ./manage.py create-project "test-$pipeline-$zip" \
--input-file /tmp/$zip.zip --pipeline $pipeline --execute
done
done
docker compose exec -T web ./manage.py shell -c "
from scanpipe.models import Project
for p in Project.objects.filter(name__startswith='test-').order_by('name'):
print(p.name, '->', p.get_env('ignored_dependency_scopes'))
"
Output:
test-scan_codebase-flat -> [{'package_type': 'npm', 'scope': 'devDependencies'}]
test-scan_codebase-wrapped -> None
test-scan_single_package-flat -> None
test-scan_single_package-wrapped -> [{'package_type': 'npm', 'scope': 'devDependencies'}]
| flat.zip | wrapped.zip | |
|---|---|---|
scan_codebase |
loaded | ignored |
scan_single_package |
ignored | loaded |
Cause
The config is only searched in immediate codebase/ subdirectories:
https://github.com/aboutcode-org/scancode.io/blob/237ea33c9ce119e0756fd12d93a0216c47880f43/scanpipe/models.py#L894-L899
But the two pipelines extract archives to different places:
scan_codebaseextracts tocodebase/<name>-extract/, so only a config at the archive top level is found:
https://github.com/aboutcode-org/scancode.io/blob/237ea33c9ce119e0756fd12d93a0216c47880f43/scanpipe/pipes/scancode.py#L132-L140scan_single_packageextracts directly intocodebase/, so only a config inside a single top folder is found:
https://github.com/aboutcode-org/scancode.io/blob/237ea33c9ce119e0756fd12d93a0216c47880f43/scanpipe/pipelines/scan_single_package.py#L96-L106
The one-level search looks intentional (#1236 and this test):
https://github.com/aboutcode-org/scancode.io/blob/237ea33c9ce119e0756fd12d93a0216c47880f43/scanpipe/tests/test_models.py#L746-L753
Most real source archives (GitHub release tarballs, sdists, npm tarballs) have a single top folder, so with scan_codebase their config is silently ignored.
Expected behavior
The same archive should behave the same way in both pipelines. Questions:
- Which layout should be supported: top level, single top folder, or both?
- Should a warning be logged when a
scancode-config.ymlexists in the codebase but is not used?
Related
#2215 may be a real case of this (config inside a source archive). Note: in my test jest is still listed as a dependency even when the config is loaded; that is the separate package_type issue fixed in #2218.
I'm happy to work on a fix once the expected behavior is agreed.
AI disclosure: I used Claude Code to help explore the codebase and investigate. I ran the reproduction above myself and checked the results.
- Ngôn ngữ chính
- Python
- Star
- 225
- Fork
- 216
- Merge trung bình
- 1 ngày 59 phút
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aboutcode-org/scancode.io
-
ignored_dependency_scopes does not exclude npm devDependenciesCó thể đã có người làm @MGpromax đã nhận 72 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
aboutcode-org/scancode.io#2215 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Delivery Error in scan_single_package: No connection adapters were found for '/notifications/send_scan_notification/Có thể làm lại được @akshat-lakhera đã nhận 19 ngày trước và không có pull request nào đang mở. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
aboutcode-org/scancode.io#2206 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
update `run` cli command to run pipelines without an inputCó thể đã có người làm @NoiceHax đã nhận 84 ngày trước. Đang mởnice-to-have
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aboutcode-org/scancode.io#2203 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Local developement docs are outdatedCó thể đã có người làm @nik-767 đã nhận 114 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
aboutcode-org/scancode.io#2197 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
aboutcode-org/scancode.io#2305 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aboutcode-org/scancode.io
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
NVIDIA/auto-ontology#463 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
NousResearch/hermes-agent#151165 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
code-health
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tinaudio/synth-setter#3750 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] vllm-sr config migrate drops providers.models[].deploymentCó thể đã có người làm @Bevisy đã nhận hôm nay. Đang mởneeds-acceptance wg/developer-experience-ecosystem
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
vllm-project/semantic-router#5996 ·
Maintainer thường phản hồi trong vòng 2 ngày