Skip to content

Commit

Permalink
Fix incorrect copyright detection #379 and #84
Browse files Browse the repository at this point in the history
 * also add test for #358

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
  • Loading branch information
pombredanne committed Jun 16, 2017
1 parent ba98a97 commit 641378f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cluecode/copyrights.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ def detect(location):
(r'^AppPublisher$', 'JUNK'),
(r'^DISCLAIMS?|SPECIFICALLY|WARRANT(Y|I)E?S?$', 'JUNK'),
(r'^(hispagestyle|Generic|Change|Add|Generic|Average|Taken|LAWS\.?|design|Driver)$', 'JUNK'),
# Windows XP
(r'^(Windows|XP|SP1|SP2|SP3|SP4)$', 'JUNK'),

(r'^example\.com$', 'JUNK'),

# various trailing words that are junk
(r'^(?:Copyleft|LegalCopyright|AssemblyCopyright|Distributed|Report|'
Expand Down
20 changes: 19 additions & 1 deletion tests/cluecode/test_copyrights.py
Original file line number Diff line number Diff line change
Expand Up @@ -4100,7 +4100,25 @@ def test_copyright_copr5_correct(self):
check_detection(expected, test_lines)

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

expected = ['Copyright (c) 1997-2015 Oracle and/or its affiliates.']
check_detection(expected, test_lines)

def test_copyright_windows(self):
test_lines = ['This release supports NT-based Windows releases like Windows 2000 SP4, Windows XP, and Windows 2003.']

expected = []
check_detection(expected, test_lines)

def test_copyright_in_binary_sql_server(self):
test_lines = ['2005charchar? 7 DDLSQL Server 2005smalldatetimedatetimeLDDDDDD7']

expected = []
check_detection(expected, test_lines)

def test_copyright_with_example_com_url(self):
test_lines = ['"domain": function(c) { assert.equal(c.domain, "example.com") },']

expected = []
check_detection(expected, test_lines)

0 comments on commit 641378f

Please sign in to comment.