Skip to content

Commit 5a07a00

Browse files
authored
Merge pull request #427 from nexB/416-dash-dotted-name-truncated
#416 New production rule for copyrights in the order of copyright-year range-dash-noun
2 parents da5eeff + 994c305 commit 5a07a00

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/cluecode/copyrights.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def detect(location):
186186
(r'[Cc]ommitters\.??', 'COMMIT'),
187187
# same for maintainers.
188188
(r'^([Mm]aintainers?\.?|[Dd]evelopers?\.?)$', 'MAINT'),
189-
189+
190190
# same for developed, etc...
191191
(r'^(([Rr]e)?[Cc]oded|[Mm]odified|[Mm]ai?nt[ea]ine(d|r)|[Ww]ritten|[Dd]eveloped)$', 'AUTH2'),
192192
# author
@@ -213,7 +213,7 @@ def detect(location):
213213

214214
# Portions copyright .... are worth keeping
215215
(r'[Pp]ortions?', 'PORTIONS'),
216-
216+
217217
# in dutch/german names, like Marco van Basten, or Klemens von Metternich
218218
# and Spanish/French Da Siva and De Gaulle
219219
(r'^(([Vv][ao]n)|[Dd][aeu])$', 'VAN'),
@@ -280,7 +280,7 @@ def detect(location):
280280
]
281281

282282
# Comments in the Grammar are lines that start with #
283-
grammar = """
283+
grammar = """
284284
COPY: {<COPY>}
285285
YR-RANGE: {<YR>+ <CC>+ <YR>}
286286
YR-RANGE: {<YR> <DASH>* <YR|CD>+}
@@ -426,6 +426,10 @@ def detect(location):
426426
427427
COPYRIGHT2: {<COPY> <COPY> <YR-RANGE> <NN> <AUTH>}
428428
429+
# Copyright 1999, 2000 - D.T.Shield.
430+
# Copyright (c) 1999, 2000 - D.T.Shield.
431+
COPYRIGHT2: {<COPY> <COPY>? <YR-RANGE> <DASH> <NN>}
432+
429433
COPYRIGHT2: {<COPY> <COPY> <YR-RANGE> <BY> <NN> <NN> <NAME>}
430434
COPYRIGHT2: {<COPY> <YR-RANGE> <BY> <NN> <NN> <NAME>}
431435

tests/cluecode/test_copyrights.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3971,3 +3971,13 @@ def test_copyright_bv_legal_entity(self):
39713971
test_file = self.get_test_loc('copyrights/bv.txt')
39723972
expected = [u'Copyright (c) 2016 HERE Europe B.V.', u'(c) HERE 2016']
39733973
check_detection(expected, test_file)
3974+
3975+
def test_copyright_with_dash_and_dotted_name(self):
3976+
test_lines = [u'Copyright 1999, 2000 - D.T.Shield.']
3977+
expected = [u'Copyright 1999, 2000 - D.T.Shield.']
3978+
check_detection(expected, test_lines)
3979+
3980+
def test_copyright_with_sign_dash_and_dotted_name(self):
3981+
test_lines = [u'Copyright (c) 1999, 2000 - D.T.Shield.']
3982+
expected = [u'Copyright (c) 1999, 2000 - D.T.Shield.']
3983+
check_detection(expected, test_lines)

0 commit comments

Comments
 (0)