diff --git a/setup.cfg b/setup.cfg index 3a095718c1b..0dd67661708 100644 --- a/setup.cfg +++ b/setup.cfg @@ -188,6 +188,7 @@ scancode_scan = # scan plugins and before the output plugins. See also plugincode.post_scan # module for details and doc. scancode_post_scan = + package_summary = packagedcode.plugin_package:PackageSummary summary = summarycode.summarizer:ScanSummary tallies = summarycode.tallies:Tallies tallies-with-details = summarycode.tallies:TalliesWithDetails diff --git a/src/packagedcode/models.py b/src/packagedcode/models.py index 17eea486d36..2e607bf844d 100644 --- a/src/packagedcode/models.py +++ b/src/packagedcode/models.py @@ -1563,15 +1563,20 @@ class Package(PackageData): label='datasource ids', help='List of the datasource ids used to create this package.' ) - + + license_clarity_score = attr.ib(default=attr.Factory(dict)) + def __attrs_post_init__(self, *args, **kwargs): if not self.purl: self.purl = self.set_purl() if not self.package_uid: self.package_uid = build_package_uid(self.purl) - def to_dict(self): - return super().to_dict(with_details=False) + def to_dict(self, package_summary=False): + data = super().to_dict(with_details=False) + if not package_summary: + data.pop("license_clarity_score") + return data def to_package_data(self): mapping = super().to_dict(with_details=True) diff --git a/src/packagedcode/plugin_package.py b/src/packagedcode/plugin_package.py index b1487022c40..f1ef16d6b03 100644 --- a/src/packagedcode/plugin_package.py +++ b/src/packagedcode/plugin_package.py @@ -13,14 +13,18 @@ import attr import click +import copy from commoncode.cliutils import PluggableCommandLineOption from commoncode.cliutils import DOC_GROUP from commoncode.cliutils import SCAN_GROUP +from commoncode.cliutils import POST_SCAN_GROUP from commoncode.resource import Resource from commoncode.resource import strip_first_path_segment from plugincode.scan import scan_impl +from plugincode.post_scan import post_scan_impl from plugincode.scan import ScanPlugin +from plugincode.post_scan import PostScanPlugin from licensedcode.cache import build_spdx_license_expression from licensedcode.cache import get_cache @@ -36,6 +40,8 @@ from packagedcode.models import Package from packagedcode.models import PackageData from packagedcode.models import PackageWithResources +from packagedcode.models import get_files_for_packages +from summarycode.score import compute_license_score TRACE = os.environ.get('SCANCODE_DEBUG_PACKAGE_API', False) TRACE_ASSEMBLY = os.environ.get('SCANCODE_DEBUG_PACKAGE_ASSEMBLY', False) @@ -200,7 +206,7 @@ def get_scanner(self, package=True, system_package=False, package_only=False, ** package_only=package_only, ) - def process_codebase(self, codebase, strip_root=False, package_only=False, **kwargs): + def process_codebase(self, codebase, strip_root=False, package_only=False, package_summary=False, **kwargs): """ Populate the ``codebase`` top level ``packages`` and ``dependencies`` with package and dependency instances, assembling parsed package data @@ -260,7 +266,7 @@ def process_codebase(self, codebase, strip_root=False, package_only=False, **kwa logger_debug(f'packagedcode: process_codebase: add_license_from_sibling_file: modified: {modified}') # Create codebase-level packages and dependencies - create_package_and_deps(codebase, strip_root=strip_root, **kwargs) + create_package_and_deps(codebase, package_summary, strip_root=strip_root, **kwargs) #raise Exception() if has_licenses: @@ -272,7 +278,80 @@ def process_codebase(self, codebase, strip_root=False, package_only=False, **kwa if TRACE_LICENSE and modified: logger_debug(f'packagedcode: process_codebase: add_referenced_license_matches_from_package: modified: {modified}') +def get_package_resources(codebase): + """ + Get resources for each package in the codebase. + """ + resource_for_packages = list(get_files_for_packages(codebase)) + package_resources = {} + + for resource, package_uid in resource_for_packages: + if package_uid not in package_resources: + package_resources[package_uid] = [] + package_resources[package_uid].append(resource) + + return package_resources + +@post_scan_impl +class PackageSummary(PostScanPlugin): + """ + Summary at the Package Level. + """ + run_order = 11 + sort_order = 11 + + options = [ + PluggableCommandLineOption(('--package-summary',), + is_flag=True, + default=False, + help='Summarize scans by providing License Clarity Score ' + 'and populating other license/copyright attributes ' + 'for package instances from their key files and other files.', + required_options=['classify', 'package'], + help_group=POST_SCAN_GROUP) + ] + + def is_enabled(self, package_summary, **kwargs): + return package_summary + def process_codebase(self, codebase, package_summary, **kwargs): + """ + Process the codebase. + """ + + packages = codebase.attributes.packages + package_resources = get_package_resources(codebase) + package_attributes_map = {} + attributes_to_update = [ + 'license_clarity_score', + 'copyright', + 'holder', + 'notice_text', + 'other_license_expression', + 'other_license_expression_spdx' + ] + + for package in packages: + package_uid = package['package_uid'] + if package_uid in package_resources: + package_resource = [resource for resource in package_resources[package_uid]] + + scoring_elements, package_attrs, _= compute_license_score(resources=package_resource) + license_clarity_score= scoring_elements.to_dict() + package_attributes_map[package_uid] = { + 'license_clarity_score': license_clarity_score, + 'copyright': package_attrs.copyright, + 'holder': package_attrs.holder, + 'notice_text': package_attrs.notice_text, + 'other_license_expression': package_attrs.other_license_expression, + 'other_license_expression_spdx': package_attrs.other_license_expression_spdx + } + if package_uid in package_attributes_map: + package_attrs = package_attributes_map[package_uid] + for attribute in attributes_to_update: + package[attribute] = package_attrs[attribute] + + def add_license_from_file(resource, codebase): """ Given a Resource, check if the detected package_data doesn't have license detections @@ -352,7 +431,7 @@ def get_installed_packages(root_dir, processes=2, **kwargs): yield from packages_by_uid.values() -def create_package_and_deps(codebase, package_adder=add_to_package, strip_root=False, **kwargs): +def create_package_and_deps(codebase, package_summary=False , package_adder=add_to_package, strip_root=False, **kwargs): """ Create and save top-level Package and Dependency from the parsed package data present in the codebase. @@ -363,8 +442,10 @@ def create_package_and_deps(codebase, package_adder=add_to_package, strip_root=F strip_root=strip_root, **kwargs ) - - codebase.attributes.packages.extend(package.to_dict() for package in packages) + codebase.attributes.packages.extend( + package.to_dict(package_summary= package_summary) + for package in packages + ) codebase.attributes.dependencies.extend(dep.to_dict() for dep in dependencies) diff --git a/src/packagedcode/pypi.py b/src/packagedcode/pypi.py index fec8575372e..0bca416e45a 100644 --- a/src/packagedcode/pypi.py +++ b/src/packagedcode/pypi.py @@ -435,8 +435,17 @@ def assign_package_to_resources(cls, package, resource, codebase, package_adder) ) if ref_resource and package_uid: package_adder(package_uid, ref_resource, codebase) - - + @classmethod + def get_top_level_resources(cls, manifest_resource, codebase): + if '.dist-info' in manifest_resource.path: + path_segments = manifest_resource.path.split('.dist-info') + leading_segment = path_segments[0].strip() + dist_info_dir_path = f'{leading_segment}.dist-info' + meta_inf_resource = codebase.get_resource(dist_info_dir_path) + if meta_inf_resource: + yield meta_inf_resource + yield from meta_inf_resource.walk(codebase) + def get_resource_for_path(path, root, codebase): """ Return a resource in ``codebase`` that has a ``path`` relative to the diff --git a/src/summarycode/score.py b/src/summarycode/score.py index b0fe826fa85..8f41e1b3a74 100644 --- a/src/summarycode/score.py +++ b/src/summarycode/score.py @@ -75,15 +75,16 @@ def is_enabled(self, license_clarity_score, **kwargs): def process_codebase(self, codebase, license_clarity_score, **kwargs): if TRACE: logger_debug('LicenseClarityScore:process_codebase') - scoring_elements, declared_license_expression = compute_license_score(codebase) + codebase_resources = get_codebase_resources(codebase) + scoring_elements,_, declared_license_expression = compute_license_score(resources= codebase_resources) codebase.attributes.summary['declared_license_expression'] = declared_license_expression codebase.attributes.summary['license_clarity_score'] = scoring_elements.to_dict() -def compute_license_score(codebase): +def compute_license_score(resources): """ Return a mapping of scoring elements and a license clarity score computed at - the codebase level. + the codebase/package level. The license clarity score is a value from 0-100 calculated by combining the weighted values determined for each of the scoring elements: @@ -128,29 +129,98 @@ def compute_license_score(codebase): """ scoring_elements = ScoringElements() - license_detections = get_field_values_from_codebase_resources( - codebase=codebase, + license_detections = get_field_values_from_resources( + resources, field_name='license_detections', key_files_only=True, ) license_match_mappings = get_matches_from_detection_mappings(license_detections) license_matches = LicenseMatchFromResult.from_dicts(license_match_mappings) - declared_license_expressions = get_field_values_from_codebase_resources( - codebase=codebase, + declared_license_expressions = get_field_values_from_resources( + resources, field_name='detected_license_expression', key_files_only=True, is_string=True, ) + declared_license_expressions_spdx=get_field_values_from_resources( + resources, + field_name='detected_license_expression_spdx', + key_files_only=True, + is_string=True, + ) unique_declared_license_expressions = unique(declared_license_expressions) + unique_declared_license_expressions_spdx= unique(declared_license_expressions_spdx) declared_license_categories = get_license_categories(license_matches) - copyrights = get_field_values_from_codebase_resources( - codebase=codebase, field_name='copyrights', key_files_only=True + copyrights = get_field_values_from_resources( + resources, + field_name='copyrights', + key_files_only=True, + ) + holders = get_field_values_from_resources( + resources, + field_name='holders', + key_files_only=True, + ) + notice_texts = get_field_values_from_resources( + resources, + field_name='notice_text', + key_files_only=True, + ) + other_license_expressions = get_field_values_from_resources( + resources, + field_name='detected_license_expression', + key_files_only=False, + is_string=True, + ) + other_license_expressions_spdx= get_field_values_from_resources( + resources, + field_name='detected_license_expression_spdx', + key_files_only=False, + is_string=True, + ) + + # Populating the Package Attributes + copyright_values = [copyright.get('copyright') for copyright in copyrights if copyright.get('copyright')] + joined_copyrights = ", ".join(copyright_values) if copyright_values else None + + holder_values = [holder.get('holder') for holder in holders if holder.get('holder')] + joined_holders = ", ".join(holder_values) if holder_values else None + + notice_text_values = [notice_text.get('notice_text') for notice_text in notice_texts if notice_text.get('notice_text')] + joined_notice_text = ", ".join(notice_text_values) if notice_text_values else None + + unique_other_license_expressions = unique(other_license_expressions) + unique_other_license_expressions_spdx= unique(other_license_expressions_spdx) + other_license_expressions=[] + other_license_expressions_spdx=[] + for other_license_expression in unique_other_license_expressions: + if other_license_expression not in unique_declared_license_expressions: + other_license_expressions.append(other_license_expression) + + for other_license_expression_spdx in unique_other_license_expressions_spdx: + if other_license_expression_spdx not in unique_declared_license_expressions_spdx: + other_license_expressions_spdx.append(other_license_expression_spdx) + + joined_other_license_expressions = ", ".join(other_license_expressions) if other_license_expressions else None + joined_other_license_expressions_spdx = ", ".join(other_license_expressions_spdx) if other_license_expressions_spdx else None + + if not joined_other_license_expressions: + joined_other_license_expressions = None + + packageAttrs= PackageSummaryAttributes( + copyright = joined_copyrights, + holder = joined_holders, + notice_text = joined_notice_text, + other_license_expression= joined_other_license_expressions, + other_license_expression_spdx= joined_other_license_expressions_spdx ) - other_license_detections = get_field_values_from_codebase_resources( - codebase=codebase, field_name='license_detections', key_files_only=False + other_license_detections = get_field_values_from_resources( + resources, + field_name='license_detections', + key_files_only=False, ) other_license_match_mappings = get_matches_from_detection_mappings(other_license_detections) other_license_matches = LicenseMatchFromResult.from_dicts(other_license_match_mappings) @@ -193,8 +263,8 @@ def compute_license_score(codebase): scoring_elements.ambiguous_compound_licensing = True if scoring_elements.score > 0: scoring_elements.score -= 10 - - return scoring_elements, declared_license_expression or None + + return scoring_elements, packageAttrs, declared_license_expression or None def unique(objects): @@ -231,6 +301,16 @@ def to_dict(self): 'ambiguous_compound_licensing': self.ambiguous_compound_licensing, } +@attr.s() +class PackageSummaryAttributes: + copyright= attr.ib(default=None) + holder= attr.ib(default=None) + notice_text= attr.ib(default=None) + other_license_expression= attr.ib(default=None) + other_license_expression_spdx= attr.ib(default=None) + + def to_dict(self): + return attr.asdict(self, dict_factory=dict) # minimum score to consider a license detection as good. @@ -304,17 +384,16 @@ def check_declared_licenses(license_match_objects): """ return any(is_good_license(license_match_object) for license_match_object in license_match_objects) - -def get_field_values_from_codebase_resources( - codebase, +def get_field_values_from_resources( + resources, field_name, key_files_only=False, - is_string=False + is_string=False, ): """ Return a list of values from the `field_name` field of the Resources from - `codebase` - + the provided `resources`. + If `key_files_only` is True, then we only return the field values from Resources classified as key files. @@ -322,23 +401,37 @@ def get_field_values_from_codebase_resources( that are not classified as key files. """ values = [] - for resource in codebase.walk(topdown=True): + for resource in resources: + resource_dict = resource.to_dict() + if key_files_only: - if not resource.is_key_file: + if not resource_dict.get('is_key_file', False): continue else: - if resource.is_key_file: + if resource_dict.get('is_key_file', False): continue if is_string: - value = getattr(resource, field_name, None) or None + value = resource_dict.get(field_name) if value: values.append(value) else: - for value in getattr(resource, field_name, []) or []: + for value in resource_dict.get(field_name, []): values.append(value) + return values +def get_codebase_resources(codebase): + """ + Get resources for the codebase. + """ + codebase_resources= [] + for resource in codebase.walk(topdown=True): + codebase_resources.append(resource) + + return codebase_resources + + def get_categories_from_match(license_match, licensing=Licensing()): """ Return a list of license category strings from a single LicenseMatch mapping. @@ -506,4 +599,4 @@ def get_primary_license(declared_license_expressions): if len(single_expressions_by_joined_expressions) == 1 and not not_in_joined_expressions: return next(iter(single_expressions_by_joined_expressions)) else: - return None + return None \ No newline at end of file diff --git a/src/summarycode/summarizer.py b/src/summarycode/summarizer.py index 3319670bfc8..a9a890b140f 100644 --- a/src/summarycode/summarizer.py +++ b/src/summarycode/summarizer.py @@ -21,7 +21,8 @@ from packagedcode import models from summarycode.copyright_tallies import canonical_holder from summarycode.score import compute_license_score -from summarycode.score import get_field_values_from_codebase_resources +from summarycode.score import get_field_values_from_resources +from summarycode.score import get_codebase_resources from summarycode.score import unique from summarycode.tallies import compute_codebase_tallies @@ -106,19 +107,19 @@ def process_codebase(self, codebase, summary, **kwargs): top_level_packages=top_level_packages, codebase=codebase, ) - + codebase_resources= get_codebase_resources(codebase) if declared_license_expression: - scoring_elements, _ = compute_license_score(codebase) + scoring_elements, _, _ = compute_license_score(resources=codebase_resources) else: # If we did not get a declared license expression from detected # package data, then we use the results from `compute_license_score` - scoring_elements, declared_license_expression = compute_license_score(codebase) + scoring_elements,_, declared_license_expression = compute_license_score(resources=codebase_resources) other_license_expressions = remove_from_tallies( declared_license_expression, license_expressions_tallies ) if not declared_holders: - declared_holders = get_declared_holders(codebase, holders_tallies) + declared_holders = get_declared_holders(codebase_resources, holders_tallies) other_holders = remove_from_tallies(declared_holders, holders_tallies) declared_holder = ', '.join(declared_holders) @@ -156,7 +157,7 @@ def remove_from_tallies(entry, tallies): return pruned_tallies -def get_declared_holders(codebase, holders_tallies): +def get_declared_holders(codebase_resources, holders_tallies): """ Return a list of declared holders from a codebase using the holders detected from key files. @@ -167,8 +168,8 @@ def get_declared_holders(codebase, holders_tallies): entry_by_holders = { fingerprints.generate(entry['value']): entry for entry in holders_tallies if entry['value'] } - key_file_holders = get_field_values_from_codebase_resources( - codebase, 'holders', key_files_only=True + key_file_holders = get_field_values_from_resources( + resources=codebase_resources, field_name='holders', key_files_only=True ) entry_by_key_file_holders = { fingerprints.generate(canonical_holder(entry['holder'])): entry diff --git a/tests/packagedcode/data/package_summary/expected.json b/tests/packagedcode/data/package_summary/expected.json new file mode 100644 index 00000000000..dcd9d656468 --- /dev/null +++ b/tests/packagedcode/data/package_summary/expected.json @@ -0,0 +1,1329 @@ +{ + "packages": [ + { + "type": "npm", + "namespace": null, + "name": "change-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/change-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": "gpl-3.0-plus", + "other_license_expression_spdx": "GPL-3.0-or-later", + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/change-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/change-case", + "package_uid": "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "change-case-change-case-5.4.4/packages/change-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 70, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": true, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/change-case" + }, + { + "type": "npm", + "namespace": null, + "name": "sponge-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Nate Rabins", + "email": "nrabins@gmail.com", + "url": "http://rabins.dev" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/sponge-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/sponge-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/sponge-case", + "package_uid": "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "change-case-change-case-5.4.4/packages/sponge-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 90, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/sponge-case" + }, + { + "type": "npm", + "namespace": null, + "name": "swap-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/swap-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/swap-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/swap-case", + "package_uid": "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "change-case-change-case-5.4.4/packages/swap-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 90, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/swap-case" + }, + { + "type": "npm", + "namespace": null, + "name": "title-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/title-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/title-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/title-case", + "package_uid": "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "change-case-change-case-5.4.4/packages/title-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 90, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/title-case" + } + ], + "dependencies": [], + "license_detections": [ + { + "identifier": "gpl_3_0_plus-c07595af-3cea-8c65-c6fc-d8a3300f35b5", + "license_expression": "gpl-3.0-plus", + "license_expression_spdx": "GPL-3.0-or-later", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "gpl-3.0-plus", + "license_expression_spdx": "GPL-3.0-or-later", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/change-case/src/index.js", + "start_line": 1, + "end_line": 12, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 102, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "gpl-3.0-plus_60.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl-3.0-plus_60.RULE" + } + ] + }, + { + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 4, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/change-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ] + }, + { + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 4, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/change-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null + } + ] + }, + { + "identifier": "mit-d5ea549d-8e03-2a31-f0cc-bdb0a5b86996", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 2, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + } + ] + } + ], + "files": [ + { + "path": "change-case-change-case-5.4.4", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/LICENSE", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + } + ], + "identifier": "mit-d5ea549d-8e03-2a31-f0cc-bdb0a5b86996" + } + ], + "license_clues": [], + "percentage_of_license_text": 33.33, + "copyrights": [ + { + "copyright": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "start_line": 3, + "end_line": 3 + } + ], + "holders": [ + { + "holder": "Blake Embrey", + "start_line": 3, + "end_line": 3 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + } + ], + "identifier": "mit-d5ea549d-8e03-2a31-f0cc-bdb0a5b86996" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "workspaces": [ + "packages/*" + ] + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "npm_package_json", + "purl": null + } + ], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/change-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/change-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "change-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/change-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/change-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/change-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/change-case" + } + ], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/change-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Blake Embrey", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/change-case/src", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/change-case/src/index.js", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "gpl-3.0-plus", + "detected_license_expression_spdx": "GPL-3.0-or-later", + "license_detections": [ + { + "license_expression": "gpl-3.0-plus", + "license_expression_spdx": "GPL-3.0-or-later", + "matches": [ + { + "license_expression": "gpl-3.0-plus", + "spdx_license_expression": "GPL-3.0-or-later", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/change-case/src/index.js", + "start_line": 1, + "end_line": 12, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 102, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "gpl-3.0-plus_60.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl-3.0-plus_60.RULE" + } + ], + "identifier": "gpl_3_0_plus-c07595af-3cea-8c65-c6fc-d8a3300f35b5" + } + ], + "license_clues": [], + "percentage_of_license_text": 100.0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/sponge-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/sponge-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "sponge-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Nate Rabins", + "email": "nrabins@gmail.com", + "url": "http://rabins.dev" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/sponge-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/sponge-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/sponge-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/sponge-case" + } + ], + "for_packages": [ + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/sponge-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Nate Rabins", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/swap-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/swap-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "swap-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/swap-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/swap-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/swap-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/swap-case" + } + ], + "for_packages": [ + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/swap-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Blake Embrey", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/title-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/title-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "title-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/title-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/title-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/title-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/title-case" + } + ], + "for_packages": [ + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "change-case-change-case-5.4.4.zip-extract/change-case-change-case-5.4.4/packages/title-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Blake Embrey", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "change-case-change-case-5.4.4/packages/title-case/tsconfig.json", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/npm-expected.json b/tests/packagedcode/data/package_summary/npm-expected.json new file mode 100644 index 00000000000..502c050d393 --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm-expected.json @@ -0,0 +1,1360 @@ +{ + "summary": { + "declared_license_expression": "mit", + "license_clarity_score": { + "score": 70, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": true, + "ambiguous_compound_licensing": false + }, + "declared_holder": "Blake Embrey", + "primary_language": null, + "other_license_expressions": [ + { + "value": null, + "count": 2 + }, + { + "value": "gpl-3.0-plus", + "count": 1 + } + ], + "other_holders": [ + { + "value": null, + "count": 7 + } + ], + "other_languages": [] + }, + "packages": [ + { + "type": "npm", + "namespace": null, + "name": "change-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/change-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": "gpl-3.0-plus", + "other_license_expression_spdx": "GPL-3.0-or-later", + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/change-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/change-case", + "package_uid": "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "codebase/packages/change-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 70, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": true, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/change-case" + }, + { + "type": "npm", + "namespace": null, + "name": "sponge-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Nate Rabins", + "email": "nrabins@gmail.com", + "url": "http://rabins.dev" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/sponge-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/sponge-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/sponge-case", + "package_uid": "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "codebase/packages/sponge-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 90, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/sponge-case" + }, + { + "type": "npm", + "namespace": null, + "name": "swap-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/swap-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/swap-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/swap-case", + "package_uid": "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "codebase/packages/swap-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 90, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/swap-case" + }, + { + "type": "npm", + "namespace": null, + "name": "title-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "holder": "Blake Embrey", + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/title-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/title-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/title-case", + "package_uid": "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "codebase/packages/title-case/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 90, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/title-case" + } + ], + "dependencies": [], + "license_detections": [ + { + "identifier": "gpl_3_0_plus-c07595af-3cea-8c65-c6fc-d8a3300f35b5", + "license_expression": "gpl-3.0-plus", + "license_expression_spdx": "GPL-3.0-or-later", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "gpl-3.0-plus", + "license_expression_spdx": "GPL-3.0-or-later", + "from_file": "npm/codebase/packages/change-case/src/index.js", + "start_line": 1, + "end_line": 12, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 102, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "gpl-3.0-plus_60.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl-3.0-plus_60.RULE" + } + ] + }, + { + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 4, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "npm/codebase/packages/change-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ] + }, + { + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 4, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "npm/codebase/packages/change-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null + } + ] + }, + { + "identifier": "mit-d5ea549d-8e03-2a31-f0cc-bdb0a5b86996", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 2, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "npm/codebase/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + } + ] + } + ], + "files": [ + { + "path": "codebase", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/LICENSE", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + } + ], + "identifier": "mit-d5ea549d-8e03-2a31-f0cc-bdb0a5b86996" + } + ], + "license_clues": [], + "percentage_of_license_text": 33.33, + "copyrights": [ + { + "copyright": "Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)", + "start_line": 3, + "end_line": 3 + } + ], + "holders": [ + { + "holder": "Blake Embrey", + "start_line": 3, + "end_line": 3 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + } + ], + "identifier": "mit-d5ea549d-8e03-2a31-f0cc-bdb0a5b86996" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "workspaces": [ + "packages/*" + ] + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "npm_package_json", + "purl": null + } + ], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages/change-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages/change-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "change-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/change-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/change-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/change-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/change-case" + } + ], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/change-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Blake Embrey", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "codebase/packages/change-case/src", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages/change-case/src/index.js", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/change-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "gpl-3.0-plus", + "detected_license_expression_spdx": "GPL-3.0-or-later", + "license_detections": [ + { + "license_expression": "gpl-3.0-plus", + "license_expression_spdx": "GPL-3.0-or-later", + "matches": [ + { + "license_expression": "gpl-3.0-plus", + "spdx_license_expression": "GPL-3.0-or-later", + "from_file": "npm/codebase/packages/change-case/src/index.js", + "start_line": 1, + "end_line": 12, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 102, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "gpl-3.0-plus_60.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl-3.0-plus_60.RULE" + } + ], + "identifier": "gpl_3_0_plus-c07595af-3cea-8c65-c6fc-d8a3300f35b5" + } + ], + "license_clues": [], + "percentage_of_license_text": 100.0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages/sponge-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages/sponge-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "sponge-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Nate Rabins", + "email": "nrabins@gmail.com", + "url": "http://rabins.dev" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/sponge-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/sponge-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/sponge-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/sponge-case" + } + ], + "for_packages": [ + "pkg:npm/sponge-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/sponge-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Nate Rabins", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "codebase/packages/swap-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages/swap-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "swap-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/swap-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/swap-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/swap-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/swap-case" + } + ], + "for_packages": [ + "pkg:npm/swap-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/swap-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Blake Embrey", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "codebase/packages/title-case", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "codebase/packages/title-case/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "title-case", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } + ], + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/title-case/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- MIT\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/title-case", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/title-case", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/title-case" + } + ], + "for_packages": [ + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "npm/codebase/packages/title-case/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 11.76, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Blake Embrey", + "start_line": 4, + "end_line": 5 + } + ], + "scan_errors": [] + }, + { + "path": "codebase/packages/title-case/tsconfig.json", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/title-case?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/npm/codebase/LICENSE b/tests/packagedcode/data/package_summary/npm/codebase/LICENSE new file mode 100644 index 00000000000..458a86382e3 --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/LICENSE @@ -0,0 +1,3 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/npm/codebase/package.json b/tests/packagedcode/data/package_summary/npm/codebase/package.json new file mode 100644 index 00000000000..8d6281380f6 --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/package.json @@ -0,0 +1,6 @@ +{ + "name": "", + "workspaces": [ + "packages/*" + ] +} diff --git a/tests/packagedcode/data/package_summary/npm/codebase/packages/change-case/package.json b/tests/packagedcode/data/package_summary/npm/codebase/packages/change-case/package.json new file mode 100644 index 00000000000..e381d08e74f --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/packages/change-case/package.json @@ -0,0 +1,9 @@ +{ + "name": "change-case", + "license": "MIT", + "author": { + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } +} diff --git a/tests/packagedcode/data/package_summary/npm/codebase/packages/change-case/src/index.js b/tests/packagedcode/data/package_summary/npm/codebase/packages/change-case/src/index.js new file mode 100644 index 00000000000..1e34f074fa1 --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/packages/change-case/src/index.js @@ -0,0 +1,12 @@ +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/npm/codebase/packages/sponge-case/package.json b/tests/packagedcode/data/package_summary/npm/codebase/packages/sponge-case/package.json new file mode 100644 index 00000000000..8597b48eb7b --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/packages/sponge-case/package.json @@ -0,0 +1,9 @@ +{ + "name": "sponge-case", + "license": "MIT", + "author": { + "name": "Nate Rabins", + "email": "nrabins@gmail.com", + "url": "http://rabins.dev" + } +} diff --git a/tests/packagedcode/data/package_summary/npm/codebase/packages/swap-case/package.json b/tests/packagedcode/data/package_summary/npm/codebase/packages/swap-case/package.json new file mode 100644 index 00000000000..c586cf0fe47 --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/packages/swap-case/package.json @@ -0,0 +1,9 @@ +{ + "name": "swap-case", + "license": "MIT", + "author": { + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } +} diff --git a/tests/packagedcode/data/package_summary/npm/codebase/packages/title-case/package.json b/tests/packagedcode/data/package_summary/npm/codebase/packages/title-case/package.json new file mode 100644 index 00000000000..eaa81d69064 --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/packages/title-case/package.json @@ -0,0 +1,9 @@ +{ + "name": "title-case", + "license": "MIT", + "author": { + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + } +} diff --git a/tests/packagedcode/data/package_summary/npm/codebase/packages/title-case/tsconfig.json b/tests/packagedcode/data/package_summary/npm/codebase/packages/title-case/tsconfig.json new file mode 100644 index 00000000000..f354254d291 --- /dev/null +++ b/tests/packagedcode/data/package_summary/npm/codebase/packages/title-case/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.spec.*", "src/**/*.bench.*"] +} diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright-expected.json b/tests/packagedcode/data/package_summary/package_attributes/copyright-expected.json new file mode 100644 index 00000000000..bec7705e3ba --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright-expected.json @@ -0,0 +1,756 @@ +{ + "packages": [ + { + "type": "npm", + "namespace": null, + "name": "pkg1", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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": "Copyright 2003 John Moxley", + "holder": "John Moxley", + "declared_license_expression": "apache-2.0", + "declared_license_expression_spdx": "Apache-2.0", + "license_detections": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "matches": [ + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "copyright/packages/pkg1/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "matched_text": "Apache-2.0" + } + ], + "identifier": "apache_2_0-d66ab77d-a5cc-7104-e702-dc7df61fe9e8" + } + ], + "other_license_expression": "mit", + "other_license_expression_spdx": "MIT", + "other_license_detections": [], + "extracted_license_statement": "- Apache-2.0\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/pkg1", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg1", + "package_uid": "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "packages/pkg1/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 100, + "declared_license": true, + "identification_precision": true, + "has_license_text": true, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/pkg1" + }, + { + "type": "npm", + "namespace": null, + "name": "pkg2", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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": "Copyright 2003 John Moxley", + "holder": "John Moxley", + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": "mit", + "other_license_expression_spdx": "MIT", + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/pkg2", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg2", + "package_uid": "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "packages/pkg2/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 100, + "declared_license": true, + "identification_precision": true, + "has_license_text": true, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:npm/pkg2" + } + ], + "dependencies": [], + "license_detections": [ + { + "identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d", + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "detection_count": 2, + "reference_matches": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "from_file": "copyright/LICENSE", + "start_line": 3, + "end_line": 13, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 85, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "apache-2.0_7.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_7.RULE" + } + ] + }, + { + "identifier": "apache_2_0-d66ab77d-a5cc-7104-e702-dc7df61fe9e8", + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "from_file": "copyright/packages/pkg1/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE" + } + ] + }, + { + "identifier": "apache_2_0-ec759ae0-ea5a-f138-793e-388520e080c0", + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "from_file": "copyright/packages/pkg1/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "apache-2.0_65.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_65.RULE" + } + ] + }, + { + "identifier": "mit-19e92631-4a50-0b43-f7f7-3c6b7d44ec18", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "copyright/test.js", + "start_line": 2, + "end_line": 10, + "matcher": "2-aho", + "score": 80.0, + "matched_length": 86, + "match_coverage": 100.0, + "rule_relevance": 80, + "rule_identifier": "mit_17.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_17.RULE" + } + ] + } + ], + "files": [ + { + "path": "LICENSE", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "apache-2.0", + "detected_license_expression_spdx": "Apache-2.0", + "license_detections": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "matches": [ + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "copyright/LICENSE", + "start_line": 3, + "end_line": 13, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 85, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "apache-2.0_7.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_7.RULE" + } + ], + "identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d" + } + ], + "license_clues": [], + "percentage_of_license_text": 95.51, + "copyrights": [ + { + "copyright": "Copyright 2003 John Moxley", + "start_line": 1, + "end_line": 1 + } + ], + "holders": [ + { + "holder": "John Moxley", + "start_line": 1, + "end_line": 1 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": "apache-2.0", + "declared_license_expression_spdx": "Apache-2.0", + "license_detections": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "matches": [ + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "copyright/LICENSE", + "start_line": 3, + "end_line": 13, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 85, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "apache-2.0_7.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_7.RULE" + } + ], + "identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "workspaces": [ + "packages/*" + ] + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "npm_package_json", + "purl": null + } + ], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "packages", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "packages/pkg1", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "packages/pkg1/file1.ts", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [ + { + "copyright": "Copyright (c) 2004 XYZ Company", + "start_line": 1, + "end_line": 1 + } + ], + "holders": [ + { + "holder": "XYZ Company", + "start_line": 1, + "end_line": 1 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "packages/pkg1/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "pkg1", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": "apache-2.0", + "declared_license_expression_spdx": "Apache-2.0", + "license_detections": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "matches": [ + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "copyright/packages/pkg1/package.json", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "matched_text": "Apache-2.0" + } + ], + "identifier": "apache_2_0-d66ab77d-a5cc-7104-e702-dc7df61fe9e8" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "- Apache-2.0\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/pkg1", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg1", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/pkg1" + } + ], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "apache-2.0", + "detected_license_expression_spdx": "Apache-2.0", + "license_detections": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "matches": [ + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "copyright/packages/pkg1/package.json", + "start_line": 3, + "end_line": 3, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "apache-2.0_65.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_65.RULE" + } + ], + "identifier": "apache_2_0-ec759ae0-ea5a-f138-793e-388520e080c0" + } + ], + "license_clues": [], + "percentage_of_license_text": 66.67, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "packages/pkg2", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "packages/pkg2/file2.js", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [ + { + "copyright": "Copyright (c) 2005 TXY Company", + "start_line": 1, + "end_line": 1 + } + ], + "holders": [ + { + "holder": "TXY Company", + "start_line": 1, + "end_line": 1 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "packages/pkg2/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "pkg2", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/pkg2", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg2", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/pkg2" + } + ], + "for_packages": [ + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "test.js", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "copyright/test.js", + "start_line": 2, + "end_line": 10, + "matcher": "2-aho", + "score": 80.0, + "matched_length": 86, + "match_coverage": 100.0, + "rule_relevance": 80, + "rule_identifier": "mit_17.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_17.RULE" + } + ], + "identifier": "mit-19e92631-4a50-0b43-f7f7-3c6b7d44ec18" + } + ], + "license_clues": [], + "percentage_of_license_text": 94.51, + "copyrights": [ + { + "copyright": "Copyright (c) John Morph 2024", + "start_line": 1, + "end_line": 1 + } + ], + "holders": [ + { + "holder": "John Morph", + "start_line": 1, + "end_line": 1 + } + ], + "authors": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright/LICENSE b/tests/packagedcode/data/package_summary/package_attributes/copyright/LICENSE new file mode 100644 index 00000000000..69da6ac6b69 --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright/LICENSE @@ -0,0 +1,13 @@ +Copyright [2003] [John Moxley] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright/package.json b/tests/packagedcode/data/package_summary/package_attributes/copyright/package.json new file mode 100644 index 00000000000..bbd31d188ae --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright/package.json @@ -0,0 +1,7 @@ +{ + "name": "", + "workspaces": [ + "packages/*" + ] + } + \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg1/file1.ts b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg1/file1.ts new file mode 100644 index 00000000000..6d9727897dd --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg1/file1.ts @@ -0,0 +1 @@ +// Copyright (C) 2004 XYZ Company \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg1/package.json b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg1/package.json new file mode 100644 index 00000000000..02fecf8c8cc --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg1/package.json @@ -0,0 +1,5 @@ +{ + "name": "pkg1", + "license": "Apache-2.0" +} + \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg2/file2.js b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg2/file2.js new file mode 100644 index 00000000000..ddef0510460 --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg2/file2.js @@ -0,0 +1 @@ +// Copyright (C) 2005 TXY Company \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg2/package.json b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg2/package.json new file mode 100644 index 00000000000..959af5f590a --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright/packages/pkg2/package.json @@ -0,0 +1,4 @@ +{ + "name": "pkg2" +} + \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/package_attributes/copyright/test.js b/tests/packagedcode/data/package_summary/package_attributes/copyright/test.js new file mode 100644 index 00000000000..3b806cdf8b7 --- /dev/null +++ b/tests/packagedcode/data/package_summary/package_attributes/copyright/test.js @@ -0,0 +1,10 @@ +// Copyright (C) John Morph 2024 +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/plugin_package_summary-expected.json b/tests/packagedcode/data/package_summary/plugin_package_summary-expected.json new file mode 100644 index 00000000000..c84fab0e32d --- /dev/null +++ b/tests/packagedcode/data/package_summary/plugin_package_summary-expected.json @@ -0,0 +1,388 @@ +{ + "packages": [ + { + "type": "npm", + "namespace": null, + "name": "pkg1", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/pkg1", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg1", + "package_uid": "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "plugin_package_summary/packages/pkg1/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:npm/pkg1" + }, + { + "type": "npm", + "namespace": null, + "name": "pkg2", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://www.npmjs.com/package/pkg2", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg2", + "package_uid": "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "plugin_package_summary/packages/pkg2/package.json" + ], + "datasource_ids": [ + "npm_package_json" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:npm/pkg2" + } + ], + "dependencies": [], + "files": [ + { + "path": "plugin_package_summary", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/LICENSE", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "root", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "workspaces": [ + "packages/*" + ] + }, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/root", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/root", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/root" + } + ], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/packages", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/packages/pkg1", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/packages/pkg1/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "pkg1", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/pkg1", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg1", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/pkg1" + } + ], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/packages/pkg2", + "type": "directory", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/packages/pkg2/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": "pkg2", + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "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, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/pkg2", + "repository_download_url": null, + "api_data_url": "https://registry.npmjs.org/pkg2", + "datasource_id": "npm_package_json", + "purl": "pkg:npm/pkg2" + } + ], + "for_packages": [ + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "scan_errors": [] + }, + { + "path": "plugin_package_summary/test.js", + "type": "file", + "package_data": [], + "for_packages": [ + "pkg:npm/pkg1?uuid=fixed-uid-done-for-testing-5642512d1758", + "pkg:npm/pkg2?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/plugin_package_summary/LICENSE b/tests/packagedcode/data/package_summary/plugin_package_summary/LICENSE new file mode 100644 index 00000000000..69da6ac6b69 --- /dev/null +++ b/tests/packagedcode/data/package_summary/plugin_package_summary/LICENSE @@ -0,0 +1,13 @@ +Copyright [2003] [John Moxley] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/plugin_package_summary/package.json b/tests/packagedcode/data/package_summary/plugin_package_summary/package.json new file mode 100644 index 00000000000..f47079a2fa9 --- /dev/null +++ b/tests/packagedcode/data/package_summary/plugin_package_summary/package.json @@ -0,0 +1,7 @@ +{ + "name": "root", + "workspaces": [ + "packages/*" + ] + } + \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/plugin_package_summary/packages/pkg1/package.json b/tests/packagedcode/data/package_summary/plugin_package_summary/packages/pkg1/package.json new file mode 100644 index 00000000000..4ed33805210 --- /dev/null +++ b/tests/packagedcode/data/package_summary/plugin_package_summary/packages/pkg1/package.json @@ -0,0 +1,4 @@ +{ + "name": "pkg1" +} + \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/plugin_package_summary/packages/pkg2/package.json b/tests/packagedcode/data/package_summary/plugin_package_summary/packages/pkg2/package.json new file mode 100644 index 00000000000..959af5f590a --- /dev/null +++ b/tests/packagedcode/data/package_summary/plugin_package_summary/packages/pkg2/package.json @@ -0,0 +1,4 @@ +{ + "name": "pkg2" +} + \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/plugin_package_summary/test.js b/tests/packagedcode/data/package_summary/plugin_package_summary/test.js new file mode 100644 index 00000000000..3b806cdf8b7 --- /dev/null +++ b/tests/packagedcode/data/package_summary/plugin_package_summary/test.js @@ -0,0 +1,10 @@ +// Copyright (C) John Morph 2024 +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/python_whl-expected.json b/tests/packagedcode/data/package_summary/python_whl-expected.json new file mode 100644 index 00000000000..a8bd0af9001 --- /dev/null +++ b/tests/packagedcode/data/package_summary/python_whl-expected.json @@ -0,0 +1,972 @@ +{ + "summary": { + "declared_license_expression": "mit AND unknown-license-reference", + "license_clarity_score": { + "score": 100, + "declared_license": true, + "identification_precision": true, + "has_license_text": true, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "declared_holder": "Leonard Richardson", + "primary_language": null, + "other_license_expressions": [ + { + "value": null, + "count": 2 + }, + { + "value": "mit", + "count": 2 + } + ], + "other_holders": [ + { + "value": null, + "count": 3 + }, + { + "value": "Isaac Muse", + "count": 1 + }, + { + "value": "James Graham and other contributors", + "count": 1 + } + ], + "other_languages": [] + }, + "packages": [ + { + "type": "pypi", + "namespace": null, + "name": "beautifulsoup4", + "version": "4.12.3", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Screen-scraping library\nBeautiful Soup is a library that makes it easy to scrape information\nfrom web pages. It sits atop an HTML or XML parser, providing Pythonic\nidioms for iterating, searching, and modifying the parse tree.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": null, + "email": "Leonard Richardson ", + "url": null + } + ], + "keywords": [ + "HTML", + "XML", + "parse", + "soup", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Markup :: HTML", + "Topic :: Text Processing :: Markup :: SGML", + "Topic :: Text Processing :: Markup :: XML" + ], + "homepage_url": "https://www.crummy.com/software/BeautifulSoup/bs4/", + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_14.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_14.RULE", + "matched_text": "MIT License" + } + ], + "identifier": "mit-9967e727-165e-9bb5-f090-7de5e47a3929" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 5, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "pypi_mit_license.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/pypi_mit_license.RULE", + "matched_text": "- 'License :: OSI Approved :: MIT License'" + } + ], + "identifier": "mit-24a5293c-14d7-5403-efac-1a8b7532c0e8" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "license: MIT License\nclassifiers:\n - 'License :: OSI Approved :: MIT License'\n", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "Download": "https://www.crummy.com/software/BeautifulSoup/bs4/download/" + }, + "repository_homepage_url": "https://pypi.org/project/beautifulsoup4", + "repository_download_url": "https://pypi.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.12.3.tar.gz", + "api_data_url": "https://pypi.org/pypi/beautifulsoup4/4.12.3/json", + "package_uid": "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "sample-0.1.0.dist-info/METADATA" + ], + "datasource_ids": [ + "pypi_wheel_metadata" + ], + "license_clarity_score": { + "score": 80, + "declared_license": true, + "identification_precision": true, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "purl": "pkg:pypi/beautifulsoup4@4.12.3" + } + ], + "dependencies": [ + { + "purl": "pkg:pypi/soupsieve", + "extracted_requirement": ">1.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:pypi/soupsieve?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "sample-0.1.0.dist-info/METADATA", + "datasource_id": "pypi_wheel_metadata" + }, + { + "purl": "pkg:pypi/cchardet", + "extracted_requirement": null, + "scope": "cchardet", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:pypi/cchardet?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "sample-0.1.0.dist-info/METADATA", + "datasource_id": "pypi_wheel_metadata" + }, + { + "purl": "pkg:pypi/chardet", + "extracted_requirement": null, + "scope": "chardet", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:pypi/chardet?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "sample-0.1.0.dist-info/METADATA", + "datasource_id": "pypi_wheel_metadata" + }, + { + "purl": "pkg:pypi/charset-normalizer", + "extracted_requirement": null, + "scope": "charset-normalizer", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:pypi/charset-normalizer?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "sample-0.1.0.dist-info/METADATA", + "datasource_id": "pypi_wheel_metadata" + }, + { + "purl": "pkg:pypi/html5lib", + "extracted_requirement": null, + "scope": "html5lib", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:pypi/html5lib?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "sample-0.1.0.dist-info/METADATA", + "datasource_id": "pypi_wheel_metadata" + }, + { + "purl": "pkg:pypi/lxml", + "extracted_requirement": null, + "scope": "lxml", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:pypi/lxml?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "sample-0.1.0.dist-info/METADATA", + "datasource_id": "pypi_wheel_metadata" + } + ], + "license_detections": [ + { + "identifier": "mit-1f8486fd-7f89-7615-577f-4f2da8721e17", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample/__init__.py", + "start_line": 11, + "end_line": 12, + "matcher": "3-seq", + "score": 63.16, + "matched_length": 12, + "match_coverage": 63.16, + "rule_relevance": 100, + "rule_identifier": "mit_412.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_412.RULE" + } + ] + }, + { + "identifier": "mit-24a5293c-14d7-5403-efac-1a8b7532c0e8", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 5, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "pypi_mit_license.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/pypi_mit_license.RULE" + } + ] + }, + { + "identifier": "mit-9967e727-165e-9bb5-f090-7de5e47a3929", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_14.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_14.RULE" + } + ] + }, + { + "identifier": "mit-c313540a-026f-98f3-b960-6c3722909d18", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 7, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_835.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_835.RULE" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 5, + "end_line": 23, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 161, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit.LICENSE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 26, + "end_line": 26, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 6, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "beautifulsoup4_mit2.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/beautifulsoup4_mit2.RULE" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 30, + "end_line": 30, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 6, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "beautifulsoup4_mit2.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/beautifulsoup4_mit2.RULE" + } + ] + }, + { + "identifier": "mit_and_unknown_license_reference-749bcecd-d86e-814b-043e-efb9330165a4", + "license_expression": "mit AND unknown-license-reference", + "license_expression_spdx": "MIT AND LicenseRef-scancode-unknown-license-reference", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 8, + "end_line": 9, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_1192.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_1192.RULE" + }, + { + "license_expression": "unknown-license-reference", + "license_expression_spdx": "LicenseRef-scancode-unknown-license-reference", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 10, + "end_line": 10, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "unknown-license-reference_see_license_at_manifest_1.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/unknown-license-reference_see_license_at_manifest_1.RULE" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 14, + "end_line": 14, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 5, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "pypi_mit_license.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/pypi_mit_license.RULE" + } + ] + } + ], + "files": [ + { + "path": "sample", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "sample-0.1.0.dist-info", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "sample-0.1.0.dist-info/METADATA", + "type": "file", + "package_data": [ + { + "type": "pypi", + "namespace": null, + "name": "beautifulsoup4", + "version": "4.12.3", + "qualifiers": {}, + "subpath": null, + "primary_language": "Python", + "description": "Screen-scraping library\nBeautiful Soup is a library that makes it easy to scrape information\nfrom web pages. It sits atop an HTML or XML parser, providing Pythonic\nidioms for iterating, searching, and modifying the parse tree.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": null, + "email": "Leonard Richardson ", + "url": null + } + ], + "keywords": [ + "HTML", + "XML", + "parse", + "soup", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Markup :: HTML", + "Topic :: Text Processing :: Markup :: SGML", + "Topic :: Text Processing :: Markup :: XML" + ], + "homepage_url": "https://www.crummy.com/software/BeautifulSoup/bs4/", + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_14.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_14.RULE", + "matched_text": "MIT License" + } + ], + "identifier": "mit-9967e727-165e-9bb5-f090-7de5e47a3929" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 1, + "end_line": 1, + "matcher": "1-hash", + "score": 100.0, + "matched_length": 5, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "pypi_mit_license.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/pypi_mit_license.RULE", + "matched_text": "- 'License :: OSI Approved :: MIT License'" + } + ], + "identifier": "mit-24a5293c-14d7-5403-efac-1a8b7532c0e8" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "license: MIT License\nclassifiers:\n - 'License :: OSI Approved :: MIT License'\n", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "Download": "https://www.crummy.com/software/BeautifulSoup/bs4/download/" + }, + "dependencies": [ + { + "purl": "pkg:pypi/soupsieve", + "extracted_requirement": ">1.2", + "scope": "install", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:pypi/cchardet", + "extracted_requirement": null, + "scope": "cchardet", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:pypi/chardet", + "extracted_requirement": null, + "scope": "chardet", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:pypi/charset-normalizer", + "extracted_requirement": null, + "scope": "charset-normalizer", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:pypi/html5lib", + "extracted_requirement": null, + "scope": "html5lib", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:pypi/lxml", + "extracted_requirement": null, + "scope": "lxml", + "is_runtime": true, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://pypi.org/project/beautifulsoup4", + "repository_download_url": "https://pypi.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.12.3.tar.gz", + "api_data_url": "https://pypi.org/pypi/beautifulsoup4/4.12.3/json", + "datasource_id": "pypi_wheel_metadata", + "purl": "pkg:pypi/beautifulsoup4@4.12.3" + } + ], + "for_packages": [ + "pkg:pypi/beautifulsoup4@4.12.3?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": true, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "mit AND unknown-license-reference", + "detected_license_expression_spdx": "MIT AND LicenseRef-scancode-unknown-license-reference", + "license_detections": [ + { + "license_expression": "mit AND unknown-license-reference", + "license_expression_spdx": "MIT AND LicenseRef-scancode-unknown-license-reference", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 8, + "end_line": 9, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_1192.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_1192.RULE" + }, + { + "license_expression": "unknown-license-reference", + "spdx_license_expression": "LicenseRef-scancode-unknown-license-reference", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 10, + "end_line": 10, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "unknown-license-reference_see_license_at_manifest_1.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/unknown-license-reference_see_license_at_manifest_1.RULE" + }, + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/METADATA", + "start_line": 14, + "end_line": 14, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 5, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "pypi_mit_license.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/pypi_mit_license.RULE" + } + ], + "identifier": "mit_and_unknown_license_reference-749bcecd-d86e-814b-043e-efb9330165a4" + } + ], + "license_clues": [], + "percentage_of_license_text": 6.09, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "sample-0.1.0.dist-info/WHEEL", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "sample-0.1.0.dist-info/licenses", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "sample-0.1.0.dist-info/licenses/AUTHORS", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "sample-0.1.0.dist-info/licenses/LICENSE", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 7, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_835.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_835.RULE" + }, + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 5, + "end_line": 23, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 161, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit.LICENSE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" + }, + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 26, + "end_line": 26, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 6, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "beautifulsoup4_mit2.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/beautifulsoup4_mit2.RULE" + }, + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample-0.1.0.dist-info/licenses/LICENSE", + "start_line": 30, + "end_line": 30, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 6, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "beautifulsoup4_mit2.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/beautifulsoup4_mit2.RULE" + } + ], + "identifier": "mit-c313540a-026f-98f3-b960-6c3722909d18" + } + ], + "license_clues": [], + "percentage_of_license_text": 81.45, + "copyrights": [ + { + "copyright": "Copyright (c) Leonard Richardson", + "start_line": 3, + "end_line": 3 + }, + { + "copyright": "Copyright (c) James Graham and other contributors", + "start_line": 26, + "end_line": 27 + }, + { + "copyright": "Copyright (c) Isaac Muse", + "start_line": 30, + "end_line": 31 + } + ], + "holders": [ + { + "holder": "Leonard Richardson", + "start_line": 3, + "end_line": 3 + }, + { + "holder": "James Graham and other contributors", + "start_line": 26, + "end_line": 27 + }, + { + "holder": "Isaac Muse", + "start_line": 31, + "end_line": 31 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "sample/__init__.py", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "python_whl/sample/__init__.py", + "start_line": 11, + "end_line": 12, + "matcher": "3-seq", + "score": 63.16, + "matched_length": 12, + "match_coverage": 63.16, + "rule_relevance": 100, + "rule_identifier": "mit_412.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_412.RULE" + } + ], + "identifier": "mit-1f8486fd-7f89-7615-577f-4f2da8721e17" + } + ], + "license_clues": [], + "percentage_of_license_text": 17.14, + "copyrights": [ + { + "copyright": "Copyright (c) 2004-2024 Leonard Richardson", + "start_line": 10, + "end_line": 10 + } + ], + "holders": [ + { + "holder": "Leonard Richardson", + "start_line": 10, + "end_line": 10 + } + ], + "authors": [ + { + "author": "Leonard Richardson (leonardr@segfault.org)", + "start_line": 8, + "end_line": 8 + } + ], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/METADATA b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/METADATA new file mode 100644 index 00000000000..0f870ce574b --- /dev/null +++ b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/METADATA @@ -0,0 +1,37 @@ +Metadata-Version: 2.1 +Name: beautifulsoup4 +Version: 4.12.3 +Summary: Screen-scraping library +Project-URL: Download, https://www.crummy.com/software/BeautifulSoup/bs4/download/ +Project-URL: Homepage, https://www.crummy.com/software/BeautifulSoup/bs4/ +Author-email: Leonard Richardson +License: MIT License +License-File: AUTHORS +License-File: LICENSE +Keywords: HTML,XML,parse,soup +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Text Processing :: Markup :: HTML +Classifier: Topic :: Text Processing :: Markup :: SGML +Classifier: Topic :: Text Processing :: Markup :: XML +Requires-Python: >=3.6.0 +Requires-Dist: soupsieve>1.2 +Provides-Extra: cchardet +Requires-Dist: cchardet; extra == 'cchardet' +Provides-Extra: chardet +Requires-Dist: chardet; extra == 'chardet' +Provides-Extra: charset-normalizer +Requires-Dist: charset-normalizer; extra == 'charset-normalizer' +Provides-Extra: html5lib +Requires-Dist: html5lib; extra == 'html5lib' +Provides-Extra: lxml +Requires-Dist: lxml; extra == 'lxml' +Description-Content-Type: text/markdown + +Beautiful Soup is a library that makes it easy to scrape information +from web pages. It sits atop an HTML or XML parser, providing Pythonic +idioms for iterating, searching, and modifying the parse tree. \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/WHEEL b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/WHEEL new file mode 100644 index 00000000000..2860816abec --- /dev/null +++ b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.21.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/licenses/AUTHORS b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/licenses/AUTHORS new file mode 100644 index 00000000000..2ede63fea3d --- /dev/null +++ b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/licenses/AUTHORS @@ -0,0 +1,13 @@ +Behold, mortal, the origins of Beautiful Soup... +================================================ + +Leonard Richardson is the primary maintainer. + +Aaron DeVore and Isaac Muse have made significant contributions to the +code base. + +Mark Pilgrim provided the encoding detection code that forms the base +of UnicodeDammit. + +Thomas Kluyver and Ezio Melotti finished the work of getting Beautiful +Soup 4 working under Python 3. diff --git a/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/licenses/LICENSE b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/licenses/LICENSE new file mode 100644 index 00000000000..08e3a9cf8c7 --- /dev/null +++ b/tests/packagedcode/data/package_summary/python_whl/sample-0.1.0.dist-info/licenses/LICENSE @@ -0,0 +1,31 @@ +Beautiful Soup is made available under the MIT license: + + Copyright (c) Leonard Richardson + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +Beautiful Soup incorporates code from the html5lib library, which is +also made available under the MIT license. Copyright (c) James Graham +and other contributors + +Beautiful Soup has an optional dependency on the soupsieve library, +which is also made available under the MIT license. Copyright (c) +Isaac Muse diff --git a/tests/packagedcode/data/package_summary/python_whl/sample/__init__.py b/tests/packagedcode/data/package_summary/python_whl/sample/__init__.py new file mode 100644 index 00000000000..062c68c7188 --- /dev/null +++ b/tests/packagedcode/data/package_summary/python_whl/sample/__init__.py @@ -0,0 +1,14 @@ +"""Beautiful Soup Elixir and Tonic - "The Screen-Scraper's Friend". + +http://www.crummy.com/software/BeautifulSoup/ +For more than you ever wanted to know about Beautiful Soup, see the +documentation: http://www.crummy.com/software/BeautifulSoup/bs4/doc/ +""" + +__author__ = "Leonard Richardson (leonardr@segfault.org)" +__version__ = "4.12.3" +__copyright__ = "Copyright (c) 2004-2024 Leonard Richardson" +# Use of this source code is governed by the MIT license. +__license__ = "MIT" + +__all__ = ['BeautifulSoup'] \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/rubygems-expected.json b/tests/packagedcode/data/package_summary/rubygems-expected.json new file mode 100644 index 00000000000..e207e24ac26 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems-expected.json @@ -0,0 +1,1021 @@ +{ + "summary": { + "declared_license_expression": "proprietary-license AND apache-2.0", + "license_clarity_score": { + "score": 100, + "declared_license": true, + "identification_precision": true, + "has_license_text": true, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "declared_holder": "Chef Software Inc.", + "primary_language": null, + "other_license_expressions": [ + { + "value": null, + "count": 4 + }, + { + "value": "apache-2.0", + "count": 1 + } + ], + "other_holders": [ + { + "value": null, + "count": 6 + }, + { + "value": "Dominik Richter", + "count": 1 + } + ], + "other_languages": [] + }, + "packages": [ + { + "type": "gem", + "namespace": null, + "name": "inspec-bin", + "version": "InspecBin::VERSION", + "qualifiers": {}, + "subpath": null, + "primary_language": "Ruby", + "description": "Infrastructure and compliance testing.\nInSpec executable for inspec gem. Use of this executable may require accepting a license agreement.\"\n\nPackaged distributions of Progress\u00ae Chef\u00ae products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products (\"Master Agreement\"), in which case the Master Agreement shall govern.\n\nSource code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Chef InSpec Core Engineering", + "email": null, + "url": null + }, + { + "type": "person", + "role": "author", + "name": null, + "email": "inspec@chef.io", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://github.com/inspec/inspec/tree/main/inspec-bin", + "download_url": "https://rubygems.org/downloads/inspec-bin-InspecBin::VERSION.gem", + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": "unknown", + "declared_license_expression_spdx": "LicenseRef-scancode-unknown", + "license_detections": [ + { + "license_expression": "unknown", + "license_expression_spdx": "LicenseRef-scancode-unknown", + "matches": [ + { + "license_expression": "unknown", + "spdx_license_expression": "LicenseRef-scancode-unknown", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 1, + "end_line": 1, + "matcher": "5-undetected", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "matched_text": "license LicenseRef-Chef-EULA" + } + ], + "identifier": "unknown-60c1ced0-26e8-d6a3-b44f-e7f28f74e036" + } + ], + "other_license_expression": "proprietary-license AND apache-2.0", + "other_license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "other_license_detections": [], + "extracted_license_statement": "LicenseRef-Chef-EULA", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://rubygems.org/gems/inspec-bin/versions/InspecBin::VERSION", + "repository_download_url": "https://rubygems.org/downloads/inspec-bin-InspecBin::VERSION.gem", + "api_data_url": "https://rubygems.org/api/v2/rubygems/inspec-bin/versions/InspecBin::VERSION.json", + "package_uid": "pkg:gem/inspec-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "inspec-bin.gemspec" + ], + "datasource_ids": [ + "gemspec" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": true, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:gem/inspec-bin@InspecBin::VERSION" + }, + { + "type": "gem", + "namespace": null, + "name": "inspec-core-bin", + "version": "InspecBin::VERSION", + "qualifiers": {}, + "subpath": null, + "primary_language": "Ruby", + "description": "Infrastructure and compliance testing.\nInSpec executable for inspec-core gem. Use of this executable may require accepting a license agreement.\n\nPackaged distributions of Progress\u00ae Chef\u00ae products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products (\"Master Agreement\"), in which case the Master Agreement shall govern.\n\nSource code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Chef InSpec Core Engineering", + "email": null, + "url": null + }, + { + "type": "person", + "role": "author", + "name": null, + "email": "inspec@chef.io", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://github.com/inspec/inspec/tree/main/inspec-bin", + "download_url": "https://rubygems.org/downloads/inspec-core-bin-InspecBin::VERSION.gem", + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": "unknown", + "declared_license_expression_spdx": "LicenseRef-scancode-unknown", + "license_detections": [ + { + "license_expression": "unknown", + "license_expression_spdx": "LicenseRef-scancode-unknown", + "matches": [ + { + "license_expression": "unknown", + "spdx_license_expression": "LicenseRef-scancode-unknown", + "from_file": "rubygems/inspec-core-bin.gemspec", + "start_line": 1, + "end_line": 1, + "matcher": "5-undetected", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "matched_text": "license LicenseRef-Chef-EULA" + } + ], + "identifier": "unknown-60c1ced0-26e8-d6a3-b44f-e7f28f74e036" + } + ], + "other_license_expression": "proprietary-license AND apache-2.0", + "other_license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "other_license_detections": [], + "extracted_license_statement": "LicenseRef-Chef-EULA", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://rubygems.org/gems/inspec-core-bin/versions/InspecBin::VERSION", + "repository_download_url": "https://rubygems.org/downloads/inspec-core-bin-InspecBin::VERSION.gem", + "api_data_url": "https://rubygems.org/api/v2/rubygems/inspec-core-bin/versions/InspecBin::VERSION.json", + "package_uid": "pkg:gem/inspec-core-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "inspec-core-bin.gemspec" + ], + "datasource_ids": [ + "gemspec" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": true, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:gem/inspec-core-bin@InspecBin::VERSION" + } + ], + "dependencies": [ + { + "purl": "pkg:gem/rake", + "extracted_requirement": "", + "scope": "development", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:gem/rake?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:gem/inspec-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "inspec-bin.gemspec", + "datasource_id": "gemspec" + }, + { + "purl": "pkg:gem/inspec", + "extracted_requirement": "", + "scope": "dependency", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:gem/inspec?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:gem/inspec-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "inspec-bin.gemspec", + "datasource_id": "gemspec" + }, + { + "purl": "pkg:gem/rake", + "extracted_requirement": "", + "scope": "development", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:gem/rake?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:gem/inspec-core-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "inspec-core-bin.gemspec", + "datasource_id": "gemspec" + }, + { + "purl": "pkg:gem/inspec-core", + "extracted_requirement": "", + "scope": "dependency", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:gem/inspec-core?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:gem/inspec-core-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "inspec-core-bin.gemspec", + "datasource_id": "gemspec" + } + ], + "license_detections": [ + { + "identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d", + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "detection_count": 1, + "reference_matches": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "from_file": "rubygems/LICENSE", + "start_line": 3, + "end_line": 13, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 85, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "apache-2.0_7.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_7.RULE" + } + ] + }, + { + "identifier": "proprietary_license_and_apache_2_0-38837872-6ecc-3da0-f84f-664e5069146e", + "license_expression": "proprietary-license AND apache-2.0", + "license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "detection_count": 3, + "reference_matches": [ + { + "license_expression": "unknown-license-reference", + "license_expression_spdx": "LicenseRef-scancode-unknown-license-reference", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 12, + "end_line": 12, + "matcher": "2-aho", + "score": 90.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 90, + "rule_identifier": "license-intro_22.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/license-intro_22.RULE" + }, + { + "license_expression": "proprietary-license", + "license_expression_spdx": "LicenseRef-scancode-proprietary-license", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 14, + "end_line": 14, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "proprietary-license_72.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/proprietary-license_72.RULE" + }, + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 16, + "end_line": 16, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE" + } + ] + }, + { + "identifier": "unknown-60c1ced0-26e8-d6a3-b44f-e7f28f74e036", + "license_expression": "unknown", + "license_expression_spdx": "LicenseRef-scancode-unknown", + "detection_count": 2, + "reference_matches": [ + { + "license_expression": "unknown", + "license_expression_spdx": "LicenseRef-scancode-unknown", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 1, + "end_line": 1, + "matcher": "5-undetected", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2" + } + ] + } + ], + "files": [ + { + "path": "Gemfile", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "LICENSE", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "apache-2.0", + "detected_license_expression_spdx": "Apache-2.0", + "license_detections": [ + { + "license_expression": "apache-2.0", + "license_expression_spdx": "Apache-2.0", + "matches": [ + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "rubygems/LICENSE", + "start_line": 3, + "end_line": 13, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 85, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "apache-2.0_7.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/apache-2.0_7.RULE" + } + ], + "identifier": "apache_2_0-c4e30bcd-ccfd-bbc3-d2f1-196ab911e47d" + } + ], + "license_clues": [], + "percentage_of_license_text": 93.41, + "copyrights": [ + { + "copyright": "Copyright (c) 2019 Chef Software Inc.", + "start_line": 1, + "end_line": 1 + } + ], + "holders": [ + { + "holder": "Chef Software Inc.", + "start_line": 1, + "end_line": 1 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "bin", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "bin/inspec", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [ + { + "copyright": "Copyright 2015 Dominik Richter", + "start_line": 2, + "end_line": 2 + } + ], + "holders": [ + { + "holder": "Dominik Richter", + "start_line": 2, + "end_line": 2 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "checksums.yaml", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "inspec-bin.gemspec", + "type": "file", + "package_data": [ + { + "type": "gem", + "namespace": null, + "name": "inspec-bin", + "version": "InspecBin::VERSION", + "qualifiers": {}, + "subpath": null, + "primary_language": "Ruby", + "description": "Infrastructure and compliance testing.\nInSpec executable for inspec gem. Use of this executable may require accepting a license agreement.\"\n\nPackaged distributions of Progress\u00ae Chef\u00ae products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products (\"Master Agreement\"), in which case the Master Agreement shall govern.\n\nSource code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Chef InSpec Core Engineering", + "email": null, + "url": null + }, + { + "type": "person", + "role": "author", + "name": null, + "email": "inspec@chef.io", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://github.com/inspec/inspec/tree/main/inspec-bin", + "download_url": "https://rubygems.org/downloads/inspec-bin-InspecBin::VERSION.gem", + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": "unknown", + "declared_license_expression_spdx": "LicenseRef-scancode-unknown", + "license_detections": [ + { + "license_expression": "unknown", + "license_expression_spdx": "LicenseRef-scancode-unknown", + "matches": [ + { + "license_expression": "unknown", + "spdx_license_expression": "LicenseRef-scancode-unknown", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 1, + "end_line": 1, + "matcher": "5-undetected", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "matched_text": "license LicenseRef-Chef-EULA" + } + ], + "identifier": "unknown-60c1ced0-26e8-d6a3-b44f-e7f28f74e036" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "LicenseRef-Chef-EULA", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:gem/rake", + "extracted_requirement": "", + "scope": "development", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:gem/inspec", + "extracted_requirement": "", + "scope": "dependency", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://rubygems.org/gems/inspec-bin/versions/InspecBin::VERSION", + "repository_download_url": "https://rubygems.org/downloads/inspec-bin-InspecBin::VERSION.gem", + "api_data_url": "https://rubygems.org/api/v2/rubygems/inspec-bin/versions/InspecBin::VERSION.json", + "datasource_id": "gemspec", + "purl": "pkg:gem/inspec-bin@InspecBin::VERSION" + } + ], + "for_packages": [ + "pkg:gem/inspec-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "proprietary-license AND apache-2.0", + "detected_license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "license_detections": [ + { + "license_expression": "proprietary-license AND apache-2.0", + "license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "matches": [ + { + "license_expression": "unknown-license-reference", + "spdx_license_expression": "LicenseRef-scancode-unknown-license-reference", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 12, + "end_line": 12, + "matcher": "2-aho", + "score": 90.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 90, + "rule_identifier": "license-intro_22.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/license-intro_22.RULE" + }, + { + "license_expression": "proprietary-license", + "spdx_license_expression": "LicenseRef-scancode-proprietary-license", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 14, + "end_line": 14, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "proprietary-license_72.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/proprietary-license_72.RULE" + }, + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "rubygems/inspec-bin.gemspec", + "start_line": 16, + "end_line": 16, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE" + } + ], + "identifier": "proprietary_license_and_apache_2_0-38837872-6ecc-3da0-f84f-664e5069146e" + } + ], + "license_clues": [], + "percentage_of_license_text": 4.29, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "inspec-core-bin.gemspec", + "type": "file", + "package_data": [ + { + "type": "gem", + "namespace": null, + "name": "inspec-core-bin", + "version": "InspecBin::VERSION", + "qualifiers": {}, + "subpath": null, + "primary_language": "Ruby", + "description": "Infrastructure and compliance testing.\nInSpec executable for inspec-core gem. Use of this executable may require accepting a license agreement.\n\nPackaged distributions of Progress\u00ae Chef\u00ae products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products (\"Master Agreement\"), in which case the Master Agreement shall govern.\n\nSource code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Chef InSpec Core Engineering", + "email": null, + "url": null + }, + { + "type": "person", + "role": "author", + "name": null, + "email": "inspec@chef.io", + "url": null + } + ], + "keywords": [], + "homepage_url": "https://github.com/inspec/inspec/tree/main/inspec-bin", + "download_url": "https://rubygems.org/downloads/inspec-core-bin-InspecBin::VERSION.gem", + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": "unknown", + "declared_license_expression_spdx": "LicenseRef-scancode-unknown", + "license_detections": [ + { + "license_expression": "unknown", + "license_expression_spdx": "LicenseRef-scancode-unknown", + "matches": [ + { + "license_expression": "unknown", + "spdx_license_expression": "LicenseRef-scancode-unknown", + "from_file": "rubygems/inspec-core-bin.gemspec", + "start_line": 1, + "end_line": 1, + "matcher": "5-undetected", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/package-manifest-unknown-660d5d8517d1473cc8fc58a7230d227e36f2a8d2", + "matched_text": "license LicenseRef-Chef-EULA" + } + ], + "identifier": "unknown-60c1ced0-26e8-d6a3-b44f-e7f28f74e036" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "LicenseRef-Chef-EULA", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:gem/rake", + "extracted_requirement": "", + "scope": "development", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:gem/inspec-core", + "extracted_requirement": "", + "scope": "dependency", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://rubygems.org/gems/inspec-core-bin/versions/InspecBin::VERSION", + "repository_download_url": "https://rubygems.org/downloads/inspec-core-bin-InspecBin::VERSION.gem", + "api_data_url": "https://rubygems.org/api/v2/rubygems/inspec-core-bin/versions/InspecBin::VERSION.json", + "datasource_id": "gemspec", + "purl": "pkg:gem/inspec-core-bin@InspecBin::VERSION" + } + ], + "for_packages": [ + "pkg:gem/inspec-core-bin@InspecBin::VERSION?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "proprietary-license AND apache-2.0", + "detected_license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "license_detections": [ + { + "license_expression": "proprietary-license AND apache-2.0", + "license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "matches": [ + { + "license_expression": "unknown-license-reference", + "spdx_license_expression": "LicenseRef-scancode-unknown-license-reference", + "from_file": "rubygems/inspec-core-bin.gemspec", + "start_line": 15, + "end_line": 15, + "matcher": "2-aho", + "score": 90.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 90, + "rule_identifier": "license-intro_22.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/license-intro_22.RULE" + }, + { + "license_expression": "proprietary-license", + "spdx_license_expression": "LicenseRef-scancode-proprietary-license", + "from_file": "rubygems/inspec-core-bin.gemspec", + "start_line": 17, + "end_line": 17, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "proprietary-license_72.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/proprietary-license_72.RULE" + }, + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "rubygems/inspec-core-bin.gemspec", + "start_line": 19, + "end_line": 19, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE" + } + ], + "identifier": "proprietary_license_and_apache_2_0-38837872-6ecc-3da0-f84f-664e5069146e" + } + ], + "license_clues": [], + "percentage_of_license_text": 3.67, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "lib", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "lib/inspec-bin", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "lib/inspec-bin/version.rb", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "metadata", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": true, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "proprietary-license AND apache-2.0", + "detected_license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "license_detections": [ + { + "license_expression": "proprietary-license AND apache-2.0", + "license_expression_spdx": "LicenseRef-scancode-proprietary-license AND Apache-2.0", + "matches": [ + { + "license_expression": "unknown-license-reference", + "spdx_license_expression": "LicenseRef-scancode-unknown-license-reference", + "from_file": "rubygems/metadata", + "start_line": 42, + "end_line": 42, + "matcher": "2-aho", + "score": 90.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 90, + "rule_identifier": "license-intro_22.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/license-intro_22.RULE" + }, + { + "license_expression": "proprietary-license", + "spdx_license_expression": "LicenseRef-scancode-proprietary-license", + "from_file": "rubygems/metadata", + "start_line": 44, + "end_line": 44, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "proprietary-license_72.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/proprietary-license_72.RULE" + }, + { + "license_expression": "apache-2.0", + "spdx_license_expression": "Apache-2.0", + "from_file": "rubygems/metadata", + "start_line": 46, + "end_line": 46, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 3, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE" + } + ], + "identifier": "proprietary_license_and_apache_2_0-38837872-6ecc-3da0-f84f-664e5069146e" + } + ], + "license_clues": [], + "percentage_of_license_text": 2.98, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/rubygems/Gemfile b/tests/packagedcode/data/package_summary/rubygems/Gemfile new file mode 100644 index 00000000000..9576433066a --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/Gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" +main_gemspec = File.expand_path("inspec-bin.gemspec", __dir__) +if File.exist?(main_gemspec) + gemspec name: "inspec-bin" +else + gemspec name: "inspec-core-bin" +end diff --git a/tests/packagedcode/data/package_summary/rubygems/LICENSE b/tests/packagedcode/data/package_summary/rubygems/LICENSE new file mode 100644 index 00000000000..06da8765740 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2019 Chef Software Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tests/packagedcode/data/package_summary/rubygems/bin/inspec b/tests/packagedcode/data/package_summary/rubygems/bin/inspec new file mode 100755 index 00000000000..c4ab365d8c0 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/bin/inspec @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +# Copyright 2015 Dominik Richter + +Encoding.default_external = Encoding::UTF_8 +Encoding.default_internal = Encoding::UTF_8 + +lib = File.expand_path("lib", __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) + +require "inspec/cli" +Inspec::InspecCLI.start(ARGV, enforce_license: true) diff --git a/tests/packagedcode/data/package_summary/rubygems/checksums.yaml b/tests/packagedcode/data/package_summary/rubygems/checksums.yaml new file mode 100644 index 00000000000..5b3c367c70b --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/checksums.yaml @@ -0,0 +1,7 @@ +--- +SHA256: + metadata.gz: 8086142a7022fdc992d7344f3b304af0463e57bf2ce7db2fcd529b8e5e04d43e + data.tar.gz: 4a722fc5b44f1ea122ed9fa6fc3a894fc44c212fcaaec9fd7b1e105c24b0af0f +SHA512: + metadata.gz: ca4e90284eb61c28ce599ad7546abddade6861b8f02c27b174a59c0e004045d948b5d8c8b8aabeeee55ba81fa4164d2d939046f97fc064f9777cb6dd8bc9b3ab + data.tar.gz: 381893e13c00437b4ad7e7f08e1dbe8af0f7baf2eb46fd99ab14cf8935afda1cef984233916c815ad080bd641afce18f6cf7c28f93b09ad63f7cea133da3427c diff --git a/tests/packagedcode/data/package_summary/rubygems/inspec-bin.gemspec b/tests/packagedcode/data/package_summary/rubygems/inspec-bin.gemspec new file mode 100644 index 00000000000..999b16b79c8 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/inspec-bin.gemspec @@ -0,0 +1,35 @@ +lib = File.expand_path("lib", __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require "inspec-bin/version" + +Gem::Specification.new do |spec| + spec.name = "inspec-bin" + spec.version = InspecBin::VERSION + spec.authors = ["Chef InSpec Core Engineering "] + spec.email = ["inspec@chef.io"] + spec.summary = "Infrastructure and compliance testing." + spec.description = <<-EOT +InSpec executable for inspec gem. Use of this executable may require accepting a license agreement." + +Packaged distributions of Progress® Chef® products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products ("Master Agreement"), in which case the Master Agreement shall govern. + +Source code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included. + + EOT + + spec.homepage = "https://github.com/inspec/inspec/tree/main/inspec-bin" + spec.license = "LicenseRef-Chef-EULA" + + spec.require_paths = ["lib"] + spec.required_ruby_version = ">= 3.1.0" + + spec.add_dependency "inspec", "= #{InspecBin::VERSION}" + spec.add_development_dependency "rake" + + spec.files = %w{README.md LICENSE Gemfile} + Dir.glob("*.gemspec") + + Dir.glob("{lib,bin}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } + + spec.bindir = "bin" + spec.executables = %w{inspec} + +end diff --git a/tests/packagedcode/data/package_summary/rubygems/inspec-core-bin.gemspec b/tests/packagedcode/data/package_summary/rubygems/inspec-core-bin.gemspec new file mode 100644 index 00000000000..9906e3d9ac3 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/inspec-core-bin.gemspec @@ -0,0 +1,39 @@ +lib = File.expand_path("lib", __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require "inspec-bin/version" + +# This is just link inspec-bin, but relies on inspec-core instead of inspec +# inspec-core is a stripped-down version of the inspec gem with fewer exotic dependencies + +Gem::Specification.new do |spec| + spec.name = "inspec-core-bin" # dallas multi-pass + spec.version = InspecBin::VERSION + spec.authors = ["Chef InSpec Core Engineering "] + spec.email = ["inspec@chef.io"] + spec.summary = "Infrastructure and compliance testing." + spec.description = <<-EOT +InSpec executable for inspec-core gem. Use of this executable may require accepting a license agreement. + +Packaged distributions of Progress® Chef® products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products ("Master Agreement"), in which case the Master Agreement shall govern. + +Source code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included. + + EOT + + spec.homepage = "https://github.com/inspec/inspec/tree/main/inspec-bin" + spec.license = "LicenseRef-Chef-EULA" + + spec.require_paths = ["lib"] + + spec.required_ruby_version = ">= 3.1.0" + + spec.add_dependency "inspec-core", "= #{InspecBin::VERSION}" + spec.add_development_dependency "rake" + + spec.files = %w{README.md LICENSE Gemfile} + ["inspec-core-bin.gemspec"] + + Dir.glob("{lib,bin}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } + + spec.bindir = "bin" + spec.executables = %w{inspec} + +end diff --git a/tests/packagedcode/data/package_summary/rubygems/lib/inspec-bin/version.rb b/tests/packagedcode/data/package_summary/rubygems/lib/inspec-bin/version.rb new file mode 100644 index 00000000000..ff5f40b0ee9 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/lib/inspec-bin/version.rb @@ -0,0 +1,5 @@ +# This file managed by automation - do not edit manually +module InspecBin + INSPECBIN_ROOT = File.expand_path("..", __dir__) + VERSION = "6.8.1".freeze +end diff --git a/tests/packagedcode/data/package_summary/rubygems/metadata b/tests/packagedcode/data/package_summary/rubygems/metadata new file mode 100644 index 00000000000..be5cdd69c4c --- /dev/null +++ b/tests/packagedcode/data/package_summary/rubygems/metadata @@ -0,0 +1,85 @@ +--- !ruby/object:Gem::Specification +name: inspec-bin +version: !ruby/object:Gem::Version + version: 6.8.1 +platform: ruby +authors: +- 'Chef InSpec Core Engineering ' +autorequire: +bindir: bin +cert_chain: [] +date: 2024-07-25 00:00:00.000000000 Z +dependencies: +- !ruby/object:Gem::Dependency + name: inspec + requirement: !ruby/object:Gem::Requirement + requirements: + - - '=' + - !ruby/object:Gem::Version + version: 6.8.1 + type: :runtime + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - '=' + - !ruby/object:Gem::Version + version: 6.8.1 +- !ruby/object:Gem::Dependency + name: rake + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +description: |+ + InSpec executable for inspec gem. Use of this executable may require accepting a license agreement." + + Packaged distributions of Progress® Chef® products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products ("Master Agreement"), in which case the Master Agreement shall govern. + + Source code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included. + +email: +- inspec@chef.io +executables: +- inspec +extensions: [] +extra_rdoc_files: [] +files: +- Gemfile +- LICENSE +- README.md +- bin/inspec +- inspec-bin.gemspec +- inspec-core-bin.gemspec +- lib/inspec-bin/version.rb +homepage: https://github.com/inspec/inspec/tree/main/inspec-bin +licenses: +- LicenseRef-Chef-EULA +metadata: {} +post_install_message: +rdoc_options: [] +require_paths: +- lib +required_ruby_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: 3.1.0 +required_rubygems_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +requirements: [] +rubygems_version: 3.2.3 +signing_key: +specification_version: 4 +summary: Infrastructure and compliance testing. +test_files: [] diff --git a/tests/packagedcode/data/package_summary/rust-expected.json b/tests/packagedcode/data/package_summary/rust-expected.json new file mode 100644 index 00000000000..8fe22705294 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust-expected.json @@ -0,0 +1,2744 @@ +{ + "summary": { + "declared_license_expression": "mit", + "license_clarity_score": { + "score": 100, + "declared_license": true, + "identification_precision": true, + "has_license_text": true, + "declared_copyrights": true, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": false + }, + "declared_holder": "Iron Core Team", + "primary_language": null, + "other_license_expressions": [ + { + "value": null, + "count": 12 + } + ], + "other_holders": [ + { + "value": null, + "count": 18 + }, + { + "value": "iron", + "count": 1 + } + ], + "other_languages": [] + }, + "packages": [ + { + "type": "cargo", + "namespace": null, + "name": "iron", + "version": "0.6.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Extensible, Concurrency Focused Web Development in Rust.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Zach Pomerantz", + "email": "zmp@umich.edu", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Michael Sproul", + "email": "micsproul@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Patrick Tran", + "email": "patrick.tran06@gmail.com", + "url": null + } + ], + "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": "https://github.com/iron/iron", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/iron/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": "mit", + "other_license_expression_spdx": "MIT", + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/iron" + }, + "repository_homepage_url": "https://crates.io/crates/iron", + "repository_download_url": "https://crates.io/api/v1/crates/iron/0.6.0/download", + "api_data_url": "https://crates.io/api/v1/crates/iron", + "package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "iron/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:cargo/iron@0.6.0" + }, + { + "type": "cargo", + "namespace": null, + "name": "logger", + "version": "0.4.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Logging middleware for the Iron framework.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Alexander Irbis", + "email": "irbis.labs@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Michael Reinhard", + "email": "mcreinhard@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "logger", + "log", + "timer" + ], + "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": "https://github.com/iron/logger", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/logger/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": "mit", + "other_license_expression_spdx": "MIT", + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "repository_homepage_url": "https://crates.io/crates/logger", + "repository_download_url": "https://crates.io/api/v1/crates/logger/0.4.0/download", + "api_data_url": "https://crates.io/api/v1/crates/logger", + "package_uid": "pkg:cargo/logger@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "logger/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:cargo/logger@0.4.0" + }, + { + "type": "cargo", + "namespace": null, + "name": "mount", + "version": "0.4.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Mounting middleware for Iron.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "handler", + "routing" + ], + "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": "https://github.com/iron/mount", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/mount/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": "mit", + "other_license_expression_spdx": "MIT", + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/mount" + }, + "repository_homepage_url": "https://crates.io/crates/mount", + "repository_download_url": "https://crates.io/api/v1/crates/mount/0.4.0/download", + "api_data_url": "https://crates.io/api/v1/crates/mount", + "package_uid": "pkg:cargo/mount@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "mount/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:cargo/mount@0.4.0" + }, + { + "type": "cargo", + "namespace": null, + "name": "persistent", + "version": "0.4.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "A set of middleware for sharing server-global data in Iron.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "persistence", + "sharing", + "global" + ], + "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": "https://github.com/iron/persistent", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/persistent/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": "mit", + "other_license_expression_spdx": "MIT", + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/persistent" + }, + "repository_homepage_url": "https://crates.io/crates/persistent", + "repository_download_url": "https://crates.io/api/v1/crates/persistent/0.4.0/download", + "api_data_url": "https://crates.io/api/v1/crates/persistent", + "package_uid": "pkg:cargo/persistent@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "persistent/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:cargo/persistent@0.4.0" + }, + { + "type": "cargo", + "namespace": null, + "name": "router", + "version": "0.6.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "A router for the Iron framework.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "http", + "routing", + "router" + ], + "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": "https://github.com/iron/router", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/router/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": "mit", + "other_license_expression_spdx": "MIT", + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/router" + }, + "repository_homepage_url": "https://crates.io/crates/router", + "repository_download_url": "https://crates.io/api/v1/crates/router/0.6.0/download", + "api_data_url": "https://crates.io/api/v1/crates/router", + "package_uid": "pkg:cargo/router@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_paths": [ + "router/Cargo.toml" + ], + "datasource_ids": [ + "cargo_toml" + ], + "license_clarity_score": { + "score": 0, + "declared_license": false, + "identification_precision": false, + "has_license_text": false, + "declared_copyrights": false, + "conflicting_license_categories": false, + "ambiguous_compound_licensing": true + }, + "purl": "pkg:cargo/router@0.6.0" + } + ], + "dependencies": [ + { + "purl": "pkg:cargo/futures", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/futures?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/futures-cpupool", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/futures-cpupool?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/http", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/http?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/hyper", + "extracted_requirement": "0.12", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/hyper?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/log", + "extracted_requirement": "0.4", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/log?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/mime", + "extracted_requirement": "0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/mime?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/mime_guess", + "extracted_requirement": "2.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/mime_guess?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/modifier", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/modifier?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/plugin", + "extracted_requirement": "0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/plugin?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/typemap", + "extracted_requirement": "0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/typemap?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/url", + "extracted_requirement": "1.7", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/url?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/time", + "extracted_requirement": "0.1", + "scope": "dev-dependencies", + "is_runtime": false, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/time?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "iron/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/iron", + "extracted_requirement": ">=0.4,<0.8.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "version": ">=0.4,<0.8.0", + "default-features": false + }, + "dependency_uid": "pkg:cargo/iron?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/logger@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "logger/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/log", + "extracted_requirement": "0.4.8", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/log?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/logger@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "logger/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/time", + "extracted_requirement": "0.1.42", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/time?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/logger@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "logger/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/env_logger", + "extracted_requirement": "0.7.1", + "scope": "dev-dependencies", + "is_runtime": false, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/env_logger?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/logger@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "logger/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/iron", + "extracted_requirement": "0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "path": "../iron", + "version": "0.6" + }, + "dependency_uid": "pkg:cargo/iron?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/mount@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "mount/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/sequence_trie", + "extracted_requirement": "0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/sequence_trie?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/mount@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "mount/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/iron", + "extracted_requirement": "0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "path": "../iron", + "version": "0.6" + }, + "dependency_uid": "pkg:cargo/iron?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/persistent@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "persistent/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/plugin", + "extracted_requirement": "0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/plugin?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/persistent@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "persistent/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/route-recognizer", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/route-recognizer?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/router@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "router/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/iron", + "extracted_requirement": "0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "path": "../iron", + "version": "0.6" + }, + "dependency_uid": "pkg:cargo/iron?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/router@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "router/Cargo.toml", + "datasource_id": "cargo_toml" + }, + { + "purl": "pkg:cargo/url", + "extracted_requirement": "1.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {}, + "dependency_uid": "pkg:cargo/url?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": "pkg:cargo/router@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "datafile_path": "router/Cargo.toml", + "datasource_id": "cargo_toml" + } + ], + "license_detections": [ + { + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 7, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "rust/README.md", + "start_line": 72, + "end_line": 74, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ] + }, + { + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 5, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "rust/iron/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null + } + ] + }, + { + "identifier": "mit-86fcf017-3572-9813-b7e8-0a10ec4a120f", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 3, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "rust/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "rust/LICENSE", + "start_line": 5, + "end_line": 21, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 161, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit.LICENSE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" + } + ] + }, + { + "identifier": "mit-fc87257b-1996-368a-67f3-848e6e865560", + "license_expression": "mit", + "license_expression_spdx": "MIT", + "detection_count": 2, + "reference_matches": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "from_file": "rust/README.md", + "start_line": 5, + "end_line": 5, + "matcher": "3-seq", + "score": 92.86, + "matched_length": 13, + "match_coverage": 92.86, + "rule_relevance": 100, + "rule_identifier": "mit_570.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_570.RULE" + } + ] + } + ], + "files": [ + { + "path": "Cargo.toml", + "type": "file", + "package_data": [ + { + "type": "cargo", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "", + "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, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + }, + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/LICENSE", + "start_line": 5, + "end_line": 21, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 161, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit.LICENSE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" + } + ], + "identifier": "mit-86fcf017-3572-9813-b7e8-0a10ec4a120f" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/README.md", + "start_line": 5, + "end_line": 5, + "matcher": "3-seq", + "score": 92.86, + "matched_length": 13, + "match_coverage": 92.86, + "rule_relevance": 100, + "rule_identifier": "mit_570.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_570.RULE" + } + ], + "identifier": "mit-fc87257b-1996-368a-67f3-848e6e865560" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/README.md", + "start_line": 72, + "end_line": 74, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "workspace": { + "members": [ + "iron", + "logger", + "mount", + "persistent", + "router" + ] + } + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "cargo_toml", + "purl": null + } + ], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "LICENSE", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + }, + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/LICENSE", + "start_line": 5, + "end_line": 21, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 161, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit.LICENSE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" + } + ], + "identifier": "mit-86fcf017-3572-9813-b7e8-0a10ec4a120f" + } + ], + "license_clues": [], + "percentage_of_license_text": 96.49, + "copyrights": [ + { + "copyright": "Copyright (c) 2014 Iron Core Team", + "start_line": 3, + "end_line": 3 + } + ], + "holders": [ + { + "holder": "Iron Core Team", + "start_line": 3, + "end_line": 3 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "README.md", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": true, + "is_top_level": true, + "is_key_file": true, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/README.md", + "start_line": 5, + "end_line": 5, + "matcher": "3-seq", + "score": 92.86, + "matched_length": 13, + "match_coverage": 92.86, + "rule_relevance": 100, + "rule_identifier": "mit_570.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_570.RULE" + } + ], + "identifier": "mit-fc87257b-1996-368a-67f3-848e6e865560" + }, + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/README.md", + "start_line": 72, + "end_line": 74, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 3.81, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "iron", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "iron/Cargo.toml", + "type": "file", + "package_data": [ + { + "type": "cargo", + "namespace": null, + "name": "iron", + "version": "0.6.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Extensible, Concurrency Focused Web Development in Rust.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Zach Pomerantz", + "email": "zmp@umich.edu", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Michael Sproul", + "email": "micsproul@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Patrick Tran", + "email": "patrick.tran06@gmail.com", + "url": null + } + ], + "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": "https://github.com/iron/iron", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/iron/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/iron" + }, + "dependencies": [ + { + "purl": "pkg:cargo/futures", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/futures-cpupool", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/http", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/hyper", + "extracted_requirement": "0.12", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/log", + "extracted_requirement": "0.4", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/mime", + "extracted_requirement": "0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/mime_guess", + "extracted_requirement": "2.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/modifier", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/plugin", + "extracted_requirement": "0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/typemap", + "extracted_requirement": "0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/url", + "extracted_requirement": "1.7", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/time", + "extracted_requirement": "0.1", + "scope": "dev-dependencies", + "is_runtime": false, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://crates.io/crates/iron", + "repository_download_url": "https://crates.io/api/v1/crates/iron/0.6.0/download", + "api_data_url": "https://crates.io/api/v1/crates/iron", + "datasource_id": "cargo_toml", + "purl": "pkg:cargo/iron@0.6.0" + } + ], + "for_packages": [ + "pkg:cargo/iron@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/iron/Cargo.toml", + "start_line": 10, + "end_line": 10, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 1.96, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Jonathan Reem Zach Pomerantz ", + "start_line": 2, + "end_line": 4 + } + ], + "scan_errors": [] + }, + { + "path": "iron/src", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "iron/src/iron.rs", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "logger", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "logger/CONTRIBUTING.md", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "logger/Cargo.toml", + "type": "file", + "package_data": [ + { + "type": "cargo", + "namespace": null, + "name": "logger", + "version": "0.4.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Logging middleware for the Iron framework.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Alexander Irbis", + "email": "irbis.labs@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + }, + { + "type": "person", + "role": "author", + "name": "Michael Reinhard", + "email": "mcreinhard@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "logger", + "log", + "timer" + ], + "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": "https://github.com/iron/logger", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/logger/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:cargo/iron", + "extracted_requirement": ">=0.4,<0.8.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "version": ">=0.4,<0.8.0", + "default-features": false + } + }, + { + "purl": "pkg:cargo/log", + "extracted_requirement": "0.4.8", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/time", + "extracted_requirement": "0.1.42", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/env_logger", + "extracted_requirement": "0.7.1", + "scope": "dev-dependencies", + "is_runtime": false, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://crates.io/crates/logger", + "repository_download_url": "https://crates.io/api/v1/crates/logger/0.4.0/download", + "api_data_url": "https://crates.io/api/v1/crates/logger", + "datasource_id": "cargo_toml", + "purl": "pkg:cargo/logger@0.4.0" + } + ], + "for_packages": [ + "pkg:cargo/logger@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/logger/Cargo.toml", + "start_line": 8, + "end_line": 8, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 2.78, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Alexander Irbis Jonathan Reem Michael Reinhard ", + "start_line": 4, + "end_line": 4 + } + ], + "scan_errors": [] + }, + { + "path": "logger/LICENSE", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": true, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/logger/LICENSE", + "start_line": 1, + "end_line": 1, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 4, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_26.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_26.RULE" + }, + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/logger/LICENSE", + "start_line": 5, + "end_line": 21, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 161, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit.LICENSE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE" + } + ], + "identifier": "mit-86fcf017-3572-9813-b7e8-0a10ec4a120f" + } + ], + "license_clues": [], + "percentage_of_license_text": 97.63, + "copyrights": [ + { + "copyright": "Copyright (c) 2014 iron", + "start_line": 3, + "end_line": 3 + } + ], + "holders": [ + { + "holder": "iron", + "start_line": 3, + "end_line": 3 + } + ], + "authors": [], + "scan_errors": [] + }, + { + "path": "logger/README.md", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": true, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "logger/src", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "logger/src/format.rs", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "logger/src/lib.rs", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "mount", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "mount/Cargo.toml", + "type": "file", + "package_data": [ + { + "type": "cargo", + "namespace": null, + "name": "mount", + "version": "0.4.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "Mounting middleware for Iron.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "handler", + "routing" + ], + "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": "https://github.com/iron/mount", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/mount/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/mount" + }, + "dependencies": [ + { + "purl": "pkg:cargo/iron", + "extracted_requirement": "0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "path": "../iron", + "version": "0.6" + } + }, + { + "purl": "pkg:cargo/sequence_trie", + "extracted_requirement": "0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://crates.io/crates/mount", + "repository_download_url": "https://crates.io/api/v1/crates/mount/0.4.0/download", + "api_data_url": "https://crates.io/api/v1/crates/mount", + "datasource_id": "cargo_toml", + "purl": "pkg:cargo/mount@0.4.0" + } + ], + "for_packages": [ + "pkg:cargo/mount@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/mount/Cargo.toml", + "start_line": 9, + "end_line": 9, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 4.17, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Jonathan Reem ", + "start_line": 4, + "end_line": 4 + } + ], + "scan_errors": [] + }, + { + "path": "mount/README.md", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": true, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "mount/src", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "mount/src/mount.rs", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "persistent", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "persistent/Cargo.toml", + "type": "file", + "package_data": [ + { + "type": "cargo", + "namespace": null, + "name": "persistent", + "version": "0.4.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "A set of middleware for sharing server-global data in Iron.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "persistence", + "sharing", + "global" + ], + "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": "https://github.com/iron/persistent", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/persistent/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/persistent" + }, + "dependencies": [ + { + "purl": "pkg:cargo/iron", + "extracted_requirement": "0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "path": "../iron", + "version": "0.6" + } + }, + { + "purl": "pkg:cargo/plugin", + "extracted_requirement": "0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://crates.io/crates/persistent", + "repository_download_url": "https://crates.io/api/v1/crates/persistent/0.4.0/download", + "api_data_url": "https://crates.io/api/v1/crates/persistent", + "datasource_id": "cargo_toml", + "purl": "pkg:cargo/persistent@0.4.0" + } + ], + "for_packages": [ + "pkg:cargo/persistent@0.4.0?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/persistent/Cargo.toml", + "start_line": 9, + "end_line": 9, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 3.7, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Jonathan Reem ", + "start_line": 4, + "end_line": 4 + } + ], + "scan_errors": [] + }, + { + "path": "persistent/README.md", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": true, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "persistent/src", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "persistent/src/lib.rs", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "router", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": true, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "router/Cargo.toml", + "type": "file", + "package_data": [ + { + "type": "cargo", + "namespace": null, + "name": "router", + "version": "0.6.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "Rust", + "description": "A router for the Iron framework.", + "release_date": null, + "parties": [ + { + "type": "person", + "role": "author", + "name": "Jonathan Reem", + "email": "jonathan.reem@gmail.com", + "url": null + } + ], + "keywords": [ + "iron", + "web", + "http", + "routing", + "router" + ], + "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": "https://github.com/iron/router", + "copyright": null, + "holder": null, + "declared_license_expression": "mit", + "declared_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/router/Cargo.toml", + "start_line": 1, + "end_line": 1, + "matcher": "1-spdx-id", + "score": 100.0, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06", + "rule_url": null, + "matched_text": "MIT" + } + ], + "identifier": "mit-a822f434-d61f-f2b1-c792-8b8cb9e7b9bf" + } + ], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": "MIT", + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "documentation_url": "https://docs.rs/router" + }, + "dependencies": [ + { + "purl": "pkg:cargo/route-recognizer", + "extracted_requirement": "0.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + }, + { + "purl": "pkg:cargo/iron", + "extracted_requirement": "0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": { + "path": "../iron", + "version": "0.6" + } + }, + { + "purl": "pkg:cargo/url", + "extracted_requirement": "1.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "is_direct": true, + "resolved_package": {}, + "extra_data": {} + } + ], + "repository_homepage_url": "https://crates.io/crates/router", + "repository_download_url": "https://crates.io/api/v1/crates/router/0.6.0/download", + "api_data_url": "https://crates.io/api/v1/crates/router", + "datasource_id": "cargo_toml", + "purl": "pkg:cargo/router@0.6.0" + } + ], + "for_packages": [ + "pkg:cargo/router@0.6.0?uuid=fixed-uid-done-for-testing-5642512d1758" + ], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": "mit", + "detected_license_expression_spdx": "MIT", + "license_detections": [ + { + "license_expression": "mit", + "license_expression_spdx": "MIT", + "matches": [ + { + "license_expression": "mit", + "spdx_license_expression": "MIT", + "from_file": "rust/router/Cargo.toml", + "start_line": 5, + "end_line": 5, + "matcher": "2-aho", + "score": 100.0, + "matched_length": 2, + "match_coverage": 100.0, + "rule_relevance": 100, + "rule_identifier": "mit_30.RULE", + "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE" + } + ], + "identifier": "mit-3fce6ea2-8abd-6c6b-3ede-a37af7c6efee" + } + ], + "license_clues": [], + "percentage_of_license_text": 3.77, + "copyrights": [], + "holders": [], + "authors": [ + { + "author": "Jonathan Reem ", + "start_line": 4, + "end_line": 4 + } + ], + "scan_errors": [] + }, + { + "path": "router/README.md", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": true, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "router/src", + "type": "directory", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + }, + { + "path": "router/src/router.rs", + "type": "file", + "package_data": [], + "for_packages": [], + "is_legal": false, + "is_manifest": false, + "is_readme": false, + "is_top_level": false, + "is_key_file": false, + "detected_license_expression": null, + "detected_license_expression_spdx": null, + "license_detections": [], + "license_clues": [], + "percentage_of_license_text": 0, + "copyrights": [], + "holders": [], + "authors": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/rust/Cargo.toml b/tests/packagedcode/data/package_summary/rust/Cargo.toml new file mode 100644 index 00000000000..36037858b90 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +members = [ + "iron", + "logger", + "mount", + "persistent", + "router", +] diff --git a/tests/packagedcode/data/package_summary/rust/LICENSE b/tests/packagedcode/data/package_summary/rust/LICENSE new file mode 100644 index 00000000000..de88bcd0be6 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Iron Core Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tests/packagedcode/data/package_summary/rust/README.md b/tests/packagedcode/data/package_summary/rust/README.md new file mode 100644 index 00000000000..152c44362db --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/README.md @@ -0,0 +1,74 @@ +# Iron + +[![Build Status](https://secure.travis-ci.org/iron/iron.svg?branch=master)](https://travis-ci.org/iron/iron) +[![Crates.io Status](http://meritbadge.herokuapp.com/iron)](https://crates.io/crates/iron) +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/iron/iron/master/LICENSE) + +> Extensible, Concurrency Focused Web Development in Rust. + +## Overview + +Iron is a high level web framework built in and for Rust, built on +[hyper](https://github.com/hyperium/hyper). Iron is designed to take advantage +of Rust's greatest features - its excellent type system and its principled +approach to ownership in both single threaded and multi threaded contexts. + +Iron is highly concurrent and can scale horizontally on more machines behind a +load balancer or by running more threads on a more powerful machine. Iron +avoids the bottlenecks encountered in highly concurrent code by avoiding shared +writes and locking in the core framework. + +Iron is 100% safe code: + +```sh +$ rg unsafe src | wc + 0 0 0 +``` + +## Performance + +Iron averages [72,000+ requests per second for hello world](https://github.com/iron/iron/wiki/How-to-Benchmark-hello.rs-Example) +and is mostly IO-bound, spending over 70% of its time in the kernel send-ing or +recv-ing data.\* + +\* _Numbers from profiling on my OS X machine, your mileage may vary._ + +## Core Extensions + +Iron aims to fill a void in the Rust web stack - a high level framework that is +_extensible_ and makes organizing complex server code easy. + +Extensions are painless to build. Some important ones are: + +Middleware: + +- [Routing](https://github.com/iron/router) +- [Mounting](https://github.com/iron/mount) +- [Static File Serving](https://github.com/iron/staticfile) +- [Logging](https://github.com/iron/logger) + +Plugins: + +- [JSON Body Parsing](https://github.com/iron/body-parser) +- [URL Encoded Data Parsing](https://github.com/iron/urlencoded) +- [All-In-One (JSON, URL, & Form Data) Parameter Parsing](https://github.com/iron/params) + +Both: + +- [Shared Memory (also used for Plugin configuration)](https://github.com/iron/persistent) +- [Sessions](https://github.com/iron/iron-sessionstorage) + +## Underlying HTTP Implementation + +Iron is based on and uses [`hyper`](https://github.com/hyperium/hyper) as its +HTTP implementation, and lifts several types from it, including its header +representation, status, and other core HTTP types. It is usually unnecessary to +use `hyper` directly when using Iron, since Iron provides a facade over +`hyper`'s core facilities, but it is sometimes necessary to depend on it as +well. + + + +## License + +MIT diff --git a/tests/packagedcode/data/package_summary/rust/iron/Cargo.toml b/tests/packagedcode/data/package_summary/rust/iron/Cargo.toml new file mode 100644 index 00000000000..009b6bc152d --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/iron/Cargo.toml @@ -0,0 +1,35 @@ +[package] +authors = [ + "Jonathan Reem ", + "Zach Pomerantz ", + "Michael Sproul ", + "Patrick Tran ", +] +description = "Extensible, Concurrency Focused Web Development in Rust." +documentation = "https://docs.rs/iron" +license = "MIT" +name = "iron" +readme = "../README.md" +repository = "https://github.com/iron/iron" +version = "0.6.0" +workspace = ".." + +[dependencies] +futures = "0.1" +futures-cpupool = "0.1" +http = "0.1" +hyper = "0.12" +log = "0.4" +mime = "0.3" +mime_guess = "2.0" +modifier = "0.1" +plugin = "0.2" +typemap = "0.3" +url = "1.7" + +[dev-dependencies] +time = "0.1" + +[lib] +name = "iron" +path = "src/lib.rs" diff --git a/tests/packagedcode/data/package_summary/rust/iron/src/iron.rs b/tests/packagedcode/data/package_summary/rust/iron/src/iron.rs new file mode 100644 index 00000000000..1ffcb09f8ed --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/iron/src/iron.rs @@ -0,0 +1,199 @@ +//! Exposes the `Iron` type, the main entrance point of the +//! `Iron` library. + +use std::net::{SocketAddr, ToSocketAddrs}; +use std::sync::Arc; +use std::time::Duration; + +use futures::{future, Future}; +use futures_cpupool::CpuPool; + +use hyper; +use hyper::service::{NewService, Service}; +use hyper::Server; +use hyper::{Body, Error}; + +use request::HttpRequest; +use response::HttpResponse; + +use {Handler, Request, StatusCode}; + +/// The primary entrance point to `Iron`, a `struct` to instantiate a new server. +/// +/// `Iron` contains the `Handler` which takes a `Request` and produces a +/// `Response`. +pub struct Iron { + /// Iron contains a `Handler`, which it uses to create responses for client + /// requests. + pub handler: Arc, + + /// Server timeouts. + pub timeouts: Timeouts, + + /// Cpu pool to run synchronus requests on. + /// + /// Defaults to `num_cpus`. Note that reading/writing to the client is + /// handled asyncronusly in a single thread. + pub pool: CpuPool, + + /// Protocol of the incoming requests + /// + /// This is automatically set by the `http` and `https` functions, but + /// can be set if you are manually constructing the hyper `http` instance. + pub protocol: Protocol, + + /// Default host address to use when none is provided + /// + /// When set, this provides a default host for any requests that don't + /// provide one. When unset, any request without a host specified + /// will fail. + pub local_address: Option, +} + +/// A settings struct containing a set of timeouts which can be applied to a server. +#[derive(Debug, PartialEq, Clone, Copy)] +pub struct Timeouts { + /// Controls the timeout for keep alive connections. + /// + /// The default is `Some(Duration::from_secs(5))`. + /// + /// NOTE: Setting this to None will have the effect of turning off keep alive. + pub keep_alive: Option, +} + +impl Default for Timeouts { + fn default() -> Self { + Timeouts { + keep_alive: Some(Duration::from_secs(5)), + } + } +} + +#[derive(Clone)] +enum _Protocol { + Http, + Https, +} + +/// Protocol used to serve content. +#[derive(Clone)] +pub struct Protocol(_Protocol); + +impl Protocol { + /// Plaintext HTTP/1 + pub fn http() -> Protocol { + Protocol(_Protocol::Http) + } + + /// HTTP/1 over SSL/TLS + pub fn https() -> Protocol { + Protocol(_Protocol::Https) + } + + /// Returns the name used for this protocol in a URI's scheme part. + pub fn name(&self) -> &str { + match self.0 { + _Protocol::Http => "http", + _Protocol::Https => "https", + } + } +} + +impl Iron { + /// Instantiate a new instance of `Iron`. + /// + /// This will create a new `Iron`, the base unit of the server, using the + /// passed in `Handler`. + pub fn new(handler: H) -> Iron { + Iron { + handler: Arc::new(handler), + protocol: Protocol::http(), + local_address: None, + timeouts: Timeouts::default(), + pool: CpuPool::new_num_cpus(), + } + } + + /// Kick off the server process using the HTTP protocol. + /// + /// Call this once to begin listening for requests on the server. + pub fn http(mut self, addr: A) + where + A: ToSocketAddrs, + { + let addr: SocketAddr = addr.to_socket_addrs().unwrap().next().unwrap(); + self.local_address = Some(addr); + + let server = Server::bind(&addr) + .tcp_keepalive(self.timeouts.keep_alive) + .serve(self) + .map_err(|e| eprintln!("server error: {}", e)); + + hyper::rt::run(server); + } +} + +impl NewService for Iron { + type ReqBody = hyper::body::Body; + type ResBody = hyper::body::Body; + type Error = Error; + type Service = IronHandler; + type InitError = Error; + type Future = future::FutureResult; + + fn new_service(&self) -> Self::Future { + future::ok(IronHandler { + handler: self.handler.clone(), + addr: self.local_address, + protocol: self.protocol.clone(), + pool: self.pool.clone(), + }) + } +} + +/// This is the internal struct that translates between hyper and iron. +pub struct IronHandler { + handler: Arc, + addr: Option, + protocol: Protocol, + pool: CpuPool, +} + +impl Service for IronHandler { + type ReqBody = hyper::body::Body; + type ResBody = hyper::body::Body; + type Error = Error; + type Future = Box, Error = Self::Error> + Send>; + + fn call(&mut self, req: HttpRequest) -> Self::Future { + let addr = self.addr; + let proto = self.protocol.clone(); + let handler = self.handler.clone(); + + Box::new(self.pool.spawn_fn(move || { + let mut http_res = HttpResponse::::new(Body::empty()); + *http_res.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; + + match Request::from_http(req, addr, &proto) { + Ok(mut req) => { + // Dispatch the request, write the response back to http_res + handler + .handle(&mut req) + .unwrap_or_else(|e| { + error!("Error handling:\n{:?}\nError was: {:?}", req, e.error); + e.response + }).write_back(&mut http_res, req.method) + } + Err(e) => { + error!("Error creating request:\n {}", e); + bad_request(&mut http_res) + } + }; + future::ok(http_res) + })) + } +} + +fn bad_request(http_res: &mut HttpResponse) { + *http_res.status_mut() = StatusCode::BAD_REQUEST; +} diff --git a/tests/packagedcode/data/package_summary/rust/logger/CONTRIBUTING.md b/tests/packagedcode/data/package_summary/rust/logger/CONTRIBUTING.md new file mode 100644 index 00000000000..12426e49348 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/logger/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing + +**logger** uses the same conventions as **[Iron](https://github.com/iron/iron)**. + +### Overview + +* Fork logger to your own account +* Create a feature branch, namespaced by. + * bug/... + * feat/... + * test/... + * doc/... + * refactor/... +* Make commits to your feature branch. Prefix each commit like so: + * (feat) Added a new feature + * (fix) Fixed inconsistent tests [Fixes #0] + * (refactor) ... + * (cleanup) ... + * (test) ... + * (doc) ... +* Make a pull request with your changes directly to master. Include a + description of your changes. +* Wait for one of the reviewers to look at your code and either merge it or + give feedback which you should adapt to. + +#### Thank you for contributing! diff --git a/tests/packagedcode/data/package_summary/rust/logger/Cargo.toml b/tests/packagedcode/data/package_summary/rust/logger/Cargo.toml new file mode 100644 index 00000000000..cb67fd567a7 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/logger/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "logger" +version = "0.4.0" +authors = ["Alexander Irbis ", "Jonathan Reem ", "Michael Reinhard "] +description = "Logging middleware for the Iron framework." +repository = "https://github.com/iron/logger" +keywords = ["iron", "web", "logger", "log", "timer"] +license = "MIT" + +[dependencies] +iron = { version = ">=0.4,<0.8.0", default-features = false } +log = "0.4.8" +time = "0.1.42" + +[dev-dependencies] +env_logger = "0.7.1" diff --git a/tests/packagedcode/data/package_summary/rust/logger/LICENSE b/tests/packagedcode/data/package_summary/rust/logger/LICENSE new file mode 100644 index 00000000000..04d30776743 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/logger/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 iron + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/tests/packagedcode/data/package_summary/rust/logger/README.md b/tests/packagedcode/data/package_summary/rust/logger/README.md new file mode 100644 index 00000000000..970addf9b71 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/logger/README.md @@ -0,0 +1,73 @@ +logger [![Build Status](https://secure.travis-ci.org/iron/logger.png?branch=master)](https://travis-ci.org/iron/logger) +==== + +> [Morgan](https://github.com/expressjs/morgan)-inspired logging middleware for the [Iron](https://github.com/iron/iron) web framework. + +## Example + +```rust +extern crate iron; +extern crate logger; + +use iron::prelude::*; +use logger::Logger; + +fn main() { + let (logger_before, logger_after) = Logger::new(None); + + let mut chain = Chain::new(no_op_handler); + + // Link logger_before as your first before middleware. + chain.link_before(logger_before); + + // Link logger_after as your *last* after middleware. + chain.link_after(logger_after); + + Iron::new(chain).http("127.0.0.1:3000").unwrap(); +} + +fn no_op_handler(_: &mut Request) -> IronResult { + Ok(Response::with(iron::status::Ok)) +} +``` + +## Overview + +Logger is a part of Iron's [core bundle](https://github.com/iron/core). + +Logger emits request and response information using standard rust [log facade](https://docs.rs/log/0.4.8/log/), formatted with the default format or a custom format string. + +Format strings can specify fields to be logged (ANSI terminal colors and attributes are no longer supported as of [#82](https://github.com/iron/logger/issues/82)). + +## Installation + +If you're using a `Cargo.toml` to manage dependencies, just add logger to the toml: + +```toml +[dependencies.logger] + +git = "https://github.com/iron/logger.git" +``` + +Otherwise, `cargo build`, and the rlib will be in your `target` directory. + +## [Documentation](https://docs.rs/logger) + +Along with the [online documentation](https://docs.rs/logger), +you can build a local copy with `make doc`. + +## [Examples](/examples) + +## Log implementations + +To actually log anything, you will need to use some log implementation that will deliver the logs to your desired location, like standard error output, a file, or a log collecting service. This is not the responsibility of iron-logger alone. There are numerous such implementations to choose from, from simple ones that just write to standard error like [env_logger](https://crates.io/crates/env_logger), to more configurable ones like [simplelog](https://crates.io/crates/simplelog), to ultimate solutions like [slog](https://crates.io/crates/slog). You can find more on [crates.io](https://crates.io/keywords/logging). + +If you are looking for a turn-key solution, just follow the example in [env_logger](https://docs.rs/env_logger/0.7.1/env_logger/). + +## Get Help + +One of us ([@reem](https://github.com/reem/), [@zzmp](https://github.com/zzmp/), +[@theptrk](https://github.com/theptrk/), [@mcreinhard](https://github.com/mcreinhard)) +is usually on `#iron` on the mozilla irc. Come say hi and ask any questions you might have. +We are also usually on `#rust` and `#rust-webdev`. + diff --git a/tests/packagedcode/data/package_summary/rust/logger/src/format.rs b/tests/packagedcode/data/package_summary/rust/logger/src/format.rs new file mode 100644 index 00000000000..c09c05f9605 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/logger/src/format.rs @@ -0,0 +1,197 @@ +//! Formatting helpers for the logger middleware. + +use std::default::Default; +use std::str::Chars; +use std::iter::Peekable; +use std::fmt::Formatter; + +use self::FormatText::{Method, URI, Status, ResponseTime, RemoteAddr, RequestTime}; + +/// A formatting style for the `Logger`, consisting of multiple +/// `FormatText`s concatenated into one line. +#[derive(Clone)] +pub struct Format(Vec); + +impl Default for Format { + /// Return the default formatting style for the `Logger`: + /// + /// ```ignore + /// {method} {uri} -> {status} ({response-time}) + /// // This will be written as: {method} {uri} -> {status} ({response-time}) + /// ``` + fn default() -> Format { + Format::new("{method} {uri} {status} ({response-time})").unwrap() + } +} + +impl Format { + /// Create a `Format` from a format string, which can contain the fields + /// `{method}`, `{uri}`, `{status}`, `{response-time}`, `{ip-addr}` and + /// `{request-time}`. + /// + /// Returns `None` if the format string syntax is incorrect. + pub fn new(s: &str) -> Option { + + let parser = FormatParser::new(s.chars().peekable()); + + let mut results = Vec::new(); + + for unit in parser { + match unit { + Some(unit) => results.push(unit), + None => return None + } + } + + Some(Format(results)) + } +} + +pub trait ContextDisplay<'a> { + type Item; + type Display: fmt::Display; + fn display_with(&'a self, + render: &'a dyn Fn(&mut Formatter, &Self::Item) -> Result<(), fmt::Error>) + -> Self::Display; +} + + +impl<'a> ContextDisplay<'a> for Format { + type Item = FormatText; + type Display = FormatDisplay<'a>; + fn display_with(&'a self, + render: &'a dyn Fn(&mut Formatter, &FormatText) -> Result<(), fmt::Error>) + -> FormatDisplay<'a> { + FormatDisplay { + format: self, + render: render, + } + } +} + +struct FormatParser<'a> { + // The characters of the format string. + chars: Peekable>, + + // A reusable buffer for parsing style attributes. + object_buffer: String, + + finished: bool +} + +impl<'a> FormatParser<'a> { + fn new(chars: Peekable) -> FormatParser { + FormatParser { + chars: chars, + + // No attributes are longer than 14 characters, so we can avoid reallocating. + object_buffer: String::with_capacity(14), + + finished: false + } + } +} + +// Some(None) means there was a parse error and this FormatParser should be abandoned. +impl<'a> Iterator for FormatParser<'a> { + type Item = Option; + + fn next(&mut self) -> Option> { + // If the parser has been cancelled or errored for some reason. + if self.finished { return None } + + // Try to parse a new FormatText. + match self.chars.next() { + // Parse a recognized object. + // + // The allowed forms are: + // - {method} + // - {uri} + // - {status} + // - {response-time} + // - {ip-addr} + // - {request-time} + Some('{') => { + self.object_buffer.clear(); + + let mut chr = self.chars.next(); + while chr != None { + match chr.unwrap() { + // Finished parsing, parse buffer. + '}' => break, + c => self.object_buffer.push(c.clone()) + } + + chr = self.chars.next(); + } + + let text = match self.object_buffer.as_ref() { + "method" => Method, + "uri" => URI, + "status" => Status, + "response-time" => ResponseTime, + "request-time" => RequestTime, + "ip-addr" => RemoteAddr, + _ => { + // Error, so mark as finished. + self.finished = true; + return Some(None); + } + }; + + Some(Some(text)) + } + + // Parse a regular string part of the format string. + Some(c) => { + let mut buffer = String::new(); + buffer.push(c); + + loop { + match self.chars.peek() { + // Done parsing. + Some(&'{') | None => return Some(Some(FormatText::Str(buffer))), + + Some(_) => { + buffer.push(self.chars.next().unwrap()) + } + } + } + }, + + // Reached end of the format string. + None => None + } + } +} + +/// A string of text to be logged. This is either one of the data +/// fields supported by the `Logger`, or a custom `String`. +#[derive(Clone)] +#[doc(hidden)] +pub enum FormatText { + Str(String), + Method, + URI, + Status, + ResponseTime, + RemoteAddr, + RequestTime +} + + +pub struct FormatDisplay<'a> { + format: &'a Format, + render: &'a dyn Fn(&mut Formatter, &FormatText) -> Result<(), fmt::Error>, +} + +use std::fmt; +impl<'a> fmt::Display for FormatDisplay<'a> { + fn fmt(&self, fmt: &mut Formatter) -> Result<(), fmt::Error> { + let Format(ref format) = *self.format; + for unit in format { + (self.render)(fmt, unit)?; + } + Ok(()) + } +} diff --git a/tests/packagedcode/data/package_summary/rust/logger/src/lib.rs b/tests/packagedcode/data/package_summary/rust/logger/src/lib.rs new file mode 100644 index 00000000000..6fabe11bf7c --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/logger/src/lib.rs @@ -0,0 +1,113 @@ +#![deny(missing_docs, warnings)] + +//! Request logging middleware for Iron + +extern crate iron; +#[macro_use] extern crate log; +extern crate time; + +use iron::{AfterMiddleware, BeforeMiddleware, IronResult, IronError, Request, Response}; +use iron::typemap::Key; + +use format::FormatText::{Str, Method, URI, Status, ResponseTime, RemoteAddr, RequestTime}; +use format::{ContextDisplay, FormatText}; + +use std::fmt::{Display, Formatter}; + +mod format; +pub use format::Format; + +/// `Middleware` for logging request and response info to the terminal. +pub struct Logger { + format: Format, +} + +impl Logger { + /// Create a pair of `Logger` middlewares with the specified `format`. If a `None` is passed in, uses the default format: + /// + /// ```ignore + /// {method} {uri} -> {status} ({response-time} ms) + /// ``` + /// + /// While the returned value can be passed straight to `Chain::link`, consider making the logger `BeforeMiddleware` + /// the first in your chain and the logger `AfterMiddleware` the last by doing something like this: + /// + /// ```ignore + /// let mut chain = Chain::new(handler); + /// let (logger_before, logger_after) = Logger::new(None); + /// chain.link_before(logger_before); + /// // link other middlewares here... + /// chain.link_after(logger_after); + /// ``` + pub fn new(format: Option) -> (Logger, Logger) { + let format = format.unwrap_or_default(); + (Logger { format: format.clone() }, Logger { format: format }) + } +} + +struct StartTime; +impl Key for StartTime { type Value = time::Tm; } + +impl Logger { + fn initialise(&self, req: &mut Request) { + req.extensions.insert::(time::now()); + } + + fn log(&self, req: &mut Request, res: &Response) -> IronResult<()> { + let entry_time = *req.extensions.get::().unwrap(); + + let response_time = time::now() - entry_time; + let response_time_ms = (response_time.num_nanoseconds().unwrap_or(0) as f64) / 1000000.0; + + { + let render = |fmt: &mut Formatter, text: &FormatText| { + match *text { + Str(ref string) => fmt.write_str(string), + Method => req.method.fmt(fmt), + URI => req.url.fmt(fmt), + Status => { + match res.status { + Some(status) => status.fmt(fmt), + None => fmt.write_str(""), + } + } + ResponseTime => fmt.write_fmt(format_args!("{} ms", response_time_ms)), + RemoteAddr => req.remote_addr.fmt(fmt), + RequestTime => { + entry_time.strftime("%Y-%m-%dT%H:%M:%S.%fZ%z") + .unwrap() + .fmt(fmt) + } + } + }; + + info!("{}", self.format.display_with(&render)); + } + + Ok(()) + } +} + +impl BeforeMiddleware for Logger { + fn before(&self, req: &mut Request) -> IronResult<()> { + self.initialise(req); + Ok(()) + } + + fn catch(&self, req: &mut Request, err: IronError) -> IronResult<()> { + self.initialise(req); + Err(err) + } +} + +impl AfterMiddleware for Logger { + fn after(&self, req: &mut Request, res: Response) -> IronResult { + self.log(req, &res)?; + Ok(res) + } + + fn catch(&self, req: &mut Request, err: IronError) -> IronResult { + self.log(req, &err.response)?; + Err(err) + } +} diff --git a/tests/packagedcode/data/package_summary/rust/mount/Cargo.toml b/tests/packagedcode/data/package_summary/rust/mount/Cargo.toml new file mode 100644 index 00000000000..2b89c3132de --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/mount/Cargo.toml @@ -0,0 +1,14 @@ +[package] + +name = "mount" +authors = ["Jonathan Reem "] +version = "0.4.0" +description = "Mounting middleware for Iron." +repository = "https://github.com/iron/mount" +documentation = "https://docs.rs/mount" +license = "MIT" +keywords = ["iron", "web", "handler", "routing"] + +[dependencies] +iron = { path = "../iron", version = "0.6" } +sequence_trie = "0.3" diff --git a/tests/packagedcode/data/package_summary/rust/mount/README.md b/tests/packagedcode/data/package_summary/rust/mount/README.md new file mode 100644 index 00000000000..5a9bc56fb19 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/mount/README.md @@ -0,0 +1,73 @@ +mount [![Build Status](https://secure.travis-ci.org/iron/mount.png?branch=master)](https://travis-ci.org/iron/mount) [![Crates.io Status](https://meritbadge.herokuapp.com/mount)](https://crates.io/crates/mount) +==== + +> Mounting middleware for the [Iron](https://github.com/iron/iron) web framework. + +## Example + +```rust +fn send_hello(req: &mut Request) -> IronResult { + println!("Running send_hello handler, URL path: {:?}", req.url.path()); + Ok(Response::with((StatusCode::OK, "Hello!"))) +} + +fn intercept(req: &mut Request) -> IronResult { + println!("Running intercept handler, URL path: {:?}", req.url.path()); + Ok(Response::with((StatusCode::OK, "Blocked!"))) +} + +fn main() { + let mut mount = Mount::new(); + mount.mount("/blocked/", intercept).mount("/", send_hello); + + Iron::new(mount).http("localhost:3000"); +} +``` + +Running the code above, the following HTTP requests would write the following line to the server process's stdout: + +``` +$ curl http://localhost:3000/ +Running send_hello handler, URL path: [""] + +$ curl http://localhost:3000/blocked/ +Running intercept handler, URL path: [""] + +$ curl http://localhost:3000/foo +Running send_hello handler, URL path: ["foo"] + +$ curl http://localhost:3000/blocked/foo +Running intercept handler, URL path: ["foo"] +``` + +## Overview + +mount is a part of Iron's [core bundle](https://github.com/iron/common). + +- Mount a handler on a sub-path, hiding the old path from that handler. + +## Installation + +If you're using `Cargo` to manage dependencies, just add mount to the toml: + +```toml +[dependencies.mount] + +git = "https://github.com/iron/mount.git" +``` + +Otherwise, `cargo build`, and the rlib will be in your `target` directory. + +## [Documentation](https://docs.rs/mount) + +Along with the [online documentation](https://docs.rs/mount), +you can build a local copy with `cargo doc`. + +## [Examples](/examples) + +## Get Help + +One of us ([@reem](https://github.com/reem/), [@zzmp](https://github.com/zzmp/), +[@theptrk](https://github.com/theptrk/), [@mcreinhard](https://github.com/mcreinhard)) +is usually on `#iron` on the mozilla irc. Come say hi and ask any questions you might have. +We are also usually on `#rust` and `#rust-webdev`. diff --git a/tests/packagedcode/data/package_summary/rust/mount/src/mount.rs b/tests/packagedcode/data/package_summary/rust/mount/src/mount.rs new file mode 100644 index 00000000000..c41468515f5 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/mount/src/mount.rs @@ -0,0 +1,138 @@ +use std::error::Error; +use std::path::{Path, Component}; +use iron::prelude::*; +use iron::middleware::Handler; +use iron::{StatusCode, Url, typemap}; +use sequence_trie::SequenceTrie; +use std::fmt; + +/// Exposes the original, unmodified path to be stored in `Request::extensions`. +#[derive(Copy, Clone)] +pub struct OriginalUrl; +impl typemap::Key for OriginalUrl { type Value = Url; } + +/// `Mount` is a simple mounting middleware. +/// +/// Mounting allows you to install a handler on a route and have it receive requests as if they +/// are relative to that route. For example, a handler mounted on `/foo/` will receive +/// requests like `/foo/bar` as if they are just `/bar`. Iron's mounting middleware allows +/// you to specify multiple mountings using one middleware instance. Requests that pass through +/// the mounting middleware are passed along to the mounted handler that best matches the request's +/// path. `Request::url` is modified so that requests appear to be relative to the mounted handler's route. +/// +/// Mounted handlers may also access the *original* URL by requesting the `OriginalUrl` key +/// from `Request::extensions`. +pub struct Mount { + inner: SequenceTrie +} + +struct Match { + handler: Box, + length: usize +} + +/// The error returned by `Mount` when a request doesn't match any mounted handlers. +#[derive(Debug)] +pub struct NoMatch; + +impl Error for NoMatch { + fn description(&self) -> &'static str { "No Match" } +} + +impl fmt::Display for NoMatch { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str(self.description()) + } +} + +impl Mount { + /// Creates a new instance of `Mount`. + pub fn new() -> Mount { + Mount { + inner: SequenceTrie::new() + } + } + + /// Mounts a given `Handler` onto a route. + /// + /// This method may be called multiple times with different routes. + /// For a given request, the *most specific* handler will be selected. + /// + /// Existing handlers on the same route will be overwritten. + pub fn mount(&mut self, route: &str, handler: H) -> &mut Mount { + // Parse the route into a list of strings. The unwrap is safe because strs are UTF-8. + let key: Vec<&str> = Path::new(route).components().flat_map(|c| + match c { + Component::RootDir => None, + c => Some(c.as_os_str().to_str().unwrap()) + } + ).collect(); + + // Insert a match struct into the trie. + let match_length = key.len(); + self.inner.insert(key, Match { + handler: Box::new(handler) as Box, + length: match_length, + }); + self + } +} + +impl Handler for Mount { + fn handle(&self, req: &mut Request) -> IronResult { + // Find the matching handler. + let matched = { + // Extract the request path. + let path = req.url.path(); + + // If present, remove the trailing empty string (which represents a trailing slash). + // If it isn't removed the path will never match anything, because + // Path::str_components ignores trailing slashes and will never create routes + // ending in "". + let key = match path.last() { + Some(s) if s.is_empty() => &path[..path.len() - 1], + _ => &path + }; + + let key: Vec<_> = key.into_iter().map(|s| String::from(*s)).collect(); + + // Search the Trie for the nearest most specific match. + match self.inner.get_ancestor(&key) { + Some(matched) => matched, + None => return Err(IronError::new(NoMatch, StatusCode::NOT_FOUND)) + } + }; + + // We have a match, so fire off the child. + // If another mount middleware hasn't already, insert the unmodified url + // into the extensions as the "original url". + let is_outer_mount = !req.extensions.contains::(); + if is_outer_mount { + req.extensions.insert::(req.url.clone()); + } + + // Remove the prefix from the request's path before passing it to the mounted handler. + // If the prefix is entirely removed and no trailing slash was present, the new path + // will be the empty list. For the purposes of redirection, conveying that the path + // did not include a trailing slash is more important than providing a non-empty list. + let path = req.url.path()[matched.length..].join("/"); + req.url.as_mut().set_path(&path); + + let res = matched.handler.handle(req); + + // Reverse the URL munging, for future middleware. + req.url = match req.extensions.get::() { + Some(original) => original.clone(), + None => panic!("OriginalUrl unexpectedly removed from req.extensions.") + }; + + // If this mount middleware is the outermost mount middleware, + // remove the original url from the extensions map to prevent leakage. + if is_outer_mount { + req.extensions.remove::(); + } + + res + } +} + diff --git a/tests/packagedcode/data/package_summary/rust/persistent/Cargo.toml b/tests/packagedcode/data/package_summary/rust/persistent/Cargo.toml new file mode 100644 index 00000000000..50a8a2eefad --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/persistent/Cargo.toml @@ -0,0 +1,14 @@ +[package] + +name = "persistent" +authors = ["Jonathan Reem "] +version = "0.4.0" +description = "A set of middleware for sharing server-global data in Iron." +repository = "https://github.com/iron/persistent" +documentation = "https://docs.rs/persistent" +license = "MIT" +keywords = ["iron", "web", "persistence", "sharing", "global"] + +[dependencies] +iron = { path = "../iron", version = "0.6" } +plugin = "0.2" diff --git a/tests/packagedcode/data/package_summary/rust/persistent/README.md b/tests/packagedcode/data/package_summary/rust/persistent/README.md new file mode 100644 index 00000000000..b74bbc54502 --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/persistent/README.md @@ -0,0 +1,35 @@ +persistent [![Build Status](https://secure.travis-ci.org/iron/persistent.png?branch=master)](https://travis-ci.org/iron/persistent) +==== + +> Persistent storage as middleware for the [Iron](https://github.com/iron/iron) web framework. + +- Share persistent data across requests +- Read or modify locally stored data + +Use this if you are currently thinking about using `std::sync::Arc` to share +state between request handlers. + +## Installation + +If you're using a `Cargo.toml` to manage dependencies, just add persistent to the toml: + +```toml +[dependencies] +persistent = "x.y.z" # Insert current version here +``` + +Otherwise, `cargo build`, and the rlib will be in your `target` directory. + +## [Documentation](https://docs.rs/persistent) + +Along with the [online documentation](https://docs.rs/persistent), +you can build a local copy with `make doc`. + +## [Examples](/examples) + +## Get Help + +One of us ([@reem](https://github.com/reem/), [@zzmp](https://github.com/zzmp/), +[@theptrk](https://github.com/theptrk/), [@mcreinhard](https://github.com/mcreinhard)) +is usually on `#iron` on the mozilla irc. Come say hi and ask any questions you might have. +We are also usually on `#rust` and `#rust-webdev`. diff --git a/tests/packagedcode/data/package_summary/rust/persistent/src/lib.rs b/tests/packagedcode/data/package_summary/rust/persistent/src/lib.rs new file mode 100644 index 00000000000..8e3b2e6feea --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/persistent/src/lib.rs @@ -0,0 +1,267 @@ +#![cfg_attr(test, deny(warnings))] +#![deny(missing_docs)] + +//! A set of middleware for sharing data between requests in the Iron +//! framework. + +extern crate iron; +extern crate plugin; + +use iron::{Request, Response, BeforeMiddleware, AfterMiddleware, IronResult}; +use iron::typemap::Key; +use std::sync::{Arc, RwLock, Mutex}; +use std::fmt; +use std::error::Error; +use plugin::Plugin; + +/// The type that can be returned by `eval` to indicate error. +#[derive(Clone, Debug)] +pub enum PersistentError { + /// The value was not found. + NotFound +} + +impl Error for PersistentError { + fn description(&self) -> &str { + match *self { + PersistentError::NotFound => "Value not found in extensions." + } + } +} + +impl fmt::Display for PersistentError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + self.description().fmt(f) + } +} + +/// Helper trait for overloading the constructors of `Read`/`Write`/`State`. +/// This is an implementation detail, and should not be used for any other +/// purpose. +/// +/// For example, this trait lets you construct a `Read` from either a `T` or +/// an `Arc`. +pub trait PersistentInto { + /// Convert `self` into a value of type `T`. + fn persistent_into(self) -> T; +} + +impl PersistentInto for T { + fn persistent_into(self) -> T { self } +} + +impl PersistentInto> for T { + fn persistent_into(self) -> Arc { + Arc::new(self) + } +} + +impl PersistentInto>> for T { + fn persistent_into(self) -> Arc> { + Arc::new(Mutex::new(self)) + } +} + +impl PersistentInto>> for T { + fn persistent_into(self) -> Arc> { + Arc::new(RwLock::new(self)) + } +} + +/// Middleware for data that persists between requests with read and write capabilities. +/// +/// The data is stored behind a `RwLock`, so multiple read locks +/// can be taken out concurrently. +/// +/// If most threads need to take out a write lock, you may want to +/// consider `Write`, which stores the data behind a `Mutex`, which +/// has a faster locking speed. +/// +/// `State` can be linked as `BeforeMiddleware` to add data to the `Request` +/// extensions and it can be linked as an `AfterMiddleware` to add data to +/// the `Response` extensions. +/// +/// `State` also implements `Plugin`, so the data stored within can be +/// accessed through `request.get::>()` as an `Arc>`. +pub struct State { + data: Arc> +} + +/// Middleware for data that persists between Requests with read-only capabilities. +/// +/// The data is stored behind an Arc, so multiple threads can have +/// concurrent, non-blocking access. +/// +/// `Read` can be linked as `BeforeMiddleware` to add data to the `Request` +/// extensions and it can be linked as an `AfterMiddleware` to add data to +/// the `Response` extensions. +/// +/// `Read` also implements `Plugin`, so the data stored within can be +/// accessed through `request.get::>()` as an `Arc`. +pub struct Read { + data: Arc +} + +/// Middleware for data that persists between Requests for data which mostly +/// needs to be written instead of read. +/// +/// The data is stored behind a `Mutex`, so only one request at a time can +/// access the data. This is more performant than `State` in the case where +/// most uses of the data require a write lock. +/// +/// `Write` can be linked as `BeforeMiddleware` to add data to the `Request` +/// extensions and it can be linked as an `AfterMiddleware` to add data to +/// the `Response` extensions. +/// +/// `Write` also implements `Plugin`, so the data stored within can be +/// accessed through `request.get::>()` as an `Arc>`. +pub struct Write { + data: Arc> +} + +impl Clone for Read

where P::Value: Send + Sync { + fn clone(&self) -> Read

{ + Read { data: self.data.clone() } + } +} + +impl Clone for State

where P::Value: Send + Sync { + fn clone(&self) -> State

{ + State { data: self.data.clone() } + } +} + +impl Clone for Write

where P::Value: Send { + fn clone(&self) -> Write

{ + Write { data: self.data.clone() } + } +} + +impl Key for State

where P::Value: 'static { + type Value = Arc>; +} + +impl Key for Read

where P::Value: 'static { + type Value = Arc; +} + +impl Key for Write

where P::Value: 'static { + type Value = Arc>; +} + +impl Plugin for State

where P::Value: Send + Sync { + type Error = PersistentError; + fn eval(req: &mut Request) -> Result>, PersistentError> { + req.extensions.get::>().cloned().ok_or(PersistentError::NotFound) + } +} + +impl Plugin for Read

where P::Value: Send + Sync { + type Error = PersistentError; + fn eval(req: &mut Request) -> Result, PersistentError> { + req.extensions.get::>().cloned().ok_or(PersistentError::NotFound) + } +} + +impl Plugin for Write

where P::Value: Send { + type Error = PersistentError; + fn eval(req: &mut Request) -> Result>, PersistentError> { + req.extensions.get::>().cloned().ok_or(PersistentError::NotFound) + } +} + +impl BeforeMiddleware for State

where P::Value: Send + Sync { + fn before(&self, req: &mut Request) -> IronResult<()> { + req.extensions.insert::>(self.data.clone()); + Ok(()) + } +} + +impl BeforeMiddleware for Read

where P::Value: Send + Sync { + fn before(&self, req: &mut Request) -> IronResult<()> { + req.extensions.insert::>(self.data.clone()); + Ok(()) + } +} + +impl BeforeMiddleware for Write

where P::Value: Send { + fn before(&self, req: &mut Request) -> IronResult<()> { + req.extensions.insert::>(self.data.clone()); + Ok(()) + } +} + +impl AfterMiddleware for State

where P::Value: Send + Sync { + fn after(&self, _: &mut Request, mut res: Response) -> IronResult { + res.extensions.insert::>(self.data.clone()); + Ok(res) + } +} + +impl AfterMiddleware for Read

where P::Value: Send + Sync { + fn after(&self, _: &mut Request, mut res: Response) -> IronResult { + res.extensions.insert::>(self.data.clone()); + Ok(res) + } +} + +impl AfterMiddleware for Write

where P::Value: Send { + fn after(&self, _: &mut Request, mut res: Response) -> IronResult { + res.extensions.insert::>(self.data.clone()); + Ok(res) + } +} + +impl State

where P::Value: Send + Sync { + /// Construct a new pair of `State` that can be passed directly to `Chain::link`. + /// + /// The data is initialized with the passed-in value. + pub fn both(start: T) -> (State

, State

) where T: PersistentInto>> { + let x = State { data: start.persistent_into() }; + (x.clone(), x) + } + + /// Construct a new `State` that can be passed directly to + /// `Chain::link_before` or `Chain::link_after`. + /// + /// The data is initialized with the passed-in value. + pub fn one(start: T) -> State

where T: PersistentInto>> { + State { data: start.persistent_into() } + } +} + +impl Read

where P::Value: Send + Sync { + /// Construct a new pair of `Read` that can be passed directly to `Chain::link`. + /// + /// The data is initialized with the passed-in value. + pub fn both(start: T) -> (Read

, Read

) where T: PersistentInto> { + let x = Read { data: start.persistent_into() }; + (x.clone(), x) + } + + /// Construct a new `Read` that can be passed directly to + /// `Chain::link_before` or `Chain::link_after`. + /// + /// The data is initialized with the passed-in value. + pub fn one(start: T) -> Read

where T: PersistentInto> { + Read { data: start.persistent_into() } + } +} + +impl Write

where P::Value: Send { + /// Construct a new pair of `Write` that can be passed directly to `Chain::link`. + /// + /// The data is initialized with the passed-in value. + pub fn both(start: T) -> (Write

, Write

) where T: PersistentInto>> { + let x = Write { data: start.persistent_into() }; + (x.clone(), x) + } + + /// Construct a new `Write` that can be passed directly to + /// `Chain::link_before` or `Chain::link_after`. + /// + /// The data is initialized with the passed-in value. + pub fn one(start: T) -> Write

where T: PersistentInto>> { + Write { data: start.persistent_into() } + } +} diff --git a/tests/packagedcode/data/package_summary/rust/router/Cargo.toml b/tests/packagedcode/data/package_summary/rust/router/Cargo.toml new file mode 100644 index 00000000000..2bb106cae8b --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/router/Cargo.toml @@ -0,0 +1,15 @@ +[package] + +name = "router" +authors = ["Jonathan Reem "] +license = "MIT" +version = "0.6.0" +description = "A router for the Iron framework." +repository = "https://github.com/iron/router" +documentation = "https://docs.rs/router" +keywords = ["iron", "web", "http", "routing", "router"] + +[dependencies] +route-recognizer = "0.1" +iron = { path = "../iron", version = "0.6" } +url = "1.1" diff --git a/tests/packagedcode/data/package_summary/rust/router/README.md b/tests/packagedcode/data/package_summary/rust/router/README.md new file mode 100644 index 00000000000..b28f562c5fa --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/router/README.md @@ -0,0 +1,64 @@ +Router [![Build Status](https://secure.travis-ci.org/iron/router.png?branch=master)](https://travis-ci.org/iron/router) [![Crates.io Status](https://meritbadge.herokuapp.com/router)](https://crates.io/crates/router) +==== + +> Routing handler for the [Iron](https://github.com/iron/iron) web framework. + +Router is a fast, convenient, and flexible routing middleware for Iron. It +allows complex glob patterns and named url parameters and also allows handlers +to be any Handler, including all Chains. + +## Example + +```rust +extern crate iron; +extern crate router; + +use iron::prelude::*; +use iron::status; +use router::Router; + +fn main() { + let mut router = Router::new(); // Alternative syntax: + router.get("/", handler, "index"); // let router = router!(index: get "/" => handler, + router.get("/:query", handler, "query"); // query: get "/:query" => handler); + + Iron::new(router).http("localhost:3000").unwrap(); + + fn handler(req: &mut Request) -> IronResult { + let ref query = req.extensions.get::().unwrap().find("query").unwrap_or("/"); + Ok(Response::with((status::Ok, *query))) + } +} +``` + +## Overview + +Router is a part of Iron's [core bundle](https://github.com/iron/core). + +- Route client requests based on their paths +- Parse parameters and provide them to other middleware/handlers + +## Installation + +If you're using cargo, just add router to your `Cargo.toml`. + +```toml +[dependencies] + +router = "*" +``` + +Otherwise, `cargo build`, and the rlib will be in your `target` directory. + +## [Documentation](https://docs.rs/router) + +Along with the [online documentation](https://docs.rs/router), +you can build a local copy with `make doc`. + +## [Examples](/examples) + +## Get Help + +One of us is usually on `#iron` on the mozilla irc. +Come say hi and ask any questions you might have. +We are also usually on `#rust` and `#rust-webdev`. diff --git a/tests/packagedcode/data/package_summary/rust/router/src/router.rs b/tests/packagedcode/data/package_summary/rust/router/src/router.rs new file mode 100644 index 00000000000..3fb5736384f --- /dev/null +++ b/tests/packagedcode/data/package_summary/rust/router/src/router.rs @@ -0,0 +1,355 @@ +use std::collections::HashMap; +use std::error::Error; +use std::fmt; +use std::sync::Arc; + +use iron::{Request, Response, Handler, IronResult, IronError}; +use iron::{StatusCode, method, Method, headers}; +use iron::typemap::Key; +use iron::modifiers::Redirect; + +use recognizer::Router as Recognizer; +use recognizer::{Match, Params}; + + +pub struct RouterInner { + // The routers, specialized by method. + pub routers: HashMap>>, + // Routes that accept any method. + pub wildcard: Recognizer>, + // Used in URL generation. + pub route_ids: HashMap +} + +/// `Router` provides an interface for creating complex routes as middleware +/// for the Iron framework. +pub struct Router { + inner: Arc +} + +impl Router { + /// Construct a new, empty `Router`. + /// + /// ``` + /// # use router::Router; + /// let router = Router::new(); + /// ``` + pub fn new() -> Router { + Router { + inner: Arc::new(RouterInner { + routers: HashMap::new(), + wildcard: Recognizer::new(), + route_ids: HashMap::new() + }) + } + } + + fn mut_inner(&mut self) -> &mut RouterInner { + Arc::get_mut(&mut self.inner).expect("Cannot modify router at this point.") + } + + /// Add a new route to a `Router`, matching both a method and glob pattern. + /// + /// `route` supports glob patterns: `*` for a single wildcard segment and + /// `:param` for matching storing that segment of the request url in the `Params` + /// object, which is stored in the request `extensions`. + /// + /// For instance, to route `Get` requests on any route matching + /// `/users/:userid/:friend` and store `userid` and `friend` in + /// the exposed Params object: + /// + /// ```ignore + /// let mut router = Router::new(); + /// router.route(method::Get, "/users/:userid/:friendid", controller, "user_friend"); + /// ``` + /// + /// `route_id` is a unique name for your route, and is used when generating an URL with + /// `url_for`. + /// + /// The controller provided to route can be any `Handler`, which allows + /// extreme flexibility when handling routes. For instance, you could provide + /// a `Chain`, a `Handler`, which contains an authorization middleware and + /// a controller function, so that you can confirm that the request is + /// authorized for this route before handling it. + pub fn route, H: Handler, I: AsRef>(&mut self, method: method::Method, glob: S, handler: H, route_id: I) -> &mut Router { + self.mut_inner().routers + .entry(method) + .or_insert(Recognizer::new()) + .add(glob.as_ref(), Box::new(handler)); + self.route_id(route_id.as_ref(), glob.as_ref()); + self + } + + fn route_id(&mut self, id: &str, glob: &str) { + let inner = self.mut_inner(); + let ref mut route_ids = inner.route_ids; + + match route_ids.get(id) { + Some(other_glob) if glob != other_glob => panic!("Duplicate route_id: {}", id), + _ => () + }; + + route_ids.insert(id.to_owned(), glob.to_owned()); + } + + /// Like route, but specialized to the `Get` method. + pub fn get, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.route(Method::GET, glob, handler, route_id) + } + + /// Like route, but specialized to the `Post` method. + pub fn post, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.route(Method::POST, glob, handler, route_id) + } + + /// Like route, but specialized to the `Put` method. + pub fn put, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.route(Method::PUT, glob, handler, route_id) + } + + /// Like route, but specialized to the `Delete` method. + pub fn delete, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.route(Method::DELETE, glob, handler, route_id) + } + + /// Like route, but specialized to the `Head` method. + pub fn head, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.route(Method::HEAD, glob, handler, route_id) + } + + /// Like route, but specialized to the `Patch` method. + pub fn patch, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.route(Method::PATCH, glob, handler, route_id) + } + + /// Like route, but specialized to the `Options` method. + pub fn options, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.route(Method::OPTIONS, glob, handler, route_id) + } + + /// Route will match any method, including gibberish. + /// In case of ambiguity, handlers specific to methods will be preferred. + pub fn any, H: Handler, I: AsRef>(&mut self, glob: S, handler: H, route_id: I) -> &mut Router { + self.mut_inner().wildcard.add(glob.as_ref(), Box::new(handler)); + self.route_id(route_id.as_ref(), glob.as_ref()); + self + } + + fn recognize(&self, method: &method::Method, path: &str) + -> Option>> { + self.inner.routers.get(method).and_then(|router| router.recognize(path).ok()) + .or(self.inner.wildcard.recognize(path).ok()) + } + + fn handle_options(&self, path: &str) -> Response { + static METHODS: &'static [method::Method] = + &[Method::GET, Method::POST, Method::PUT, + Method::DELETE, Method::HEAD, Method::PATCH]; + + // Get all the available methods and return them. + let mut options = vec![]; + + for method in METHODS.iter() { + self.inner.routers.get(method).map(|router| { + if let Some(_) = router.recognize(path).ok() { + options.push(method.clone()); + } + }); + } + // If GET is there, HEAD is also there. + if options.contains(&Method::GET) && !options.contains(&Method::HEAD) { + options.push(Method::HEAD); + } + + let mut res = Response::with(StatusCode::OK); + for option in options { + res.headers.append(headers::ALLOW, option.as_str().parse().unwrap()); + } + res + } + + // Tests for a match by adding or removing a trailing slash. + fn redirect_slash(&self, req : &Request) -> Option { + let mut url = req.url.clone(); + let mut path = url.path().join("/"); + + if let Some(last_char) = path.chars().last() { + { + let mut path_segments = url.as_mut().path_segments_mut().unwrap(); + if last_char == '/' { + // We didn't recognize anything without a trailing slash; try again with one appended. + path.pop(); + path_segments.pop(); + } else { + // We didn't recognize anything with a trailing slash; try again without it. + path.push('/'); + path_segments.push(""); + } + } + } + + self.recognize(&req.method, &path).and( + Some(IronError::new(TrailingSlash, + (StatusCode::MOVED_PERMANENTLY, Redirect(url)))) + ) + } + + fn handle_method(&self, req: &mut Request, path: &str) -> Option> { + if let Some(matched) = self.recognize(&req.method, path) { + req.extensions.insert::(matched.params); + req.extensions.insert::(self.inner.clone()); + Some(matched.handler.handle(req)) + } else { self.redirect_slash(req).and_then(|redirect| Some(Err(redirect))) } + } +} + +impl Key for Router { type Value = Params; } + +impl Key for RouterInner { type Value = Arc; } + +impl Handler for Router { + fn handle(&self, req: &mut Request) -> IronResult { + let path = req.url.path().join("/"); + + self.handle_method(req, &path).unwrap_or_else(|| + match req.method { + Method::OPTIONS => Ok(self.handle_options(&path)), + // For HEAD, fall back to GET. Hyper ensures no response body is written. + Method::HEAD => { + req.method = Method::GET; + self.handle_method(req, &path).unwrap_or( + Err(IronError::new(NoRoute, StatusCode::NOT_FOUND)) + ) + } + _ => Err(IronError::new(NoRoute, StatusCode::NOT_FOUND)) + } + ) + } +} + +/// The error thrown by router if there is no matching route, +/// it is always accompanied by a NotFound response. +#[derive(Debug, PartialEq, Eq)] +pub struct NoRoute; + +impl fmt::Display for NoRoute { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("No matching route found.") + } +} + +impl Error for NoRoute { + fn description(&self) -> &str { "No Route" } +} + +/// The error thrown by router if a request was redirected +/// by adding or removing a trailing slash. +#[derive(Debug, PartialEq, Eq)] +pub struct TrailingSlash; + +impl fmt::Display for TrailingSlash { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("The request had a trailing slash.") + } +} + +impl Error for TrailingSlash { + fn description(&self) -> &str { "Trailing Slash" } +} + +#[cfg(test)] +mod test { + use super::Router; + use iron::{headers, method, Method, StatusCode, Request, Response}; + + #[test] + fn test_handle_options_post() { + let mut router = Router::new(); + router.post("/", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + let resp = router.handle_options("/"); + let headers : Vec = resp.headers.get_all(headers::ALLOW).into_iter().map(|s| s.to_str().unwrap().parse().unwrap()).collect(); + let expected = vec![Method::POST]; + assert_eq!(expected, headers); + } + + #[test] + fn test_handle_options_get_head() { + let mut router = Router::new(); + router.get("/", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + let resp = router.handle_options("/"); + let headers : Vec = resp.headers.get_all(headers::ALLOW).into_iter().map(|s| s.to_str().unwrap().parse().unwrap()).collect(); + let expected = vec![method::Method::GET, method::Method::HEAD]; + assert_eq!(expected, headers); + } + + #[test] + fn test_handle_any_ok() { + let mut router = Router::new(); + router.post("/post", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + router.any("/post", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + router.put("/post", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + router.any("/get", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, "any"); + + assert!(router.recognize(&Method::GET, "/post").is_some()); + assert!(router.recognize(&Method::GET, "/get").is_some()); + } + + #[test] + fn test_request() { + let mut router = Router::new(); + router.post("/post", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + router.get("/post", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + + assert!(router.recognize(&Method::POST, "/post").is_some()); + assert!(router.recognize(&Method::GET, "/post").is_some()); + assert!(router.recognize(&Method::PUT, "/post").is_none()); + assert!(router.recognize(&Method::GET, "/post/").is_none()); + } + + #[test] + fn test_not_found() { + let mut router = Router::new(); + router.put("/put", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, ""); + assert!(router.recognize(&Method::PATCH, "/patch").is_none()); + } + + #[test] + #[should_panic] + fn test_same_route_id() { + let mut router = Router::new(); + router.put("/put", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, "my_route_id"); + router.get("/get", |_: &mut Request| { + Ok(Response::with((StatusCode::OK, ""))) + }, "my_route_id"); + } + + #[test] + fn test_wildcard_regression() { + let mut router = Router::new(); + router.options("*", |_: &mut Request| Ok(Response::with((StatusCode::OK, ""))), "id1"); + router.put("/upload/*filename", |_: &mut Request| Ok(Response::with((StatusCode::OK, ""))), "id2"); + assert!(router.recognize(&Method::OPTIONS, "/foo").is_some()); + assert!(router.recognize(&Method::PUT, "/foo").is_none()); + assert!(router.recognize(&Method::PUT, "/upload/foo").is_some()); + } +} diff --git a/tests/packagedcode/test_package_summary.py b/tests/packagedcode/test_package_summary.py new file mode 100644 index 00000000000..9fc7b0450e9 --- /dev/null +++ b/tests/packagedcode/test_package_summary.py @@ -0,0 +1,58 @@ +import os +from packages_test_utils import PackageTester +from scancode.cli_test_utils import check_json_scan +from scancode.cli_test_utils import run_scan_click +from scancode_config import REGEN_TEST_FIXTURES + +class TestPackageSummary(PackageTester): + test_data_dir = os.path.join(os.path.dirname(__file__), 'data') + + def test_if_package_summary_plugin_working(self): + test_dir = self.get_test_loc('package_summary/plugin_package_summary') + result_file = self.get_temp_file('json') + expected_file = self.get_test_loc('package_summary/plugin_package_summary-expected.json') + + run_scan_click(['--package', '--classify', '--package-summary', test_dir, '--json', result_file]) + check_json_scan(expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES) + + def test_package_summary_for_python_whl(self): + test_dir = self.get_test_loc('package_summary/python_whl') + result_file = self.get_temp_file('json') + expected_file = self.get_test_loc('package_summary/python_whl-expected.json') + + run_scan_click(['--package','--license','--copyright', '--strip-root', '--processes', '-1', '--package-summary', '--summary' , '--classify', '--json-pp', result_file, test_dir]) + check_json_scan(expected_file, result_file, remove_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) + + def test_package_summary_for_npm(self): + test_dir = self.get_test_loc('package_summary/npm') + result_file = self.get_temp_file('json') + expected_file = self.get_test_loc('package_summary/npm-expected.json') + + run_scan_click(['--package','--license','--copyright', '--strip-root', '--processes', '-1', '--package-summary', '--summary' , '--classify', '--json-pp', result_file, test_dir]) + check_json_scan(expected_file, result_file, remove_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) + + def test_package_summary_for_rubygems(self): + test_dir = self.get_test_loc('package_summary/rubygems') + result_file = self.get_temp_file('json') + expected_file = self.get_test_loc('package_summary/rubygems-expected.json') + + run_scan_click(['--package','--license','--copyright', '--strip-root', '--processes', '-1', '--package-summary', '--summary' , '--classify', '--json-pp', result_file, test_dir]) + check_json_scan(expected_file, result_file, remove_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) + + def test_package_summary_for_rust(self): + test_dir = self.get_test_loc('package_summary/rust') + result_file = self.get_temp_file('json') + expected_file = self.get_test_loc('package_summary/rust-expected.json') + + run_scan_click(['--package','--license','--copyright', '--strip-root', '--processes', '-1', '--package-summary', '--summary' , '--classify', '--json-pp', result_file, test_dir]) + check_json_scan(expected_file, result_file, remove_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) + + # # Package Attribute tests + # def test_package_summary__does_summarize_npm_copyright(self): + # test_dir = self.get_test_loc('package_summary/npm_copyright') + # result_file = self.get_temp_file('json') + # expected_file = self.get_test_loc('package_summary/npm_copyrightexpected.json') + + # run_scan_click(['--package','--license','--copyright', '--strip-root', '--processes', '-1', '--package-summary', '--classify', '--json-pp', result_file, test_dir]) + # check_json_scan(expected_file, result_file, remove_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES) + \ No newline at end of file diff --git a/tests/packagedcode/test_plugin_package.py b/tests/packagedcode/test_plugin_package.py index 2594b4fbd64..b5912dcf50c 100644 --- a/tests/packagedcode/test_plugin_package.py +++ b/tests/packagedcode/test_plugin_package.py @@ -126,7 +126,7 @@ def test_package_command_scan_phpcomposer(self): expected_file = self.get_test_loc('plugin/phpcomposer-package-expected.json') run_scan_click(['--package', '--strip-root', '--processes', '-1', test_dir, '--json', result_file]) check_json_scan(expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES) - + @skipIf(on_windows, 'somehow this fails on Windows') def test_package_command_scan_python(self): test_dir = self.get_test_loc('recon/pypi') diff --git a/tests/scancode/data/help/help.txt b/tests/scancode/data/help/help.txt index 6def63b8893..9bcb3ebe8f7 100644 --- a/tests/scancode/data/help/help.txt +++ b/tests/scancode/data/help/help.txt @@ -114,6 +114,10 @@ Options: contain over 90% of source files as children and descendants. Count the number of source files in a directory as a new source_file_counts attribute + --package-summary Summarize scans by providing License Clarity Score + and populating other license/copyright attributes for + package instances from their key files and other + files. --summary Summarize scans by providing declared origin information and other detected origin info at the codebase attribute level.