Skip to content

Commit 92b2269

Browse files
Yashvijain1234Yashvijain1234
authored andcommitted
Added documentation_url field to Package model
Signed-off-by: Yashvijain1234 <yashvijain1234@example.com>
1 parent edac742 commit 92b2269

16 files changed

Lines changed: 23 additions & 11 deletions

File tree

result.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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": []}]}

src/packagedcode/cargo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ def parse(cls, location, package_only=False):
228228

229229
vcs_url = core_package_data.get('repository')
230230
homepage_url = core_package_data.get('homepage')
231+
documentation_url = core_package_data.get('documentation')
231232
repository_homepage_url = name and f'https://crates.io/crates/{name}'
232233
repository_download_url = name and version and f'https://crates.io/api/v1/crates/{name}/{version}/download'
233234
api_data_url = name and f'https://crates.io/api/v1/crates/{name}'
234235

235236
extra_data_mappings = {
236-
"documentation": "documentation_url",
237237
"rust-version": "rust_version",
238238
"edition": "rust_edition",
239239
}
@@ -254,6 +254,7 @@ def parse(cls, location, package_only=False):
254254
extracted_license_statement=extracted_license_statement,
255255
vcs_url=vcs_url,
256256
homepage_url=homepage_url,
257+
documentation_url=documentation_url,
257258
repository_homepage_url=repository_homepage_url,
258259
repository_download_url=repository_download_url,
259260
api_data_url=api_data_url,

src/packagedcode/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,10 @@ class PackageData(IdentifiablePackageData):
618618
'See SPDX specification "Package Download Location" '
619619
'at https://spdx.org/spdx-specification-21-web-version#h.49x2ik5 ')
620620

621+
documentation_url = String(
622+
label='documentation URL',
623+
help='URL to the documentation for this package.')
624+
621625
copyright = String(
622626
label='Copyright',
623627
help='Copyright statements for this package. Typically one per line.')

tests/packagedcode/data/cargo/cargo_toml/boring-child/Cargo.toml.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"bug_tracking_url": null,
4747
"code_view_url": null,
4848
"vcs_url": null,
49+
"documentation_url": "https://docs.rs/boring-sys",
4950
"copyright": null,
5051
"holder": null,
5152
"declared_license_expression": "mit",
@@ -86,8 +87,7 @@
8687
"extra_data": {
8788
"version": "workspace",
8889
"repository": "workspace",
89-
"edition": "workspace",
90-
"documentation_url": "https://docs.rs/boring-sys"
90+
"edition": "workspace"
9191
},
9292
"dependencies": [
9393
{

tests/packagedcode/data/cargo/cargo_toml/boring-main/Cargo.toml.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"bug_tracking_url": null,
2222
"code_view_url": null,
2323
"vcs_url": null,
24+
"documentation_url": null,
2425
"copyright": null,
2526
"holder": null,
2627
"declared_license_expression": null,

tests/packagedcode/data/cargo/cargo_toml/clap/Cargo.toml.expected

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"bug_tracking_url": null,
3737
"code_view_url": null,
3838
"vcs_url": "https://github.com/clap-rs/clap",
39+
"documentation_url": "https://docs.rs/clap/",
3940
"copyright": null,
4041
"holder": null,
4142
"declared_license_expression": "mit",
@@ -73,9 +74,7 @@
7374
"file_references": [],
7475
"is_private": false,
7576
"is_virtual": false,
76-
"extra_data": {
77-
"documentation_url": "https://docs.rs/clap/"
78-
},
77+
"extra_data": {},
7978
"dependencies": [
8079
{
8180
"purl": "pkg:cargo/bitflags",

tests/packagedcode/data/cargo/cargo_toml/clippy/Cargo.toml.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"bug_tracking_url": null,
6464
"code_view_url": null,
6565
"vcs_url": "https://github.com/rust-lang/rust-clippy",
66+
"documentation_url": null,
6667
"copyright": null,
6768
"holder": null,
6869
"declared_license_expression": "mit OR apache-2.0",

tests/packagedcode/data/cargo/cargo_toml/mdbook/Cargo.toml.expected

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"bug_tracking_url": null,
4949
"code_view_url": null,
5050
"vcs_url": "https://github.com/rust-lang-nursery/mdBook",
51+
"documentation_url": "http://rust-lang-nursery.github.io/mdBook/index.html",
5152
"copyright": null,
5253
"holder": null,
5354
"declared_license_expression": "mpl-2.0",
@@ -85,9 +86,7 @@
8586
"file_references": [],
8687
"is_private": false,
8788
"is_virtual": false,
88-
"extra_data": {
89-
"documentation_url": "http://rust-lang-nursery.github.io/mdBook/index.html"
90-
},
89+
"extra_data": {},
9190
"dependencies": [
9291
{
9392
"purl": "pkg:cargo/clap",

tests/packagedcode/data/cargo/cargo_toml/rustfmt/Cargo.toml.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"bug_tracking_url": null,
3939
"code_view_url": null,
4040
"vcs_url": "https://github.com/rust-lang/rustfmt",
41+
"documentation_url": null,
4142
"copyright": null,
4243
"holder": null,
4344
"declared_license_expression": "apache-2.0 OR mit",

tests/packagedcode/data/cargo/cargo_toml/rustup/Cargo.toml.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"bug_tracking_url": null,
3535
"code_view_url": null,
3636
"vcs_url": "https://github.com/rust-lang/rustup.rs",
37+
"documentation_url": "http://rust-lang.github.io/rustup.rs/rustup/index.html",
3738
"copyright": null,
3839
"holder": null,
3940
"declared_license_expression": "mit OR apache-2.0",
@@ -77,7 +78,6 @@
7778
"src/download"
7879
]
7980
},
80-
"documentation_url": "http://rust-lang.github.io/rustup.rs/rustup/index.html",
8181
"rust_edition": "2018"
8282
},
8383
"dependencies": [

0 commit comments

Comments
 (0)