Skip to content

Commit df30ae5

Browse files
committed
Detect copyrights with parens/onwards/beyond
Signed-off-by: Philippe Ombredanne <pombredanne@aboutcode.org>
1 parent 08af0ce commit df30ae5

88 files changed

Lines changed: 475 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/cluecode/copyrights.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,8 @@ def build_detection_from_node(
10031003
(r'^[a-z]{,5}\[!?]+', 'JUNK'),
10041004
(r'^(fprintf|stderr)$', 'JUNK'),
10051005

1006+
(r'^[Aa]uthor\(s\)\.?$', 'AUTHDOT'),
1007+
10061008
# func call with short var in minified code
10071009
(r'^\w{2,6}\([a-z, ]{1,6}\)', 'JUNK'),
10081010

@@ -2047,9 +2049,9 @@ def build_detection_from_node(
20472049
(r'^[Aa]uthor$', 'AUTH'),
20482050
(r'^[Aa]uthor\.$', 'AUTHDOT'),
20492051
(r'^[Aa]uthors?\.$', 'AUTHDOT'),
2052+
(r'^[Aa]uthor\(s\)\.?$', 'AUTHDOT'),
20502053
(r'^([Aa]uthors|author\')$', 'AUTHS'),
20512054
(r'^[Aa]uthor\(s\)$', 'AUTHS'),
2052-
(r'^[Aa]uthor\(s\)\.?$', 'AUTHDOT'),
20532055
# as javadoc
20542056
(r'^@[Aa]uthors?:?$', 'AUTH'),
20552057

@@ -2219,6 +2221,12 @@ def build_detection_from_node(
22192221
# all other cardinal numbers
22202222
(r'^-?[0-9]+(.[0-9]+)?[\.,]?$', 'CD'),
22212223

2224+
# onwards used in year ranges
2225+
(r'^onwards,?$', 'ONWARDS'),
2226+
# beyond is the same
2227+
(r'^beyond,?$', 'ONWARDS'),
2228+
2229+
22222230
############################################################################
22232231
# All caps and proper nouns
22242232
############################################################################
@@ -2409,6 +2417,9 @@ def build_detection_from_node(
24092417
24102418
# 5 Jan 2003
24112419
YR-RANGE: {<CDS> <NNP> <YR-RANGE>} #72.3
2420+
2421+
# 2024 and? onwards
2422+
YR-RANGE: {<YR-RANGE><CC>?<ONWARDS>}
24122423
24132424
24142425
#######################################
@@ -3071,6 +3082,9 @@ def build_detection_from_node(
30713082
# Copyright base-x contributors (c) 2016
30723083
COPYRIGHT: {<COPY>+ <NN> <CONTRIBUTORS|COMMIT|AUTHS|MAINT> <COPY> <YR-RANGE>} #22793.2
30733084
3085+
# Copyright © 2021 Ha and Maguire.
3086+
COPYRIGHT: {<COPY>+ <YR-RANGE> <NN> <CC> <NNP>} #22793.31
3087+
30743088
# Copyright (c) 2017 odahcam
30753089
# Copyright (C) 2006 XStream committers.
30763090
# Copyright (c) 2019-2021, Open source contributors.
@@ -3109,6 +3123,9 @@ def build_detection_from_node(
31093123
COPYRIGHT2: {<COPY>+ <NN|CAPS>? <YR-RANGE>+ <PN>*} #2280
31103124
COPYRIGHT2: {<COPY><IS>?<HELD><BY><NN>?<NNP>} #2280-12
31113125
3126+
# Copyright (c) 1995-2012 held by the author(s). All rights reserved.'
3127+
COPYRIGHT: {<COPYRIGHT2><HELD><BY><NN><AUTHDOT>} #2280-40
3128+
31123129
COPYRIGHT: {<COPYRIGHT2> <BY> <NAME-YEAR|NAME-EMAIL> <BY>? <NAME-YEAR|NAME-EMAIL>? } #2280-4
31133130
31143131
# using #2280 above: Copyright 2018 Developers of the Rand project
@@ -3319,7 +3336,8 @@ def build_detection_from_node(
33193336
COPYRIGHT: {<COPY> <COPY> <ANDCO>} #2841
33203337
33213338
# Copyright (c) 1995-2018 The PNG Reference Library Authors. (with and without trailing dot)
3322-
COPYRIGHT: {<COPYRIGHT> <NN> <AUTHDOT>} #35011
3339+
# Copyright 2001 - 2009 by the original author(s).
3340+
COPYRIGHT: {<COPYRIGHT|COPYRIGHT2> <NN>{0,2} <AUTHDOT>} #35011
33233341
33243342
############ All right reserved in the middle ##############################
33253343
@@ -3437,6 +3455,11 @@ def build_detection_from_node(
34373455
NAME-EMAIL: {<DASH> <NAME-EMAIL> <NN>?} #157999.14
34383456
COPYRIGHT: {<COPYRIGHT2> <FOLLOWING> <AUTHS> <NAME-EMAIL>+ } #157999.14
34393457
3458+
# Copyright (C) 2011-2012 The OpenTSDB Authors.
3459+
COPYRIGHT: {<COPYRIGHT> <AUTHDOT>} #160000
3460+
3461+
# (c) The Author(s).
3462+
COPYRIGHT: {<COPY> <NN> <AUTHS>}
34403463
34413464
#######################################
34423465
# Copyright is held by ....

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-10.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- Copyright (c) 2010 - 2014 lovepsone
7+
holders:
8+
- lovepsone

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-12.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- Copyright (c) 2018 the Author(s)
7+
holders:
8+
- the Author(s)

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-13.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- Copyright (c) 2021 The Author(s). Published by Elsevier B.V.
7+
holders:
8+
- The Author(s). Published by Elsevier B.V.

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-15.txt.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- COPYRIGHT (c) 2024

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-16.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- Copyright (c) 1995-2012 held by the author(s)
7+
holders:
8+
- the author(s)

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-17.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- (c) Don Brutzman and Len Daly
7+
holders:
8+
- Don Brutzman and Len Daly

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-18.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- Copyright (c) 1995-2008 held by the author(s)
7+
holders:
8+
- the author(s)

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-19.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- Copyright (c) YEAR i-MSCP Team
7+
holders:
8+
- i-MSCP Team

tests/cluecode/data/copyrights/copyrights_with_parens/copy-with-auth-parens-dot-2.txt.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ what:
22
- copyrights
33
- holders
44
- authors
5+
copyrights:
6+
- Copyright 2018 The Abseil Authors
7+
holders:
8+
- The Abseil Authors

0 commit comments

Comments
 (0)