Skip to content

Commit a5116ff

Browse files
Update required phrases, rules and fix minor issues
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent e0a8c42 commit a5116ff

10 files changed

+63
-35
lines changed

src/licensedcode/data/rules/bsd-new_1426.RULE

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
license_expression: bsd-new
33
is_license_text: yes
44
is_continuous: yes
5-
skip_for_required_phrase_generation: yes
5+
minimum_coverage: 100
66
---
77

8-
{{
98
License: BSD-3-clause
109
Redistribution and use in source and binary forms, with or without
1110
modification, are permitted provided that the following conditions
@@ -30,4 +29,3 @@ License: BSD-3-clause
3029
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3130
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3231
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33-
}}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
license_expression: gfdl-1.3-invariants-only
33
is_license_reference: yes
4-
is_continuous: yes
4+
is_required_phrase: yes
55
relevance: 95
66
---
77

8-
{{with the Invariant Sections being }}
8+
with the Invariant Sections being
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
license_expression: gfdl-1.3-invariants-only
33
is_license_reference: yes
4-
is_continuous: yes
4+
is_required_phrase: yes
55
relevance: 95
66
---
77

8-
{{the Invariant Sections being }}
8+
the Invariant Sections being

src/licensedcode/data/rules/gfdl-1.3-invariants-only_30.RULE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ is_license_notice: yes
55

66
Permission is granted to copy, distribute
77
and/or modify this document under the terms of the {{GNU Free Documentation
8-
License, Version 1.3;}} {{with the Invariant Sections being}} LIST THEIR TITLES ,
8+
License, Version 1.3; with the Invariant Sections being}} LIST THEIR TITLES ,
99
{{with the Front-Cover Texts being}} LIST , and {{with the Back-Cover Texts being}}
1010
LIST . A copy of the license is included in the section entitled "GNU Free
1111
Documentation License".

src/licensedcode/data/rules/mpl-1.1_or_gpl-2.0-plus_or_lgpl-2.1-plus_16.RULE

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,20 @@ ignorable_urls:
1010
---
1111

1212

13-
<licenses><license><name>MPL</name><url>http://www.mozilla.org/MPL/2.0/index.txt</url><distribution>repo</distribution></license><license><name>LGPL</name><url>http://www.gnu.org/licenses/lgpl-2.1.txt</url><distribution>repo</distribution></license><license><name>GPL</name><url>http://www.gnu.org/licenses/gpl-2.0.txt</url><distribution>repo</distribution></license></licenses>
13+
<licenses>
14+
{{<license>
15+
<name>MPL}}</name>
16+
<url>{{http://www.mozilla.org/MPL/2.0/index.txt}}</url>
17+
<distribution>repo</distribution>
18+
</license>
19+
{{<license>
20+
<name>LGPL}}</name>
21+
<url>{{http://www.gnu.org/licenses/lgpl-2.1.txt}}</url>
22+
<distribution>repo</distribution>
23+
</license>
24+
{{<license>
25+
<name>GPL}}</name>
26+
<url>{{http://www.gnu.org/licenses/gpl-2.0.txt}}</url>
27+
<distribution>repo</distribution>
28+
</license>
29+
</licenses>

src/licensedcode/data/rules/mpl-1.1_or_gpl-2.0-plus_or_lgpl-2.1-plus_30.RULE

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,20 @@ ignorable_urls:
1010
---
1111

1212

13-
<licenses><license><name>MPL</name><url>http://www.mozilla.org/MPL/2.0/index.txt</url><distribution>repo</distribution></license><license><name>LGPL</name><url>https://www.gnu.org/licenses/lgpl-2.1.txt</url><distribution>repo</distribution></license><license><name>GPL</name><url>https://www.gnu.org/licenses/gpl-2.0.txt</url><distribution>repo</distribution></license></licenses>
13+
<licenses>
14+
{{<license>
15+
<name>MPL}}</name>
16+
<url>{{http://www.mozilla.org/MPL/2.0/index.txt}}</url>
17+
<distribution>repo</distribution>
18+
</license>
19+
{{<license>
20+
<name>LGPL}}</name>
21+
<url>{{https://www.gnu.org/licenses/lgpl-2.1.txt}}</url>
22+
<distribution>repo</distribution>
23+
</license>
24+
{{<license>
25+
<name>GPL}}</name>
26+
<url>{{https://www.gnu.org/licenses/gpl-2.0.txt}}</url>
27+
<distribution>repo</distribution>
28+
</license>
29+
</licenses>

src/licensedcode/data/rules/mpl-1.1_or_gpl-3.0_or_lgpl-3.0_1.RULE

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ is_required_phrase: yes
55
ignorable_urls:
66
- http://www.gnu.org/licenses/gpl.txt
77
- http://www.gnu.org/licenses/lgpl.txt
8-
- https://www.mozilla.org/en-US/MPL/1.1/
8+
- https://www.mozilla.org/en-US/MPL/1.1
99
---
1010

1111

1212
<licenses>
1313
<license>
14-
<name>Mozilla Public License Version 1.1</name>
15-
<url>https://www.mozilla.org/en-US/MPL/1.1/</url>
14+
<name>{{Mozilla Public License Version 1.1}}</name>
15+
<url>{{https://www.mozilla.org/en-US/MPL/1.1/}}</url>
1616
</license>
1717
<license>
18-
<name>GENERAL PUBLIC LICENSE, version 3 (GPL-3.0)</name>
19-
<url>http://www.gnu.org/licenses/gpl.txt</url>
18+
<name>{{GENERAL PUBLIC LICENSE, version 3 (GPL-3.0)}}</name>
19+
<url>{{http://www.gnu.org/licenses/gpl.txt}}</url>
2020
</license>
2121
<license>
22-
<name>GNU LESSER GENERAL PUBLIC LICENSE, version 3 (LGPL-3.0)</name>
23-
<url>http://www.gnu.org/licenses/lgpl.txt</url>
22+
<name>{{GNU LESSER GENERAL PUBLIC LICENSE, version 3 (LGPL-3.0)}}</name>
23+
<url>{{http://www.gnu.org/licenses/lgpl.txt}}</url>
2424
</license>
2525
</licenses>

src/licensedcode/index.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,20 +1003,20 @@ def match_query(
10031003

10041004
matchers = [
10051005
# matcher, include_low in post-matching remaining matchable check
1006-
Matcher(function=get_spdx_id_matches, include_low=True, name='spdx_lid', keep_trucking=True),
1007-
Matcher(function=self.get_exact_matches, include_low=False, name='aho', keep_trucking=False),
1006+
Matcher(function=get_spdx_id_matches, include_low=True, name='spdx_lid', continue_matching=True),
1007+
Matcher(function=self.get_exact_matches, include_low=False, name='aho', continue_matching=False),
10081008
]
10091009

10101010
if approximate:
1011-
matchers += [Matcher(function=approx, include_low=False, name='seq', keep_trucking=False), ]
1011+
matchers += [Matcher(function=approx, include_low=False, name='seq', continue_matching=False), ]
10121012

10131013
already_matched_qspans = []
1014-
for mtcher in matchers:
1014+
for matcher in matchers:
10151015
if TRACE:
10161016
logger_debug()
1017-
logger_debug(f'match_query: matching with matcher: {mtcher.name}')
1017+
logger_debug(f'match_query: matching with matcher: {matcher.name}')
10181018

1019-
matched = mtcher.function(
1019+
matched = matcher.function(
10201020
qry,
10211021
matched_qspans=already_matched_qspans,
10221022
existing_matches=matches,
@@ -1026,7 +1026,7 @@ def match_query(
10261026
if TRACE:
10271027
self.debug_matches(
10281028
matches=matched,
1029-
message=f'matched with: {mtcher.name}',
1029+
message=f'matched with: {matcher.name}',
10301030
location=qry.location,
10311031
query_string=qry.query_string,
10321032
)
@@ -1050,14 +1050,14 @@ def match_query(
10501050
already_matched_qspans.extend(
10511051
mtch.qspan for mtch in matched if mtch.coverage() == 100)
10521052

1053-
if not mtcher.keep_trucking:
1053+
if not matcher.continue_matching:
10541054

10551055
if not whole_query_run.is_matchable(
1056-
include_low=mtcher.include_low,
1056+
include_low=matcher.include_low,
10571057
qspans=already_matched_qspans,
10581058
):
10591059
if TRACE:
1060-
logger_debug(' match_query: no more matchable ... stop matching after matcher:', mtcher.name)
1060+
logger_debug(' match_query: no more matchable ... stop matching after matcher:', matcher.name)
10611061
break
10621062

10631063
# break if deadline has passed
@@ -1205,7 +1205,7 @@ class Matcher(NamedTuple):
12051205
# whether to inlude low tokens when checking if there are matchable left
12061206
include_low: bool
12071207
# True if matching should continue after this matcher
1208-
keep_trucking: bool = True
1208+
continue_matching: bool = True
12091209

12101210

12111211
def get_weak_rids(len_legalese, tids_by_rid, _idx):

src/licensedcode/plugin_license.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,6 @@ def process_codebase(self, codebase, license_text=False, license_diagnostics=Fal
220220
f'after : {license_expressions_after}'
221221
)
222222

223-
# raise Exception()
224-
225223
license_detections = collect_license_detections(
226224
codebase=codebase,
227225
include_license_clues=False

src/packagedcode/alpine.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,11 +1376,11 @@ class ApkLicenseDetection:
13761376

13771377
def to_dict(self):
13781378
return dict(
1379-
declared_license=self.declared_license ,
1380-
cleaned_license=self.cleaned_license ,
1381-
mapped_license=self.mapped_license ,
1382-
license_detections=self.license_detections ,
1383-
license_expression=self.license_expression ,
1379+
declared_license=self.declared_license,
1380+
cleaned_license=self.cleaned_license,
1381+
mapped_license=self.mapped_license,
1382+
license_detections=self.license_detections,
1383+
license_expression=self.license_expression,
13841384
)
13851385

13861386

0 commit comments

Comments
 (0)