aboutcode-org / aboutcode-org/scancode-toolkit

Scancode fails to inventory package manifest files

Open
#2,408 17 comments 0 reactions 0 assignees View on GitHub
bug package scan
Dominant language
Python
Stars
2.6k
Forks
791
Avg merge
1d 12h
Merged PRs (30d)
5

Description

### Description

Hey there,

Scancode appears to only scan package manifest files based on the name AND if the scan is run in the same directory. For example, if my python manifest file is named `dev.txt`, scancode does not appear to inventory it. However, if I rename the file to `requirements.txt` **_AND_** run scancode from the same directory, scancode will inventory it and the package dependencies will populate in the json output.. as shown below. There's also a possibility I am using it wrong and this is expected.

### How To Reproduce

#### Here we run scancode against the entire directory (no package dependencies shown)

Command: `scancode -clpeui --json-pp out.json flask-sqlalchemy`

```
{
"path": "flask-sqlalchemy/requirements/dev.txt", ### name is dev.txt
"type": "file",
"name": "dev.txt",
"base_name": "dev",
"extension": ".txt",
"size": 2363,
"date": "2021-02-19",
"sha1": "f3ec0c8082673263ff92cf965fa104bc9c11e078",
"md5": "80d6553a1d0caf914fb7ff299d742b2a",
"sha256": "53dd0a09ff4313129309e0231463226372482868af9601fedf8758d2f74cea74",
"mime_type": "text/plain",
"file_type": "ASCII text",
"programming_language": null,
"is_binary": false,
"is_text": true,
"is_archive": false,
"is_media": false,
"is_source": false,
"is_script": false,
"licenses": [],
"license_expressions": [],
"percentage_of_license_text": 0,
"copyrights": [],
"holders": [],
"authors": [],
"packages": [], ### NOTHING HERE
"emails": [],
"urls": [],
"files_count": 0,
"dirs_count": 0,
"size_count": 0,
"scan_errors": []
},
```

#### Now we run scancode in the same directory against the file and we get package dependencies

Command: `scancode -clpeui --json-pp out.json requirements.txt`

```
"packages": [ ### NOW WE HAVE DATA
{
"type": "pypi",
"namespace": null,
"name": null,
"version": null,
"qualifiers": {},
"subpath": null,
"primary_language": "Python",
"description": null,
"release_date": null,
"parties": [],
"keywords": [],
"homepage_url": null,
"download_url": null,
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"bug_tracking_url": null,
"code_view_url": null,
"vcs_url": null,
"copyright": null,
"license_expression": null,
"declared_license": null,
"notice_text": null,
"root_path": null,
"dependencies": [
{
"purl": "pkg:pypi/alabaster@0.7.12",
"requirement": "==0.7.12",
"scope": "dependencies",
```

> Tell us how to reproduce the issue.

`scancode -clpeui --json-pp out.json flask-sqlalchemy`

`scancode -clpeui --json-pp out.json requirements.txt`

### System configuration

`Python 3.6.13`

`FROM python:3.6-slim-buster` is the base docker image

Version: ScanCode version 21.2.9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.