From 92b2269efa89e208c937e414cabd940f20958ded Mon Sep 17 00:00:00 2001 From: Yashvijain1234 Date: Fri, 12 Dec 2025 17:57:43 +0530 Subject: [PATCH 1/3] Added documentation_url field to Package model Signed-off-by: Yashvijain1234 --- result.json | 1 + src/packagedcode/cargo.py | 3 ++- src/packagedcode/models.py | 4 ++++ .../data/cargo/cargo_toml/boring-child/Cargo.toml.expected | 4 ++-- .../data/cargo/cargo_toml/boring-main/Cargo.toml.expected | 1 + .../data/cargo/cargo_toml/clap/Cargo.toml.expected | 5 ++--- .../data/cargo/cargo_toml/clippy/Cargo.toml.expected | 1 + .../data/cargo/cargo_toml/mdbook/Cargo.toml.expected | 5 ++--- .../data/cargo/cargo_toml/rustfmt/Cargo.toml.expected | 1 + .../data/cargo/cargo_toml/rustup/Cargo.toml.expected | 2 +- .../cargo/cargo_toml/single-file-scan/Cargo.toml.expected | 2 +- .../data/cargo/cargo_toml/tauri-examples/Cargo.toml.expected | 1 + .../data/cargo/cargo_toml/tauri/Cargo.toml.expected | 1 + tests/packagedcode/data/models/full-expected.json | 1 + tests/packagedcode/data/models/simple-expected.json | 1 + tests/packagedcode/test_package_models.py | 1 + 16 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 result.json diff --git a/result.json b/result.json new file mode 100644 index 00000000000..d04adbb5b05 --- /dev/null +++ b/result.json @@ -0,0 +1 @@ +{"headers": [{"tool_name": "scancode-toolkit", "tool_version": "v32.4.1-34-gedac742eaa", "options": {"input": [".\\samples"], "--json": ".\\result.json"}, "notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", "start_timestamp": "2025-12-10T185140.377956", "end_timestamp": "2025-12-10T185140.642211", "output_format_version": "4.1.0", "duration": 0.2642548084259033, "message": null, "errors": [], "warnings": [], "extra_data": {"system_environment": {"operating_system": "win", "cpu_architecture": "64", "platform": "Windows-11-10.0.22631-SP0", "platform_version": "10.0.22631", "python_version": "3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]"}, "spdx_license_list_version": "3.27", "files_count": 33}}], "files": [{"path": "samples", "type": "directory", "scan_errors": []}, {"path": "samples/README", "type": "file", "scan_errors": []}, {"path": "samples/screenshot.png", "type": "file", "scan_errors": []}, {"path": "samples/arch", "type": "directory", "scan_errors": []}, {"path": "samples/arch/zlib.tar.gz", "type": "file", "scan_errors": []}, {"path": "samples/JGroups", "type": "directory", "scan_errors": []}, {"path": "samples/JGroups/EULA", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/LICENSE", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses", "type": "directory", "scan_errors": []}, {"path": "samples/JGroups/licenses/apache-1.1.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/apache-2.0.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/bouncycastle.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/cpl-1.0.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/lgpl.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src", "type": "directory", "scan_errors": []}, {"path": "samples/JGroups/src/FixedMembershipToken.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/GuardedBy.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/ImmutableReference.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/RATE_LIMITER.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/RouterStub.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/RouterStubManager.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/S3_PING.java", "type": "file", "scan_errors": []}, {"path": "samples/zlib", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/adler32.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/deflate.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/deflate.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/zlib.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/zutil.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/zutil.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/ada", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/ada/zlib.ads", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/dotzlib/AssemblyInfo.cs", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib/ChecksumImpl.cs", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib/LICENSE_1_0.txt", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib/readme.txt", "type": "file", "scan_errors": []}, {"path": "samples/zlib/gcc_gvmat64", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/gcc_gvmat64/gvmat64.S", "type": "file", "scan_errors": []}, {"path": "samples/zlib/infback9", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/infback9/infback9.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/infback9/infback9.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/iostream2", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/iostream2/zstream.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/iostream2/zstream_test.cpp", "type": "file", "scan_errors": []}]} \ No newline at end of file diff --git a/src/packagedcode/cargo.py b/src/packagedcode/cargo.py index 3b2d342d828..aef4b78cb17 100644 --- a/src/packagedcode/cargo.py +++ b/src/packagedcode/cargo.py @@ -228,12 +228,12 @@ def parse(cls, location, package_only=False): vcs_url = core_package_data.get('repository') homepage_url = core_package_data.get('homepage') + documentation_url = core_package_data.get('documentation') repository_homepage_url = name and f'https://crates.io/crates/{name}' repository_download_url = name and version and f'https://crates.io/api/v1/crates/{name}/{version}/download' api_data_url = name and f'https://crates.io/api/v1/crates/{name}' extra_data_mappings = { - "documentation": "documentation_url", "rust-version": "rust_version", "edition": "rust_edition", } @@ -254,6 +254,7 @@ def parse(cls, location, package_only=False): extracted_license_statement=extracted_license_statement, vcs_url=vcs_url, homepage_url=homepage_url, + documentation_url=documentation_url, repository_homepage_url=repository_homepage_url, repository_download_url=repository_download_url, api_data_url=api_data_url, diff --git a/src/packagedcode/models.py b/src/packagedcode/models.py index 0c4ffb9e56e..781d696ee14 100644 --- a/src/packagedcode/models.py +++ b/src/packagedcode/models.py @@ -618,6 +618,10 @@ class PackageData(IdentifiablePackageData): 'See SPDX specification "Package Download Location" ' 'at https://spdx.org/spdx-specification-21-web-version#h.49x2ik5 ') + documentation_url = String( + label='documentation URL', + help='URL to the documentation for this package.') + copyright = String( label='Copyright', help='Copyright statements for this package. Typically one per line.') diff --git a/tests/packagedcode/data/cargo/cargo_toml/boring-child/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/boring-child/Cargo.toml.expected index 272e43f6a48..1b4092a4e0e 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/boring-child/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/boring-child/Cargo.toml.expected @@ -46,6 +46,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": null, + "documentation_url": "https://docs.rs/boring-sys", "copyright": null, "holder": null, "declared_license_expression": "mit", @@ -86,8 +87,7 @@ "extra_data": { "version": "workspace", "repository": "workspace", - "edition": "workspace", - "documentation_url": "https://docs.rs/boring-sys" + "edition": "workspace" }, "dependencies": [ { diff --git a/tests/packagedcode/data/cargo/cargo_toml/boring-main/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/boring-main/Cargo.toml.expected index a58452ebb84..e4cf9369cfe 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/boring-main/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/boring-main/Cargo.toml.expected @@ -21,6 +21,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": null, + "documentation_url": null, "copyright": null, "holder": null, "declared_license_expression": null, diff --git a/tests/packagedcode/data/cargo/cargo_toml/clap/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/clap/Cargo.toml.expected index 79b0a84c7c8..05fc95db445 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/clap/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/clap/Cargo.toml.expected @@ -36,6 +36,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": "https://github.com/clap-rs/clap", + "documentation_url": "https://docs.rs/clap/", "copyright": null, "holder": null, "declared_license_expression": "mit", @@ -73,9 +74,7 @@ "file_references": [], "is_private": false, "is_virtual": false, - "extra_data": { - "documentation_url": "https://docs.rs/clap/" - }, + "extra_data": {}, "dependencies": [ { "purl": "pkg:cargo/bitflags", diff --git a/tests/packagedcode/data/cargo/cargo_toml/clippy/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/clippy/Cargo.toml.expected index e2566ada19f..dcb4a691a78 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/clippy/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/clippy/Cargo.toml.expected @@ -63,6 +63,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": "https://github.com/rust-lang/rust-clippy", + "documentation_url": null, "copyright": null, "holder": null, "declared_license_expression": "mit OR apache-2.0", diff --git a/tests/packagedcode/data/cargo/cargo_toml/mdbook/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/mdbook/Cargo.toml.expected index f9489676f83..9cd00c8c958 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/mdbook/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/mdbook/Cargo.toml.expected @@ -48,6 +48,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": "https://github.com/rust-lang-nursery/mdBook", + "documentation_url": "http://rust-lang-nursery.github.io/mdBook/index.html", "copyright": null, "holder": null, "declared_license_expression": "mpl-2.0", @@ -85,9 +86,7 @@ "file_references": [], "is_private": false, "is_virtual": false, - "extra_data": { - "documentation_url": "http://rust-lang-nursery.github.io/mdBook/index.html" - }, + "extra_data": {}, "dependencies": [ { "purl": "pkg:cargo/clap", diff --git a/tests/packagedcode/data/cargo/cargo_toml/rustfmt/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/rustfmt/Cargo.toml.expected index 6b0af2acdec..79013427b28 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/rustfmt/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/rustfmt/Cargo.toml.expected @@ -38,6 +38,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": "https://github.com/rust-lang/rustfmt", + "documentation_url": null, "copyright": null, "holder": null, "declared_license_expression": "apache-2.0 OR mit", diff --git a/tests/packagedcode/data/cargo/cargo_toml/rustup/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/rustup/Cargo.toml.expected index 6a60afc8816..ad08f3ae54a 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/rustup/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/rustup/Cargo.toml.expected @@ -34,6 +34,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": "https://github.com/rust-lang/rustup.rs", + "documentation_url": "http://rust-lang.github.io/rustup.rs/rustup/index.html", "copyright": null, "holder": null, "declared_license_expression": "mit OR apache-2.0", @@ -77,7 +78,6 @@ "src/download" ] }, - "documentation_url": "http://rust-lang.github.io/rustup.rs/rustup/index.html", "rust_edition": "2018" }, "dependencies": [ diff --git a/tests/packagedcode/data/cargo/cargo_toml/single-file-scan/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/single-file-scan/Cargo.toml.expected index ff00223cc82..dc5ab7516e2 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/single-file-scan/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/single-file-scan/Cargo.toml.expected @@ -40,6 +40,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": "https://github.com/cesarb/constant_time_eq", + "documentation_url": "https://docs.rs/constant_time_eq", "copyright": null, "holder": null, "declared_license_expression": "cc0-1.0 OR mit-0 OR apache-2.0", @@ -78,7 +79,6 @@ "is_private": false, "is_virtual": false, "extra_data": { - "documentation_url": "https://docs.rs/constant_time_eq", "rust_version": "1.85.0", "rust_edition": "2024" }, diff --git a/tests/packagedcode/data/cargo/cargo_toml/tauri-examples/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/tauri-examples/Cargo.toml.expected index c07f809f9c5..4fce2752f5d 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/tauri-examples/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/tauri-examples/Cargo.toml.expected @@ -21,6 +21,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": null, + "documentation_url": null, "copyright": null, "holder": null, "declared_license_expression": null, diff --git a/tests/packagedcode/data/cargo/cargo_toml/tauri/Cargo.toml.expected b/tests/packagedcode/data/cargo/cargo_toml/tauri/Cargo.toml.expected index 25b7f94cd55..ae87e3cb414 100644 --- a/tests/packagedcode/data/cargo/cargo_toml/tauri/Cargo.toml.expected +++ b/tests/packagedcode/data/cargo/cargo_toml/tauri/Cargo.toml.expected @@ -21,6 +21,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": null, + "documentation_url": null, "copyright": null, "holder": null, "declared_license_expression": null, diff --git a/tests/packagedcode/data/models/full-expected.json b/tests/packagedcode/data/models/full-expected.json index f254042951c..4ff66d07bef 100644 --- a/tests/packagedcode/data/models/full-expected.json +++ b/tests/packagedcode/data/models/full-expected.json @@ -35,6 +35,7 @@ "bug_tracking_url": "http://homepage.com/issues", "code_view_url": "http://homepage.com/code", "vcs_url": "git+http://homepage.com/code.git@12ed302c4b4c2aa10638db3890", + "documentation_url": null, "copyright": "copyright (c) nexB Inc.", "holder": "nexB Inc.", "declared_license_expression": "apache-2.0", diff --git a/tests/packagedcode/data/models/simple-expected.json b/tests/packagedcode/data/models/simple-expected.json index 64432622056..2d7ccd90f07 100644 --- a/tests/packagedcode/data/models/simple-expected.json +++ b/tests/packagedcode/data/models/simple-expected.json @@ -31,6 +31,7 @@ "bug_tracking_url": null, "code_view_url": null, "vcs_url": "git+https://somerepo.com/that.git", + "documentation_url": null, "copyright": null, "holder": null, "declared_license_expression": "apache-2.0", diff --git a/tests/packagedcode/test_package_models.py b/tests/packagedcode/test_package_models.py index 0370054324f..51d783db5db 100644 --- a/tests/packagedcode/test_package_models.py +++ b/tests/packagedcode/test_package_models.py @@ -53,6 +53,7 @@ def test_Package_creation_and_dump(self): ('bug_tracking_url', None), ('code_view_url', None), ('vcs_url', None), + ('documentation_url', None), ('copyright', None), ('holder', None), ('declared_license_expression', None), From 5a43386785faa9a1ff0fa60b6c9be5388c18c6d0 Mon Sep 17 00:00:00 2001 From: Yashvijain1234 Date: Wed, 17 Dec 2025 22:04:28 +0530 Subject: [PATCH 2/3] chore: remove accidentally committed result.json Signed-off-by: Yashvijain1234 --- result.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 result.json diff --git a/result.json b/result.json deleted file mode 100644 index d04adbb5b05..00000000000 --- a/result.json +++ /dev/null @@ -1 +0,0 @@ -{"headers": [{"tool_name": "scancode-toolkit", "tool_version": "v32.4.1-34-gedac742eaa", "options": {"input": [".\\samples"], "--json": ".\\result.json"}, "notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", "start_timestamp": "2025-12-10T185140.377956", "end_timestamp": "2025-12-10T185140.642211", "output_format_version": "4.1.0", "duration": 0.2642548084259033, "message": null, "errors": [], "warnings": [], "extra_data": {"system_environment": {"operating_system": "win", "cpu_architecture": "64", "platform": "Windows-11-10.0.22631-SP0", "platform_version": "10.0.22631", "python_version": "3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]"}, "spdx_license_list_version": "3.27", "files_count": 33}}], "files": [{"path": "samples", "type": "directory", "scan_errors": []}, {"path": "samples/README", "type": "file", "scan_errors": []}, {"path": "samples/screenshot.png", "type": "file", "scan_errors": []}, {"path": "samples/arch", "type": "directory", "scan_errors": []}, {"path": "samples/arch/zlib.tar.gz", "type": "file", "scan_errors": []}, {"path": "samples/JGroups", "type": "directory", "scan_errors": []}, {"path": "samples/JGroups/EULA", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/LICENSE", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses", "type": "directory", "scan_errors": []}, {"path": "samples/JGroups/licenses/apache-1.1.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/apache-2.0.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/bouncycastle.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/cpl-1.0.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/licenses/lgpl.txt", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src", "type": "directory", "scan_errors": []}, {"path": "samples/JGroups/src/FixedMembershipToken.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/GuardedBy.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/ImmutableReference.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/RATE_LIMITER.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/RouterStub.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/RouterStubManager.java", "type": "file", "scan_errors": []}, {"path": "samples/JGroups/src/S3_PING.java", "type": "file", "scan_errors": []}, {"path": "samples/zlib", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/adler32.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/deflate.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/deflate.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/zlib.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/zutil.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/zutil.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/ada", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/ada/zlib.ads", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/dotzlib/AssemblyInfo.cs", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib/ChecksumImpl.cs", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib/LICENSE_1_0.txt", "type": "file", "scan_errors": []}, {"path": "samples/zlib/dotzlib/readme.txt", "type": "file", "scan_errors": []}, {"path": "samples/zlib/gcc_gvmat64", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/gcc_gvmat64/gvmat64.S", "type": "file", "scan_errors": []}, {"path": "samples/zlib/infback9", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/infback9/infback9.c", "type": "file", "scan_errors": []}, {"path": "samples/zlib/infback9/infback9.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/iostream2", "type": "directory", "scan_errors": []}, {"path": "samples/zlib/iostream2/zstream.h", "type": "file", "scan_errors": []}, {"path": "samples/zlib/iostream2/zstream_test.cpp", "type": "file", "scan_errors": []}]} \ No newline at end of file From 51891756361b160c39684ead7c21a32ee48a961a Mon Sep 17 00:00:00 2001 From: Yashvijain1234 Date: Wed, 17 Dec 2025 22:04:30 +0530 Subject: [PATCH 3/3] chore: remove accidentally committed result.json Signed-off-by: Yashvijain1234