Skip to content

Commit 623fe6c

Browse files
Fix test failures
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent 6d93bba commit 623fe6c

23 files changed

+154
-28
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
license_expression: cclrc
3+
is_license_notice: yes
4+
referenced_filenames:
5+
- External_License/CCLRC_CDAT_License.txt
6+
---
7+
8+
* This software may be distributed under the terms of the
9+
* {{CCLRC Licence}} for CCLRC Software
10+
* <CDATDIR>/External_License/CCLRC_CDAT_License.txt
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
license_expression: cclrc
3+
is_license_notice: yes
4+
---
5+
6+
* This software may be distributed under the terms of the
7+
* {{CCLRC Licence}} for CCLRC Software

src/licensedcode/data/rules/mit_1182.RULE

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
license_expression: mit
33
is_license_reference: yes
4+
is_required_phrase: yes
45
relevance: 100
56
---
67

src/licensedcode/data/rules/mit_334.RULE

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ referenced_filenames:
66
- LICENSE
77
---
88

9-
This software is released under the MIT software license.
9+
This software is released under the {{MIT software license}}.
1010
This license, including disclaimer, is available in the 'LICENSE' file.

src/licensedcode/data/rules/mit_337.RULE

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ ignorable_urls:
66
- http://www.opensource.org/licenses/mit-license.php
77
---
88

9-
This is the http://www.opensource.org/licenses/mit-license.php MIT Software License
9+
This is the http://www.opensource.org/licenses/mit-license.php {{MIT Software License}}
1010
which is OSI-certified, and GPL-compatible.

src/licensedcode/data/rules/mit_392.RULE

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ ignorable_urls:
88
- http://www.opensource.org/licenses/mit-license.php
99
---
1010

11-
"Distributed under the MIT software license, see the accompanying file COPYING or
11+
"Distributed under the {{MIT software license}}, see the accompanying file COPYING or
1212
http://www.opensource.org/licenses/mit-license.php.

src/licensedcode/data/rules/mit_396.RULE

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ referenced_filenames:
66
- COPYING
77
---
88

9-
// Distributed under the MIT software license, see the accompanying
9+
// Distributed under the {{MIT software license}}, see the accompanying
1010
// file COPYING

src/licensedcode/data/rules/mit_397.RULE

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ ignorable_urls:
88
- http://www.opensource.org/licenses/mit-license.php
99
---
1010

11-
// Distributed under the MIT software license, see the accompanying
12-
// file COPYING or shttp://www.opensource.org/{{licenses/mit}}-license.php.
11+
// Distributed under the {{MIT software license}}, see the accompanying
12+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

src/licensedcode/models.py

-4
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,6 @@ def validate(self, licensing=None, thorough=False):
18441844
is_false_positive = self.is_false_positive
18451845

18461846
has_license_flags = any(self.license_flag_values)
1847-
has_no_license_flags = len([l for l in self.license_flag_values if l]) == 0
18481847
has_many_license_flags = len([l for l in self.license_flag_values if l]) > 1
18491848

18501849
license_expression = self.license_expression
@@ -1888,9 +1887,6 @@ def validate(self, licensing=None, thorough=False):
18881887

18891888
if not (0 <= self.relevance <= 100):
18901889
yield 'Invalid rule relevance. Should be between 0 and 100.'
1891-
1892-
if has_no_license_flags:
1893-
yield 'Invalid rule no is_license_* flags present.'
18941890

18951891
if has_many_license_flags:
18961892
yield 'Invalid rule is_license_* flags. Only one allowed.'

src/licensedcode/required_phrases.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ def get_required_phrase_spans(text):
5252
>>> x = get_required_phrase_spans(text)
5353
>>> assert x == [Span(4, 6)], x
5454
55-
>>> text = 'This is enclosed in {{double curly braces}}'
56-
>>> # 0 1 2 3 4 5 6
57-
>>> x = get_required_phrase_spans(text)
58-
>>> assert x == ['double', 'curly', 'braces'], x
59-
6055
>>> text = 'This is {{enclosed}} a {{double curly braces}} or not'
6156
>>> # 0 1 2 SW 3 4 5 6 7
6257
>>> x = get_required_phrase_spans(text)
@@ -114,7 +109,7 @@ def get_required_phrase_texts(text):
114109
>>> text = 'This is enclosed in {{double curly braces}}'
115110
>>> # 0 1 2 3 4 5 6
116111
>>> x = get_required_phrase_texts(text=text)
117-
>>> assert x == ['double', 'curly', 'braces'], x
112+
>>> assert x == ['double curly braces'], x
118113
"""
119114
return [
120115
required_phrase.text

tests/formattedcode/data/common/manifests-expected.yaml

+27-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ headers:
2929
system_environment:
3030
operating_system: linux
3131
cpu_architecture: 64
32-
platform: Linux-5.15.0-116-generic-x86_64-with-glibc2.35
33-
platform_version: '#126-Ubuntu SMP Mon Jul 1 10:14:24 UTC 2024'
34-
python_version: 3.10.12 (main, Mar 22 2024, 16:50:05) [GCC 11.4.0]
32+
platform: Linux-5.15.0-119-generic-x86_64-with-glibc2.35
33+
platform_version: '#129-Ubuntu SMP Fri Aug 2 19:25:20 UTC 2024'
34+
python_version: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]
3535
spdx_license_list_version: '3.24'
3636
files_count: 4
3737
summary:
@@ -1601,6 +1601,8 @@ license_rule_references:
16011601
is_license_tag: yes
16021602
is_license_intro: no
16031603
is_license_clue: no
1604+
is_required_phrase: no
1605+
skip_collecting_required_phrases: no
16041606
is_continuous: no
16051607
is_builtin: yes
16061608
is_from_license: no
@@ -1626,6 +1628,8 @@ license_rule_references:
16261628
is_license_tag: no
16271629
is_license_intro: no
16281630
is_license_clue: no
1631+
is_required_phrase: no
1632+
skip_collecting_required_phrases: no
16291633
is_continuous: no
16301634
is_builtin: yes
16311635
is_from_license: no
@@ -1651,6 +1655,8 @@ license_rule_references:
16511655
is_license_tag: yes
16521656
is_license_intro: no
16531657
is_license_clue: no
1658+
is_required_phrase: no
1659+
skip_collecting_required_phrases: no
16541660
is_continuous: no
16551661
is_builtin: yes
16561662
is_from_license: no
@@ -1677,6 +1683,8 @@ license_rule_references:
16771683
is_license_tag: no
16781684
is_license_intro: no
16791685
is_license_clue: no
1686+
is_required_phrase: no
1687+
skip_collecting_required_phrases: no
16801688
is_continuous: no
16811689
is_builtin: yes
16821690
is_from_license: no
@@ -1703,6 +1711,8 @@ license_rule_references:
17031711
is_license_tag: yes
17041712
is_license_intro: no
17051713
is_license_clue: no
1714+
is_required_phrase: no
1715+
skip_collecting_required_phrases: no
17061716
is_continuous: no
17071717
is_builtin: yes
17081718
is_from_license: no
@@ -1728,6 +1738,8 @@ license_rule_references:
17281738
is_license_tag: no
17291739
is_license_intro: no
17301740
is_license_clue: no
1741+
is_required_phrase: no
1742+
skip_collecting_required_phrases: no
17311743
is_continuous: no
17321744
is_builtin: yes
17331745
is_from_license: no
@@ -1765,6 +1777,8 @@ license_rule_references:
17651777
is_license_tag: no
17661778
is_license_intro: no
17671779
is_license_clue: no
1780+
is_required_phrase: no
1781+
skip_collecting_required_phrases: no
17681782
is_continuous: no
17691783
is_builtin: yes
17701784
is_from_license: no
@@ -1790,6 +1804,8 @@ license_rule_references:
17901804
is_license_tag: no
17911805
is_license_intro: yes
17921806
is_license_clue: no
1807+
is_required_phrase: no
1808+
skip_collecting_required_phrases: no
17931809
is_continuous: no
17941810
is_builtin: yes
17951811
is_from_license: no
@@ -1818,6 +1834,8 @@ license_rule_references:
18181834
is_license_tag: yes
18191835
is_license_intro: no
18201836
is_license_clue: no
1837+
is_required_phrase: yes
1838+
skip_collecting_required_phrases: no
18211839
is_continuous: no
18221840
is_builtin: yes
18231841
is_from_license: no
@@ -1843,6 +1861,8 @@ license_rule_references:
18431861
is_license_tag: yes
18441862
is_license_intro: no
18451863
is_license_clue: no
1864+
is_required_phrase: no
1865+
skip_collecting_required_phrases: no
18461866
is_continuous: no
18471867
is_builtin: yes
18481868
is_from_license: no
@@ -1868,6 +1888,8 @@ license_rule_references:
18681888
is_license_tag: yes
18691889
is_license_intro: no
18701890
is_license_clue: no
1891+
is_required_phrase: no
1892+
skip_collecting_required_phrases: no
18711893
is_continuous: no
18721894
is_builtin: yes
18731895
is_from_license: no
@@ -1893,6 +1915,8 @@ license_rule_references:
18931915
is_license_tag: no
18941916
is_license_intro: no
18951917
is_license_clue: no
1918+
is_required_phrase: no
1919+
skip_collecting_required_phrases: no
18961920
is_continuous: no
18971921
is_builtin: yes
18981922
is_from_license: no

tests/formattedcode/data/yaml/package-and-licenses-expected.yaml

+17-5
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ headers:
2121
for any legal advice.
2222
ScanCode is a free software code scanning tool from nexB Inc. and others.
2323
Visit https://github.com/nexB/scancode-toolkit/ for support and download.
24-
output_format_version: 3.1.0
24+
output_format_version: 3.2.0
2525
message:
2626
errors: []
2727
warnings: []
2828
extra_data:
2929
system_environment:
3030
operating_system: linux
3131
cpu_architecture: 64
32-
platform: Linux-5.15.0-112-generic-x86_64-with-glibc2.35
33-
platform_version: '#122-Ubuntu SMP Thu May 23 07:48:21 UTC 2024'
34-
python_version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
35-
spdx_license_list_version: '3.23'
32+
platform: Linux-5.15.0-119-generic-x86_64-with-glibc2.35
33+
platform_version: '#129-Ubuntu SMP Fri Aug 2 19:25:20 UTC 2024'
34+
python_version: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]
35+
spdx_license_list_version: '3.24'
3636
files_count: 4
3737
summary:
3838
declared_license_expression: apache-2.0
@@ -626,6 +626,8 @@ license_rule_references:
626626
is_license_tag: no
627627
is_license_intro: no
628628
is_license_clue: no
629+
is_required_phrase: no
630+
skip_collecting_required_phrases: no
629631
is_continuous: no
630632
is_builtin: yes
631633
is_from_license: yes
@@ -854,6 +856,8 @@ license_rule_references:
854856
is_license_tag: yes
855857
is_license_intro: no
856858
is_license_clue: no
859+
is_required_phrase: no
860+
skip_collecting_required_phrases: no
857861
is_continuous: no
858862
is_builtin: yes
859863
is_from_license: no
@@ -879,6 +883,8 @@ license_rule_references:
879883
is_license_tag: no
880884
is_license_intro: no
881885
is_license_clue: no
886+
is_required_phrase: no
887+
skip_collecting_required_phrases: no
882888
is_continuous: no
883889
is_builtin: yes
884890
is_from_license: no
@@ -904,6 +910,8 @@ license_rule_references:
904910
is_license_tag: no
905911
is_license_intro: no
906912
is_license_clue: no
913+
is_required_phrase: no
914+
skip_collecting_required_phrases: no
907915
is_continuous: yes
908916
is_builtin: yes
909917
is_from_license: no
@@ -929,6 +937,8 @@ license_rule_references:
929937
is_license_tag: no
930938
is_license_intro: no
931939
is_license_clue: no
940+
is_required_phrase: no
941+
skip_collecting_required_phrases: no
932942
is_continuous: no
933943
is_builtin: yes
934944
is_from_license: yes
@@ -972,6 +982,8 @@ license_rule_references:
972982
is_license_tag: no
973983
is_license_intro: no
974984
is_license_clue: no
985+
is_required_phrase: no
986+
skip_collecting_required_phrases: no
975987
is_continuous: no
976988
is_builtin: yes
977989
is_from_license: no

tests/licensedcode/data/additional_licenses/additional_license_combined_test.expected.json

+10
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@
270270
"is_license_tag": true,
271271
"is_license_intro": false,
272272
"is_license_clue": false,
273+
"is_required_phrase": false,
274+
"skip_collecting_required_phrases": false,
273275
"is_continuous": false,
274276
"is_builtin": true,
275277
"is_from_license": false,
@@ -297,6 +299,8 @@
297299
"is_license_tag": false,
298300
"is_license_intro": false,
299301
"is_license_clue": false,
302+
"is_required_phrase": false,
303+
"skip_collecting_required_phrases": false,
300304
"is_continuous": false,
301305
"is_builtin": false,
302306
"is_from_license": true,
@@ -324,6 +328,8 @@
324328
"is_license_tag": false,
325329
"is_license_intro": false,
326330
"is_license_clue": false,
331+
"is_required_phrase": false,
332+
"skip_collecting_required_phrases": false,
327333
"is_continuous": false,
328334
"is_builtin": false,
329335
"is_from_license": true,
@@ -351,6 +357,8 @@
351357
"is_license_tag": false,
352358
"is_license_intro": false,
353359
"is_license_clue": false,
360+
"is_required_phrase": false,
361+
"skip_collecting_required_phrases": false,
354362
"is_continuous": false,
355363
"is_builtin": false,
356364
"is_from_license": true,
@@ -378,6 +386,8 @@
378386
"is_license_tag": false,
379387
"is_license_intro": false,
380388
"is_license_clue": false,
389+
"is_required_phrase": false,
390+
"skip_collecting_required_phrases": false,
381391
"is_continuous": false,
382392
"is_builtin": false,
383393
"is_from_license": true,

tests/licensedcode/data/additional_licenses/additional_license_directory_test.expected.json

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@
117117
"is_license_tag": false,
118118
"is_license_intro": false,
119119
"is_license_clue": false,
120+
"is_required_phrase": false,
121+
"skip_collecting_required_phrases": false,
120122
"is_continuous": false,
121123
"is_builtin": false,
122124
"is_from_license": true,
@@ -144,6 +146,8 @@
144146
"is_license_tag": false,
145147
"is_license_intro": false,
146148
"is_license_clue": false,
149+
"is_required_phrase": false,
150+
"skip_collecting_required_phrases": false,
147151
"is_continuous": false,
148152
"is_builtin": false,
149153
"is_from_license": true,

tests/licensedcode/data/additional_licenses/additional_license_plugin_test.expected.json

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
"is_license_tag": false,
7171
"is_license_intro": false,
7272
"is_license_clue": false,
73+
"is_required_phrase": false,
74+
"skip_collecting_required_phrases": false,
7375
"is_continuous": false,
7476
"is_builtin": false,
7577
"is_from_license": true,
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
license_expressions:
2-
- mit
2+
- cclrc

0 commit comments

Comments
 (0)