Skip to content

Commit

Permalink
Rename Rule.skip_collecting_required_phrases
Browse files Browse the repository at this point in the history
Renamed to skip_for_required_phrase_generation.
This skips a tagged rule for is_required_phrase rule gen and for
required_phrase rule text update with is_required_phrase rules.

Signed-off-by: Philippe Ombredanne <[email protected]>
  • Loading branch information
pombredanne committed Oct 8, 2024
1 parent 9cee2cb commit 8e16712
Show file tree
Hide file tree
Showing 26 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion etc/scripts/licenses/report_license_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"is_license_intro",
"is_license_clue",
"is_required_phrase",
"skip_collecting_required_phrases",
"skip_for_required_phrase_generation",
"is_deprecated",
"has_unknown",
"only_known_words",
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/apache-2.0_1103.RULE
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ignorable_authors:
- Giuseppe Scrivano
ignorable_urls:
- https://github.com/opencontainers/runc/issues/2144#issuecomment-543116397
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

// Although ebpf.c is {{originally licensed under LGPL-3.0-or-later}}, the author (Giuseppe Scrivano)
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/bsd-new_1110.RULE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license_expression: bsd-new
is_license_text: yes
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

{{Source Code License
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/bsd-new_1112.RULE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license_expression: bsd-new
is_license_text: yes
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

Software {{License
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/bsd-new_1284.RULE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license_expression: bsd-new
is_license_reference: yes
is_required_phrases: yes
is_required_phrase: yes
ignorable_urls:
- https://go.dev/LICENSE
---
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/bsd-new_1372.RULE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
license_expression: bsd-new
is_license_text: yes
minimum_coverage: 90
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

{{Simplified BSD License }}
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/bsd-new_185.RULE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license_expression: bsd-new
is_license_notice: yes
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
relevance: 100
referenced_filenames:
- COPYING
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/bsd-new_413.RULE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license_expression: bsd-new
is_license_text: yes
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
minimum_coverage: 90
---

Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/bsd-new_687.RULE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ license_expression: bsd-new
is_license_text: yes
relevance: 100
minimum_coverage: 80
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

{{license
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/gpl-1.0-plus_565.RULE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ is_license_reference: yes
is_continuous: yes
relevance: 100
notes: Seen in ebpf in github.com/cilium/ebpf/ and may be accessing GPL-only kernel symbols
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

{{ License: internal.NewStringPointer("GPL")}}
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/gpl-2.0-plus_1129.RULE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license_expression: gpl-2.0-plus
is_license_notice: yes
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

Some of the code in this project {{was originally LGPL v2.1 (or later)
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/lgpl-2.1-plus_499.RULE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
license_expression: lgpl-2.1-plus
is_license_notice: yes
relevance: 99
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
---

NOTE: Only {{certain parts}} of the ScummVM project are {{under the GNU LGPL.}}
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/mit_1312.RULE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
license_expression: mit
is_license_notice: yes
relevance: 100
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
referenced_filenames:
- LICENSE.RFL
---
Expand Down
2 changes: 1 addition & 1 deletion src/licensedcode/data/rules/mpl-1.0_15.RULE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license_expression: mpl-1.0
is_license_reference: yes
skip_collecting_required_phrases: yes
skip_for_required_phrase_generation: yes
relevance: 99
notes: this could be MPL 1.1 or 2.0. The 1.0 and up allow upgrade to newer versions So 1.0 this
is always correct
Expand Down
10 changes: 5 additions & 5 deletions src/licensedcode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ class BasicRule:
'will be a false positive and misleading.')
)

skip_collecting_required_phrases = attr.ib(
skip_for_required_phrase_generation = attr.ib(
default=False,
repr=False,
metadata=dict(
Expand Down Expand Up @@ -1945,7 +1945,7 @@ def validate(self, licensing=None, thorough=False):
if (self.is_license_clue or self.is_license_intro) and self.is_required_phrase:
yield 'License intro/clue rules cannot be required phrase rules'

if self.is_required_phrase and self.skip_collecting_required_phrases:
if self.is_required_phrase and self.skip_for_required_phrase_generation:
yield 'We can skip collecting required phrases only in non required phrase rules'

if not all(check_is_list_of_strings(i) for i in ignorables):
Expand Down Expand Up @@ -2080,7 +2080,7 @@ def to_reference(self):
data['is_license_intro'] = self.is_license_intro
data['is_license_clue'] = self.is_license_clue
data['is_required_phrase'] = self.is_required_phrase
data['skip_collecting_required_phrases'] = self.skip_collecting_required_phrases
data['skip_for_required_phrase_generation'] = self.skip_for_required_phrase_generation
data['is_continuous'] = self.is_continuous
data['is_builtin'] = self.is_builtin
data['is_from_license'] = self.is_from_license
Expand Down Expand Up @@ -2114,7 +2114,7 @@ def to_dict(self, include_text=False):
flags = self.license_flag_names + (
'is_false_positive',
'is_required_phrase',
'skip_collecting_required_phrases',
'skip_for_required_phrase_generation',
'is_continuous',
'is_deprecated'
)
Expand Down Expand Up @@ -2400,7 +2400,7 @@ def load(self, rule_file, with_checks=True):
self.is_false_positive = data.get('is_false_positive', False)

self.is_required_phrase = data.get('is_required_phrase', False)
self.skip_collecting_required_phrases = data.get('skip_collecting_required_phrases', False)
self.skip_for_required_phrase_generation = data.get('skip_for_required_phrase_generation', False)
self.source = data.get('source')

relevance = as_int(float(data.get('relevance') or 0))
Expand Down
24 changes: 12 additions & 12 deletions tests/formattedcode/data/common/manifests-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -1629,7 +1629,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -1656,7 +1656,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand Down Expand Up @@ -1684,7 +1684,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand Down Expand Up @@ -1712,7 +1712,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -1739,7 +1739,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand Down Expand Up @@ -1778,7 +1778,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -1805,7 +1805,7 @@ license_rule_references:
is_license_intro: yes
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand Down Expand Up @@ -1835,7 +1835,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: yes
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -1862,7 +1862,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -1889,7 +1889,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -1916,7 +1916,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand Down
12 changes: 6 additions & 6 deletions tests/formattedcode/data/yaml/package-and-licenses-expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: yes
Expand Down Expand Up @@ -857,7 +857,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -884,7 +884,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand All @@ -911,7 +911,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: yes
is_builtin: yes
is_from_license: no
Expand All @@ -938,7 +938,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: yes
Expand Down Expand Up @@ -983,7 +983,7 @@ license_rule_references:
is_license_intro: no
is_license_clue: no
is_required_phrase: no
skip_collecting_required_phrases: no
skip_for_required_phrase_generation: no
is_continuous: no
is_builtin: yes
is_from_license: no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
"is_license_intro": false,
"is_license_clue": false,
"is_required_phrase": false,
"skip_collecting_required_phrases": false,
"skip_for_required_phrase_generation": false,
"is_continuous": false,
"is_builtin": true,
"is_from_license": false,
Expand Down Expand Up @@ -300,7 +300,7 @@
"is_license_intro": false,
"is_license_clue": false,
"is_required_phrase": false,
"skip_collecting_required_phrases": false,
"skip_for_required_phrase_generation": false,
"is_continuous": false,
"is_builtin": false,
"is_from_license": true,
Expand Down Expand Up @@ -329,7 +329,7 @@
"is_license_intro": false,
"is_license_clue": false,
"is_required_phrase": false,
"skip_collecting_required_phrases": false,
"skip_for_required_phrase_generation": false,
"is_continuous": false,
"is_builtin": false,
"is_from_license": true,
Expand Down Expand Up @@ -358,7 +358,7 @@
"is_license_intro": false,
"is_license_clue": false,
"is_required_phrase": false,
"skip_collecting_required_phrases": false,
"skip_for_required_phrase_generation": false,
"is_continuous": false,
"is_builtin": false,
"is_from_license": true,
Expand Down Expand Up @@ -387,7 +387,7 @@
"is_license_intro": false,
"is_license_clue": false,
"is_required_phrase": false,
"skip_collecting_required_phrases": false,
"skip_for_required_phrase_generation": false,
"is_continuous": false,
"is_builtin": false,
"is_from_license": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"is_license_intro": false,
"is_license_clue": false,
"is_required_phrase": false,
"skip_collecting_required_phrases": false,
"skip_for_required_phrase_generation": false,
"is_continuous": false,
"is_builtin": false,
"is_from_license": true,
Expand Down Expand Up @@ -147,7 +147,7 @@
"is_license_intro": false,
"is_license_clue": false,
"is_required_phrase": false,
"skip_collecting_required_phrases": false,
"skip_for_required_phrase_generation": false,
"is_continuous": false,
"is_builtin": false,
"is_from_license": true,
Expand Down
Loading

0 comments on commit 8e16712

Please sign in to comment.