diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 455fb2cf3..3b220faec 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,8 @@ ### Unreleased +- Upgrade ScanCode-toolkit to version 30.1.0 + - Add a SCANCODEIO_REST_API_PAGE_SIZE setting to control the number of objects returned per page in the REST API. https://github.com/nexB/scancode.io/issues/328 diff --git a/etc/thirdparty/virtualenv.pyz b/etc/thirdparty/virtualenv.pyz index 939b51a25..1f230017e 100644 Binary files a/etc/thirdparty/virtualenv.pyz and b/etc/thirdparty/virtualenv.pyz differ diff --git a/etc/thirdparty/virtualenv.pyz.ABOUT b/etc/thirdparty/virtualenv.pyz.ABOUT index e6d1a387b..19fed672a 100644 --- a/etc/thirdparty/virtualenv.pyz.ABOUT +++ b/etc/thirdparty/virtualenv.pyz.ABOUT @@ -1,7 +1,7 @@ about_resource: virtualenv.pyz name: get-virtualenv -version: 20.7.0 -download_url: https://github.com/pypa/get-virtualenv/raw/20.7.0/public/virtualenv.pyz +version: 20.8.0 +download_url: https://github.com/pypa/get-virtualenv/raw/20.8.0/public/virtualenv.pyz description: virtualenv is a tool to create isolated Python environments. homepage_url: https://github.com/pypa/virtualenv license_expression: lgpl-2.1-plus AND (bsd-new OR apache-2.0) AND mit AND python AND bsd-new @@ -10,4 +10,4 @@ copyright: Copyright (c) The Python Software Foundation and others redistribute: yes attribute: yes track_changes: yes -package_url: pkg:github/pypa/get-virtualenv@20.7.0#public/virtualenv.pyz \ No newline at end of file +package_url: pkg:github/pypa/get-virtualenv@20.8.0#public/virtualenv.pyz \ No newline at end of file diff --git a/scancodeio/__init__.py b/scancodeio/__init__.py index ef85eda8c..dc6a28a22 100644 --- a/scancodeio/__init__.py +++ b/scancodeio/__init__.py @@ -22,6 +22,7 @@ import os import sys +import warnings from pathlib import Path from django.conf import settings @@ -35,6 +36,10 @@ SCAN_NOTICE = Path(__file__).resolve().parent.joinpath("scan.NOTICE").read_text() +# Turn off the warnings from the `parameter_expansion` module. +warnings.filterwarnings("ignore", module="parameter_expansion") + + # Resolve and set the workspace location from the settings. WORKSPACE_LOCATION = str(Path(settings.SCANCODEIO_WORKSPACE_LOCATION).resolve()) diff --git a/scanpipe/tests/data/is-npm-1.0.0_scan_codebase.json b/scanpipe/tests/data/is-npm-1.0.0_scan_codebase.json index 4ab662d5d..d4fd26e16 100644 --- a/scanpipe/tests/data/is-npm-1.0.0_scan_codebase.json +++ b/scanpipe/tests/data/is-npm-1.0.0_scan_codebase.json @@ -2,29 +2,30 @@ "headers": [ { "tool_name": "scancode-toolkit", - "tool_version": "21.8.4", + "tool_version": "30.0.0", "options": { "input": [ - "/private/var/folders/9g/tyhtzf892s7fz0slkrjr00y80000gn/T/tmpvmetnjpz/projects/analysis-e162d559/codebase" + "/private/var/folders/9g/tyhtzf892s7fz0slkrjr00y80000gn/T/tmp4amsms81/projects/analysis-1bc069d1/codebase" ], "--copyright": true, "--email": true, "--info": true, - "--json-pp": "/private/var/folders/9g/tyhtzf892s7fz0slkrjr00y80000gn/T/tmpvmetnjpz/projects/analysis-e162d559/output/scancode-2021-08-31-13-17-58.json", + "--json-pp": "/private/var/folders/9g/tyhtzf892s7fz0slkrjr00y80000gn/T/tmp4amsms81/projects/analysis-1bc069d1/output/scancode-2021-09-24-07-35-06.json", "--license": true, "--license-text": true, "--package": true, - "--processes": "4", "--url": true, "--verbose": true }, "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": "2021-08-31T131759.285074", - "end_timestamp": "2021-08-31T131801.286781", - "duration": 2.001734972000122, + "start_timestamp": "2021-09-24T073507.973838", + "end_timestamp": "2021-09-24T073510.775932", + "output_format_version": "1.0.0", + "duration": 2.8021748065948486, "message": null, "errors": [], "extra_data": { + "spdx_license_list_version": "3.14", "files_count": 4 } } @@ -71,7 +72,7 @@ "base_name": "is-npm-1.0.0", "extension": ".tgz", "size": 756, - "date": "2021-08-31", + "date": "2021-09-24", "sha1": "f2fb63a65e4905b406c86072765a1a4dc793b9f4", "md5": "effb58881c1aca12da9d3a18335bdc3f", "sha256": "89906b3f5e7c0bdc75d22ea509870f14b8164394e9e344f8c2ea8c590e550b14", @@ -228,6 +229,7 @@ "short_name": "MIT License", "category": "Permissive", "is_exception": false, + "is_unknown": false, "owner": "MIT", "homepage_url": "http://opensource.org/licenses/mit-license.php", "text_url": "http://opensource.org/licenses/mit-license.php", @@ -244,11 +246,13 @@ "licenses": [ "mit" ], + "referenced_filenames": [], "is_license_text": false, "is_license_notice": false, "is_license_reference": false, "is_license_tag": true, "is_license_intro": false, + "has_unknown": false, "matcher": "2-aho", "rule_length": 2, "matched_length": 2, @@ -376,6 +380,7 @@ "short_name": "MIT License", "category": "Permissive", "is_exception": false, + "is_unknown": false, "owner": "MIT", "homepage_url": "http://opensource.org/licenses/mit-license.php", "text_url": "http://opensource.org/licenses/mit-license.php", @@ -392,11 +397,13 @@ "licenses": [ "mit" ], + "referenced_filenames": [], "is_license_text": false, "is_license_notice": false, "is_license_reference": false, "is_license_tag": true, "is_license_intro": false, + "has_unknown": false, "matcher": "2-aho", "rule_length": 2, "matched_length": 2, diff --git a/scanpipe/tests/data/is-npm-1.0.0_scan_package.json b/scanpipe/tests/data/is-npm-1.0.0_scan_package.json index 1ce03638c..fdf6bdc76 100644 --- a/scanpipe/tests/data/is-npm-1.0.0_scan_package.json +++ b/scanpipe/tests/data/is-npm-1.0.0_scan_package.json @@ -2,10 +2,10 @@ "headers": [ { "tool_name": "scancode-toolkit", - "tool_version": "21.7.30", + "tool_version": "30.1.0", "options": { "input": [ - "/tmp/tmpkzp1f_pw/projects/analysis-03087122/codebase" + "/tmp/tmp9zcsy8i8/projects/analysis-97db36b0/codebase" ], "--classify": true, "--consolidate": true, @@ -13,22 +13,26 @@ "--email": true, "--info": true, "--is-license-text": true, - "--json-pp": "/tmp/tmpkzp1f_pw/projects/analysis-03087122/output/scancode-2021-08-03-19-09-26.json", + "--json-pp": "/tmp/tmp9zcsy8i8/projects/analysis-97db36b0/output/scancode-2021-09-25-12-04-14.json", "--license": true, "--license-clarity-score": true, "--license-text": true, "--package": true, + "--processes": "7", "--summary": true, "--summary-key-files": true, - "--url": true + "--url": true, + "--verbose": true }, "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": "2021-08-03T190927.407466", - "end_timestamp": "2021-08-03T190932.182255", - "duration": 4.774801015853882, + "start_timestamp": "2021-09-25T120415.382131", + "end_timestamp": "2021-09-25T120417.572376", + "output_format_version": "1.0.0", + "duration": 2.1902544498443604, "message": null, "errors": [], "extra_data": { + "spdx_license_list_version": "3.14", "files_count": 3 } } @@ -116,10 +120,6 @@ { "value": "mit", "count": 2 - }, - { - "value": null, - "count": 1 } ], "copyrights": [ @@ -149,10 +149,6 @@ } ], "programming_language": [ - { - "value": null, - "count": 2 - }, { "value": "JavaScript", "count": 1 @@ -245,37 +241,19 @@ } ], "copyrights": [ - { - "value": null, - "count": 1 - }, { "value": "(c) Sindre Sorhus (http://sindresorhus.com)", "count": 1 } ], "holders": [ - { - "value": null, - "count": 1 - }, { "value": "Sindre Sorhus", "count": 1 } ], - "authors": [ - { - "value": null, - "count": 2 - } - ], - "programming_language": [ - { - "value": null, - "count": 2 - } - ] + "authors": [], + "programming_language": [] }, "files": [ { @@ -433,6 +411,7 @@ "short_name": "MIT License", "category": "Permissive", "is_exception": false, + "is_unknown": false, "owner": "MIT", "homepage_url": "http://opensource.org/licenses/mit-license.php", "text_url": "http://opensource.org/licenses/mit-license.php", @@ -449,11 +428,13 @@ "licenses": [ "mit" ], + "referenced_filenames": [], "is_license_text": false, "is_license_notice": false, "is_license_reference": false, "is_license_tag": true, "is_license_intro": false, + "has_unknown": false, "matcher": "2-aho", "rule_length": 2, "matched_length": 2, @@ -596,6 +577,7 @@ "short_name": "MIT License", "category": "Permissive", "is_exception": false, + "is_unknown": false, "owner": "MIT", "homepage_url": "http://opensource.org/licenses/mit-license.php", "text_url": "http://opensource.org/licenses/mit-license.php", @@ -612,11 +594,13 @@ "licenses": [ "mit" ], + "referenced_filenames": [], "is_license_text": false, "is_license_notice": false, "is_license_reference": false, "is_license_tag": true, "is_license_intro": false, + "has_unknown": false, "matcher": "2-aho", "rule_length": 2, "matched_length": 2, diff --git a/scanpipe/tests/data/is-npm-1.0.0_scan_package_summary.json b/scanpipe/tests/data/is-npm-1.0.0_scan_package_summary.json index 2ca0337bf..249faf141 100644 --- a/scanpipe/tests/data/is-npm-1.0.0_scan_package_summary.json +++ b/scanpipe/tests/data/is-npm-1.0.0_scan_package_summary.json @@ -1,375 +1,373 @@ { - "license_expressions": [ - { - "value": "mit", - "count": 2 - }, + "license_expressions": [ + { + "value": "mit", + "count": 2 + } + ], + "copyrights": [ + { + "value": null, + "count": 2 + }, + { + "value": "(c) Sindre Sorhus (http://sindresorhus.com)", + "count": 1 + } + ], + "holders": [ + { + "value": null, + "count": 2 + }, + { + "value": "Sindre Sorhus", + "count": 1 + } + ], + "authors": [ + { + "value": null, + "count": 3 + } + ], + "programming_language": [ + { + "value": "JavaScript", + "count": 1 + } + ], + "packages": [ + { + "type": "npm", + "namespace": null, + "name": "is-npm", + "version": "1.0.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": "Check if your code is running as an npm script", + "release_date": null, + "parties": [ { - "value": null, - "count": 1 + "type": "person", + "role": "author", + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" } - ], - "copyrights": [ + ], + "keywords": [ + "npm", + "is", + "check", + "detect", + "env", + "environment" + ], + "homepage_url": null, + "download_url": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": "https://github.com/sindresorhus/is-npm", + "copyright": null, + "license_expression": "mit", + "declared_license": [ + "MIT" + ], + "notice_text": null, + "root_path": "codebase/package", + "dependencies": [ { - "value": null, - "count": 2 - }, + "purl": "pkg:npm/ava", + "requirement": "0.0.3", + "scope": "devDependencies", + "is_runtime": false, + "is_optional": true, + "is_resolved": false + } + ], + "contains_source_code": null, + "source_packages": [], + "extra_data": {}, + "purl": "pkg:npm/is-npm@1.0.0", + "repository_homepage_url": "https://www.npmjs.com/package/is-npm", + "repository_download_url": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "api_data_url": "https://registry.npmjs.org/is-npm/1.0.0", + "files": [ { - "value": "(c) Sindre Sorhus (http://sindresorhus.com)", - "count": 1 + "path": "codebase/package/package.json", + "type": "file" } - ], - "holders": [ + ] + } + ], + "license_clarity_score": { + "score": 30, + "declared": true, + "discovered": 0, + "consistency": false, + "spdx": false, + "license_texts": false + }, + "license_matches": { + "mit": [ + { + "path": "package/package.json", + "matched_text": " \"license\": \"MIT\"," + }, + { + "path": "package/readme.md", + "matched_text": "## License\n\nMIT \u00a9 [Sindre Sorhus](http://sindresorhus.com)" + } + ] + }, + "key_files": [ + { + "for_packages": [ + "pkg:npm/is-npm@1.0.0" + ], + "compliance_alert": "missing", + "path": "package/package.json", + "size": 563, + "sha1": "943efb8abda9b9cdaa4ea73f5709563b948af50b", + "md5": "c843e88ecb274d5d573c71be330bff8b", + "extra_data": {}, + "copyrights": [], + "holders": [], + "authors": [], + "licenses": [ { - "value": null, - "count": 2 - }, + "key": "mit", + "name": "MIT License", + "owner": "MIT", + "score": 100.0, + "policy": null, + "category": "Permissive", + "end_line": 5, + "spdx_url": "https://spdx.org/licenses/MIT", + "text_url": "http://opensource.org/licenses/mit-license.php", + "is_unknown": false, + "short_name": "MIT License", + "start_line": 5, + "homepage_url": "http://opensource.org/licenses/mit-license.php", + "is_exception": false, + "matched_rule": { + "matcher": "2-aho", + "licenses": [ + "mit" + ], + "identifier": "mit_30.RULE", + "has_unknown": false, + "rule_length": 2, + "is_license_tag": true, + "match_coverage": 100.0, + "matched_length": 2, + "rule_relevance": 100, + "is_license_text": false, + "is_license_intro": false, + "is_license_notice": false, + "license_expression": "mit", + "is_license_reference": false, + "referenced_filenames": [] + }, + "matched_text": " \"license\": \"MIT\",", + "reference_url": "https://scancode-licensedb.aboutcode.org/mit", + "spdx_license_key": "MIT", + "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml", + "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" + } + ], + "license_expressions": [ + "mit" + ], + "emails": [ { - "value": "Sindre Sorhus", - "count": 1 + "email": "sindresorhus@gmail.com", + "end_line": 9, + "start_line": 9 } - ], - "authors": [ + ], + "urls": [ { - "value": null, - "count": 3 + "url": "http://sindresorhus.com/", + "end_line": 10, + "start_line": 10 } - ], - "programming_language": [ + ], + "status": "application-package", + "type": "file", + "name": "package.json", + "extension": ".json", + "programming_language": "", + "mime_type": "application/json", + "file_type": "JSON data", + "is_binary": false, + "is_text": true, + "is_archive": false, + "is_key_file": true, + "is_media": false, + "content": "{\n \"name\": \"is-npm\",\n \"version\": \"1.0.0\",\n \"description\": \"Check if your code is running as an npm script\",\n \"license\": \"MIT\",\n \"repository\": \"sindresorhus/is-npm\",\n \"author\": {\n \"name\": \"Sindre Sorhus\",\n \"email\": \"sindresorhus@gmail.com\",\n \"url\": \"http://sindresorhus.com\"\n },\n \"engines\": {\n \"node\": \">=0.10.0\"\n },\n \"scripts\": {\n \"test\": \"node test.js\"\n },\n \"files\": [\n \"index.js\"\n ],\n \"keywords\": [\n \"npm\",\n \"is\",\n \"check\",\n \"detect\",\n \"env\",\n \"environment\"\n ],\n \"devDependencies\": {\n \"ava\": \"0.0.3\"\n }\n}\n" + }, + { + "for_packages": [], + "compliance_alert": "missing", + "path": "package/readme.md", + "size": 477, + "sha1": "b77832e53cb8239edd733c2ca02b1fc01ca3c2b6", + "md5": "a743e0abf08c28a37ecc4bef4dc02f8c", + "extra_data": {}, + "copyrights": [ { - "value": null, - "count": 2 - }, + "value": "(c) Sindre Sorhus (http://sindresorhus.com)", + "end_line": 30, + "start_line": 30 + } + ], + "holders": [ { - "value": "JavaScript", - "count": 1 + "value": "Sindre Sorhus", + "end_line": 30, + "start_line": 30 } - ], - "packages": [ + ], + "authors": [], + "licenses": [ { - "type": "npm", - "namespace": null, - "name": "is-npm", - "version": "1.0.0", - "qualifiers": {}, - "subpath": null, - "primary_language": "JavaScript", - "description": "Check if your code is running as an npm script", - "release_date": null, - "parties": [ - { - "type": "person", - "role": "author", - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - } - ], - "keywords": [ - "npm", - "is", - "check", - "detect", - "env", - "environment" + "key": "mit", + "name": "MIT License", + "owner": "MIT", + "score": 100.0, + "policy": null, + "category": "Permissive", + "end_line": 30, + "spdx_url": "https://spdx.org/licenses/MIT", + "text_url": "http://opensource.org/licenses/mit-license.php", + "is_unknown": false, + "short_name": "MIT License", + "start_line": 28, + "homepage_url": "http://opensource.org/licenses/mit-license.php", + "is_exception": false, + "matched_rule": { + "matcher": "2-aho", + "licenses": [ + "mit" ], - "homepage_url": null, - "download_url": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", - "size": null, - "sha1": null, - "md5": null, - "sha256": null, - "sha512": null, - "bug_tracking_url": null, - "code_view_url": null, - "vcs_url": "https://github.com/sindresorhus/is-npm", - "copyright": null, + "identifier": "mit_30.RULE", + "has_unknown": false, + "rule_length": 2, + "is_license_tag": true, + "match_coverage": 100.0, + "matched_length": 2, + "rule_relevance": 100, + "is_license_text": false, + "is_license_intro": false, + "is_license_notice": false, "license_expression": "mit", - "declared_license": [ - "MIT" - ], - "notice_text": null, - "root_path": "codebase/package", - "dependencies": [ - { - "purl": "pkg:npm/ava", - "requirement": "0.0.3", - "scope": "devDependencies", - "is_runtime": false, - "is_optional": true, - "is_resolved": false - } - ], - "contains_source_code": null, - "source_packages": [], - "extra_data": {}, - "purl": "pkg:npm/is-npm@1.0.0", - "repository_homepage_url": "https://www.npmjs.com/package/is-npm", - "repository_download_url": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", - "api_data_url": "https://registry.npmjs.org/is-npm/1.0.0", - "files": [ - { - "path": "codebase/package/package.json", - "type": "file" - } - ] + "is_license_reference": false, + "referenced_filenames": [] + }, + "matched_text": "## License\n\nMIT \u00a9 [Sindre Sorhus](http://sindresorhus.com)", + "reference_url": "https://scancode-licensedb.aboutcode.org/mit", + "spdx_license_key": "MIT", + "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml", + "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" } - ], - "license_clarity_score": { - "score": 30, - "declared": true, - "discovered": 0, - "consistency": false, - "spdx": false, - "license_texts": false - }, - "license_matches": { - "mit": [ - { - "path": "package/package.json", - "matched_text": " \"license\": \"MIT\"," - }, - { - "path": "package/readme.md", - "matched_text": "## License\n\nMIT \u00a9 [Sindre Sorhus](http://sindresorhus.com)" - } - ] - }, - "key_files": [ + ], + "license_expressions": [ + "mit" + ], + "emails": [], + "urls": [ { - "for_packages": [ - "pkg:npm/is-npm@1.0.0" - ], - "compliance_alert": "missing", - "path": "package/package.json", - "size": 563, - "sha1": "943efb8abda9b9cdaa4ea73f5709563b948af50b", - "md5": "c843e88ecb274d5d573c71be330bff8b", - "extra_data": {}, - "copyrights": [], - "holders": [], - "authors": [], - "licenses": [ - { - "key": "mit", - "name": "MIT License", - "owner": "MIT", - "score": 100.0, - "policy": null, - "category": "Permissive", - "end_line": 5, - "spdx_url": "https://spdx.org/licenses/MIT", - "text_url": "http://opensource.org/licenses/mit-license.php", - "short_name": "MIT License", - "start_line": 5, - "homepage_url": "http://opensource.org/licenses/mit-license.php", - "is_exception": false, - "matched_rule": { - "matcher": "2-aho", - "licenses": [ - "mit" - ], - "identifier": "mit_30.RULE", - "rule_length": 2, - "is_license_tag": true, - "match_coverage": 100.0, - "matched_length": 2, - "rule_relevance": 100, - "is_license_text": false, - "is_license_intro": false, - "is_license_notice": false, - "license_expression": "mit", - "is_license_reference": false - }, - "matched_text": " \"license\": \"MIT\",", - "reference_url": "https://scancode-licensedb.aboutcode.org/mit", - "spdx_license_key": "MIT", - "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml", - "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" - } - ], - "license_expressions": [ - "mit" - ], - "emails": [ - { - "email": "sindresorhus@gmail.com", - "end_line": 9, - "start_line": 9 - } - ], - "urls": [ - { - "url": "http://sindresorhus.com/", - "end_line": 10, - "start_line": 10 - } - ], - "status": "application-package", - "type": "file", - "name": "package.json", - "extension": ".json", - "programming_language": "", - "mime_type": "application/json", - "file_type": "JSON data", - "is_binary": false, - "is_text": true, - "is_archive": false, - "is_key_file": true, - "is_media": false, - "content": "{\n \"name\": \"is-npm\",\n \"version\": \"1.0.0\",\n \"description\": \"Check if your code is running as an npm script\",\n \"license\": \"MIT\",\n \"repository\": \"sindresorhus/is-npm\",\n \"author\": {\n \"name\": \"Sindre Sorhus\",\n \"email\": \"sindresorhus@gmail.com\",\n \"url\": \"http://sindresorhus.com\"\n },\n \"engines\": {\n \"node\": \">=0.10.0\"\n },\n \"scripts\": {\n \"test\": \"node test.js\"\n },\n \"files\": [\n \"index.js\"\n ],\n \"keywords\": [\n \"npm\",\n \"is\",\n \"check\",\n \"detect\",\n \"env\",\n \"environment\"\n ],\n \"devDependencies\": {\n \"ava\": \"0.0.3\"\n }\n}\n" + "url": "https://travis-ci.org/sindresorhus/is-npm.svg?branch=master", + "end_line": 1, + "start_line": 1 }, { - "for_packages": [], - "compliance_alert": "missing", - "path": "package/readme.md", - "size": 477, - "sha1": "b77832e53cb8239edd733c2ca02b1fc01ca3c2b6", - "md5": "a743e0abf08c28a37ecc4bef4dc02f8c", - "extra_data": {}, - "copyrights": [ - { - "value": "(c) Sindre Sorhus (http://sindresorhus.com)", - "end_line": 30, - "start_line": 30 - } - ], - "holders": [ - { - "value": "Sindre Sorhus", - "end_line": 30, - "start_line": 30 - } - ], - "authors": [], - "licenses": [ - { - "key": "mit", - "name": "MIT License", - "owner": "MIT", - "score": 100.0, - "policy": null, - "category": "Permissive", - "end_line": 30, - "spdx_url": "https://spdx.org/licenses/MIT", - "text_url": "http://opensource.org/licenses/mit-license.php", - "short_name": "MIT License", - "start_line": 28, - "homepage_url": "http://opensource.org/licenses/mit-license.php", - "is_exception": false, - "matched_rule": { - "matcher": "2-aho", - "licenses": [ - "mit" - ], - "identifier": "mit_30.RULE", - "rule_length": 2, - "is_license_tag": true, - "match_coverage": 100.0, - "matched_length": 2, - "rule_relevance": 100, - "is_license_text": false, - "is_license_intro": false, - "is_license_notice": false, - "license_expression": "mit", - "is_license_reference": false - }, - "matched_text": "## License\n\nMIT \u00a9 [Sindre Sorhus](http://sindresorhus.com)", - "reference_url": "https://scancode-licensedb.aboutcode.org/mit", - "spdx_license_key": "MIT", - "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml", - "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" - } - ], - "license_expressions": [ - "mit" - ], - "emails": [], - "urls": [ - { - "url": "https://travis-ci.org/sindresorhus/is-npm.svg?branch=master", - "end_line": 1, - "start_line": 1 - }, - { - "url": "https://travis-ci.org/sindresorhus/is-npm", - "end_line": 1, - "start_line": 1 - }, - { - "url": "https://www.npmjs.org/doc/misc/npm-scripts.html", - "end_line": 3, - "start_line": 3 - }, - { - "url": "http://sindresorhus.com/", - "end_line": 30, - "start_line": 30 - } - ], - "status": "", - "type": "file", - "name": "readme.md", - "extension": ".md", - "programming_language": "", - "mime_type": "text/plain", - "file_type": "UTF-8 Unicode text", - "is_binary": false, - "is_text": true, - "is_archive": false, - "is_key_file": true, - "is_media": false, - "content": "# is-npm [![Build Status](https://travis-ci.org/sindresorhus/is-npm.svg?branch=master)](https://travis-ci.org/sindresorhus/is-npm)\n\n> Check if your code is running as an [npm script](https://www.npmjs.org/doc/misc/npm-scripts.html)\n\n\n## Install\n\n```sh\n$ npm install --save is-npm\n```\n\n\n## Usage\n\n```js\nvar isNpm = require('is-npm');\nconsole.log(isNpm);\n```\n\n```sh\n$ node foo.js\n#=> false\n$ npm run foo\n#=> true\n```\n\n\n## License\n\nMIT \u00a9 [Sindre Sorhus](http://sindresorhus.com)\n" + "url": "https://travis-ci.org/sindresorhus/is-npm", + "end_line": 1, + "start_line": 1 + }, + { + "url": "https://www.npmjs.org/doc/misc/npm-scripts.html", + "end_line": 3, + "start_line": 3 + }, + { + "url": "http://sindresorhus.com/", + "end_line": 30, + "start_line": 30 } - ], - "key_files_packages": [ + ], + "status": "", + "type": "file", + "name": "readme.md", + "extension": ".md", + "programming_language": "", + "mime_type": "text/plain", + "file_type": "UTF-8 Unicode text", + "is_binary": false, + "is_text": true, + "is_archive": false, + "is_key_file": true, + "is_media": false, + "content": "# is-npm [![Build Status](https://travis-ci.org/sindresorhus/is-npm.svg?branch=master)](https://travis-ci.org/sindresorhus/is-npm)\n\n> Check if your code is running as an [npm script](https://www.npmjs.org/doc/misc/npm-scripts.html)\n\n\n## Install\n\n```sh\n$ npm install --save is-npm\n```\n\n\n## Usage\n\n```js\nvar isNpm = require('is-npm');\nconsole.log(isNpm);\n```\n\n```sh\n$ node foo.js\n#=> false\n$ npm run foo\n#=> true\n```\n\n\n## License\n\nMIT \u00a9 [Sindre Sorhus](http://sindresorhus.com)\n" + } + ], + "key_files_packages": [ + { + "purl": "pkg:npm/is-npm@1.0.0", + "type": "npm", + "namespace": "", + "name": "is-npm", + "version": "1.0.0", + "qualifiers": "", + "subpath": "", + "primary_language": "JavaScript", + "description": "Check if your code is running as an npm script", + "release_date": null, + "homepage_url": "", + "download_url": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "size": null, + "sha1": "", + "md5": "", + "bug_tracking_url": "", + "code_view_url": "", + "vcs_url": "https://github.com/sindresorhus/is-npm", + "copyright": "", + "license_expression": "mit", + "declared_license": "['MIT']", + "notice_text": "", + "manifest_path": "", + "contains_source_code": null, + "extra_data": {}, + "missing_resources": [], + "modified_resources": [], + "dependencies": [ { - "purl": "pkg:npm/is-npm@1.0.0", - "type": "npm", - "namespace": "", - "name": "is-npm", - "version": "1.0.0", - "qualifiers": "", - "subpath": "", - "primary_language": "JavaScript", - "description": "Check if your code is running as an npm script", - "release_date": null, - "homepage_url": "", - "download_url": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", - "size": null, - "sha1": "", - "md5": "", - "bug_tracking_url": "", - "code_view_url": "", - "vcs_url": "https://github.com/sindresorhus/is-npm", - "copyright": "", - "license_expression": "mit", - "declared_license": "['MIT']", - "notice_text": "", - "manifest_path": "", - "contains_source_code": null, - "extra_data": {}, - "missing_resources": [], - "modified_resources": [], - "dependencies": [ - { - "purl": "pkg:npm/ava", - "scope": "devDependencies", - "is_runtime": false, - "is_optional": true, - "is_resolved": false, - "requirement": "0.0.3" - } - ], - "keywords": [ - "npm", - "is", - "check", - "detect", - "env", - "environment" - ], - "source_packages": [] + "purl": "pkg:npm/ava", + "scope": "devDependencies", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "requirement": "0.0.3" } - ] + ], + "keywords": [ + "npm", + "is", + "check", + "detect", + "env", + "environment" + ], + "source_packages": [] + } + ] } \ No newline at end of file diff --git a/scanpipe/tests/test_pipelines.py b/scanpipe/tests/test_pipelines.py index a55dc9a19..b8b67b6ed 100644 --- a/scanpipe/tests/test_pipelines.py +++ b/scanpipe/tests/test_pipelines.py @@ -229,7 +229,8 @@ def _without_keys(self, data, exclude_keys): return data - def test_scanpipe_scan_package_pipeline_integration_test(self): + # Set regen to True to regenerate the expected results + def test_scanpipe_scan_package_pipeline_integration_test(self, regen=False): pipeline_name = "scan_package" project1 = Project.objects.create(name="Analysis") @@ -249,6 +250,8 @@ def test_scanpipe_scan_package_pipeline_integration_test(self): scancode_json = json.loads(scancode_file.read_text()) expected_file = self.data_location / "is-npm-1.0.0_scan_package.json" + if regen: + expected_file.write_text(json.dumps(scancode_json, indent=2)) expected_json = json.loads(expected_file.read_text()) scancode_data = self._without_keys(scancode_json, self.exclude_from_diff) @@ -260,6 +263,8 @@ def test_scanpipe_scan_package_pipeline_integration_test(self): summary_json = json.loads(summary_file.read_text()) expected_file = self.data_location / "is-npm-1.0.0_scan_package_summary.json" + if regen: + expected_file.write_text(json.dumps(summary_json, indent=2)) expected_json = json.loads(expected_file.read_text()) summary_data = self._without_keys(summary_json, self.exclude_from_diff) @@ -267,7 +272,8 @@ def test_scanpipe_scan_package_pipeline_integration_test(self): self.assertEqual(expected_data, summary_data) - def test_scanpipe_scan_codebase_pipeline_integration_test(self): + # Set regen to True to regenerate the expected results + def test_scanpipe_scan_codebase_pipeline_integration_test(self, regen=False): pipeline_name = "scan_codebase" project1 = Project.objects.create(name="Analysis") @@ -287,6 +293,8 @@ def test_scanpipe_scan_codebase_pipeline_integration_test(self): scancode_json = json.loads(scancode_file.read_text()) expected_file = self.data_location / "is-npm-1.0.0_scan_codebase.json" + if regen: + expected_file.write_text(json.dumps(scancode_json, indent=2)) expected_json = json.loads(expected_file.read_text()) scancode_data = self._without_keys(scancode_json, self.exclude_from_diff) diff --git a/scanpipe/tests/test_pipes.py b/scanpipe/tests/test_pipes.py index 47df87360..1d94516c2 100644 --- a/scanpipe/tests/test_pipes.py +++ b/scanpipe/tests/test_pipes.py @@ -352,7 +352,7 @@ def test_scanpipe_pipes_scancode_scan_file_and_save_results(self): "apache-2.0", "apache-2.0 AND scancode-acknowledgment", "apache-2.0", - "apache-2.0", + "warranty-disclaimer", ] self.assertEqual(expected, codebase_resource2.license_expressions) diff --git a/setup.cfg b/setup.cfg index 2ccb58d5f..3a29c68c1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ install_requires = importlib_metadata==3.10.0; python_version < "3.8" # Django related Django==3.2.7 - django-environ==0.6.0 + django-environ==0.7.0 django-crispy-forms==1.12.0 pytz==2021.1 django-filter==2.4.0 @@ -70,9 +70,8 @@ install_requires = # Docker container_inspector==21.6.10 # ScanCode-toolkit - scancode-toolkit[packages]==21.8.4 + scancode-toolkit[packages]==30.1.0 extractcode[full]==21.7.23 - commoncode==21.7.23 # FetchCode fetchcode-container==1.2.3.210512; sys_platform == "linux" # Utilities @@ -89,8 +88,8 @@ dev = isort==5.9.3 doc8==0.9.0 # Documentation - Sphinx==4.1.2 - sphinx_rtd_theme==0.5.2 + Sphinx==4.2.0 + sphinx_rtd_theme==1.0.0 sphinxcontrib-django2==1.1.1 # Release bumpver==2021.1113