We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23d6724 commit d6403f1Copy full SHA for d6403f1
4 files changed
scanpipe/models.py
@@ -2585,7 +2585,7 @@ def compute_compliance_alert(self):
2585
return ""
2586
2587
licensing = get_licensing()
2588
- parsed_symbols = licensing.parse(license_expression, simple=True).symbols
+ parsed_symbols = licensing.license_symbols(license_expression, simple=True)
2589
2590
alerts = [
2591
self.get_alert_for_symbol(policy_index, symbol) for symbol in parsed_symbols
scanpipe/tests/__init__.py
@@ -333,6 +333,14 @@ def make_mock_response(url, content=b"\x00", status_code=200, headers=None):
333
"label": "Prohibited License",
334
"compliance_alert": "error",
335
},
336
+ {
337
+ "license_key": "gpl-2.0-plus",
338
+ "compliance_alert": "warning",
339
+ },
340
341
+ "license_key": "font-exception-gpl",
342
343
344
{
345
"license_key": "OFL-1.1",
346
"compliance_alert": "warning",
@@ -368,6 +376,14 @@ def make_mock_response(url, content=b"\x00", status_code=200, headers=None):
368
376
369
377
370
378
379
+ "gpl-2.0-plus": {
380
381
382
383
+ "font-exception-gpl": {
384
385
386
371
387
"OFL-1.1": {
372
388
373
389
scanpipe/tests/data/policies/policies.yml
@@ -12,6 +12,13 @@ license_policies:
12
label: Prohibited License
13
compliance_alert: error
14
15
+ - license_key: gpl-2.0-plus
16
+ compliance_alert: warning
17
+
18
+ # AboutCode license execption key
19
+ - license_key: font-exception-gpl
20
21
22
# SPDX license keys
23
- license_key: OFL-1.1
24
compliance_alert: warning
scanpipe/tests/test_models.py
@@ -1601,6 +1601,14 @@ def test_scanpipe_codebase_resource_model_compliance_alert_update_fields(self):
1601
# Reset the index value
1602
scanpipe_app.license_policies_index = None
1603
1604
+ def test_scanpipe_can_compute_compliance_alert_for_license_exceptions(self):
1605
+ scanpipe_app.license_policies_index = license_policies_index
1606
+ resource = CodebaseResource.objects.create(project=self.project1, path="file")
1607
+ license_expression = "gpl-2.0-plus WITH font-exception-gpl"
1608
+ resource.update(detected_license_expression=license_expression)
1609
+ resource.compute_compliance_alert()
1610
+ self.assertEqual("warning", resource.compliance_alert)
1611
1612
def test_scanpipe_scan_fields_model_mixin_methods(self):
1613
expected = [
1614
"detected_license_expression",
0 commit comments