Skip to content

Commit 641378f

Browse files
committed
Fix incorrect copyright detection #379 and #84
* also add test for #358 Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent ba98a97 commit 641378f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/cluecode/copyrights.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ def detect(location):
198198
(r'^AppPublisher$', 'JUNK'),
199199
(r'^DISCLAIMS?|SPECIFICALLY|WARRANT(Y|I)E?S?$', 'JUNK'),
200200
(r'^(hispagestyle|Generic|Change|Add|Generic|Average|Taken|LAWS\.?|design|Driver)$', 'JUNK'),
201+
# Windows XP
202+
(r'^(Windows|XP|SP1|SP2|SP3|SP4)$', 'JUNK'),
203+
204+
(r'^example\.com$', 'JUNK'),
201205

202206
# various trailing words that are junk
203207
(r'^(?:Copyleft|LegalCopyright|AssemblyCopyright|Distributed|Report|'

tests/cluecode/test_copyrights.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4100,7 +4100,25 @@ def test_copyright_copr5_correct(self):
41004100
check_detection(expected, test_lines)
41014101

41024102
def test_copyright_oracle(self):
4103-
test_lines =['Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.']
4103+
test_lines = ['Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.']
41044104

41054105
expected = ['Copyright (c) 1997-2015 Oracle and/or its affiliates.']
41064106
check_detection(expected, test_lines)
4107+
4108+
def test_copyright_windows(self):
4109+
test_lines = ['This release supports NT-based Windows releases like Windows 2000 SP4, Windows XP, and Windows 2003.']
4110+
4111+
expected = []
4112+
check_detection(expected, test_lines)
4113+
4114+
def test_copyright_in_binary_sql_server(self):
4115+
test_lines = ['2005charchar? 7 DDLSQL Server 2005smalldatetimedatetimeLDDDDDD7']
4116+
4117+
expected = []
4118+
check_detection(expected, test_lines)
4119+
4120+
def test_copyright_with_example_com_url(self):
4121+
test_lines = ['"domain": function(c) { assert.equal(c.domain, "example.com") },']
4122+
4123+
expected = []
4124+
check_detection(expected, test_lines)

0 commit comments

Comments
 (0)