Skip to content

Commit 88b4b53

Browse files
Add more rules and license detection improvements
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent 87da63f commit 88b4b53

File tree

19 files changed

+896
-387
lines changed

19 files changed

+896
-387
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
is_false_positive: yes
3+
notes: found in linux/drivers/gpu/drm/amd/include/asic_reg/nbio/
4+
---
5+
6+
#define PCIE_RX_AD__RX_RC_UR_SSPL_MSG
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
is_false_positive: yes
3+
notes: found in linux/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
4+
---
5+
6+
EXYNOS_PIN_BANK_EINTG("gpl2")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
is_false_positive: yes
3+
notes: found in linux/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
4+
---
5+
6+
EXYNOS_PIN_BANK_EINTG("gpl1")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
is_false_positive: yes
3+
notes: found in linux/net/core/filter.c
4+
---
5+
6+
EXPORT_PER_CPU_SYMBOL_GPL
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
is_false_positive: yes
3+
notes: found in linux/include/linux/mfd/rn5t618.h
4+
---
5+
6+
#define RN5T618_GPLED_FUNC
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
is_false_positive: yes
3+
notes: found in linux/Documentation/process/maintainer-pgp-guide.rst
4+
---
5+
6+
the more general "`Protecting Code Integrity`_" guide published by the
7+
Linux Foundation. Please read that document for more in-depth discussion

src/licensedcode/data/rules/gpl-1.0-plus_64.RULE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
license_expression: gpl-1.0-plus
33
is_license_reference: yes
44
relevance: 100
5+
is_deprecated: yes
6+
notes: replaced by gpl-1.0-plus_bare_gpled.RULE
57
---
68

79
gpled
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
license_expression: gpl-1.0-plus
3+
is_license_reference: yes
4+
relevance: 60
5+
---
6+
7+
gpled
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
license_expression: gpl-2.0
3+
is_license_notice: yes
4+
---
5+
6+
* Released under the terms of the {{GNU GPL v2.0.}}
7+
*
8+
* Derived from menuconfig.
9+
*
10+
*/
11+
#ifndef _GNU_SOURCE
12+
#define _GNU_SOURCE

src/licensedcode/detection.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@ def len(self):
641641
def coverage(self):
642642
return self.match_coverage
643643

644-
@property
645644
def matched_text(self, whole_lines=False, highlight=True):
646645
return self.text
647646

@@ -713,8 +712,8 @@ def to_dict(
713712
if rule_details:
714713
result["rule_notes"] = self.rule.notes
715714
result["referenced_filenames"] = self.rule.referenced_filenames
716-
if include_text and self.matched_text:
717-
result['matched_text'] = self.matched_text
715+
if include_text and self.text:
716+
result['matched_text'] = self.text
718717
if license_text_diagnostics and self.matched_text_diagnostics:
719718
result['matched_text_diagnostics'] = self.matched_text_diagnostics
720719
if rule_details:
@@ -1163,10 +1162,16 @@ def is_false_positive(license_matches, package_license=False):
11631162
if package_license:
11641163
return False
11651164

1165+
# FIXME: actually run copyright detection here?
1166+
copyright_words = ["copyright", "(c)"]
11661167
has_copyrights = all(
11671168
True
11681169
for license_match in license_matches
1169-
if "copyright" in license_match.matched_text().lower()
1170+
if any(
1171+
True
1172+
for word in copyright_words
1173+
if word in license_match.matched_text().lower()
1174+
)
11701175
)
11711176
has_full_relevance = all(
11721177
True

0 commit comments

Comments
 (0)