From 710c9357c0350e2cd508fe797abb06920cd567ba Mon Sep 17 00:00:00 2001 From: Topu Kumar Mondol Date: Thu, 24 Sep 2026 12:04:49 +0600 Subject: [PATCH 1/3] Fix dotted author name detection Signed-off-by: Topu Kumar Mondol --- AUTHORS.rst | 1 + CHANGELOG.rst | 8 ++------ src/cluecode/copyrights.py | 6 ++++++ tests/cluecode/data/authors/author_frankie_chu.cpp | 2 ++ tests/cluecode/data/authors/author_frankie_chu.cpp.yml | 8 ++++++++ 5 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 tests/cluecode/data/authors/author_frankie_chu.cpp create mode 100644 tests/cluecode/data/authors/author_frankie_chu.cpp.yml diff --git a/AUTHORS.rst b/AUTHORS.rst index 9a8224dc7da..a6d6b904706 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -95,6 +95,7 @@ The following organizations or individuals have contributed to ScanCode: - Thorsten Harter @ThorstenHarter - Till Jaeger @LeChasseur - Tobias Furuholm @furuholm +- Topu Kumar Mondol @topukumar538 - Tushar Goel @TG1999 - Tushar Mittal @techytushar - Tushar Upadhyay @tushar912 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0bc400407d3..4caafa78770 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,12 +10,8 @@ Next release - Improve copyright detection for statements with parens or trailing "authors" -- Add experimental option for using cached results during scan time. When the - ``--use-cached-results`` option is enabled in the ScanCode CLI, during scan - time for a given Resource, we iterate through the active scanners and see if we - have cached results for those already. If we do, we update our results with the - cached data. If not, we add those scanners to a list of scanners to be run. - After scanning, the cache is updated. +- Improve author detection for dotted names such as ``Frankie.Chu``. + https://github.com/aboutcode-org/scancode-toolkit/issues/4229 v33.0.0rc1 - 2026-05-14 ------------------------ diff --git a/src/cluecode/copyrights.py b/src/cluecode/copyrights.py index 29876084168..a910198434d 100644 --- a/src/cluecode/copyrights.py +++ b/src/cluecode/copyrights.py @@ -431,6 +431,9 @@ def get_tokens(numbered_lines, splitter=re.compile(r'[\t =;]+').split): # space before in some cases: exclude (digit , (s , (c , (- # this allows to recover from words like KISA(Korean line = re.sub(pattern=r'(\([^rsc\-\d])', repl=r' \g<1>', string=line) + + line = re.sub(r'\bAuthor:(?=\S)', 'Author ', line) + for tok in splitter(line): # strip trailing quotes+comma if tok.endswith("',"): @@ -2254,6 +2257,9 @@ def build_detection_from_node( # Uppercase dotted name, ie. P. or DMTF. (r'^([A-Z]+\.)+$', 'PN'), + # proper noun with a dotted first and last name, ie. Frankie.Chu + (r'^[A-Z][a-z]+\.[A-Z][a-z]+,?$', 'NAME'), + # proper noun with some separator and trailing comma (r'^[A-Z]+\.[A-Z][a-z]+,?$', 'NNP'), diff --git a/tests/cluecode/data/authors/author_frankie_chu.cpp b/tests/cluecode/data/authors/author_frankie_chu.cpp new file mode 100644 index 00000000000..5bb8b7afb34 --- /dev/null +++ b/tests/cluecode/data/authors/author_frankie_chu.cpp @@ -0,0 +1,2 @@ +// Date:9 April,2012 +// Author:Frankie.Chu diff --git a/tests/cluecode/data/authors/author_frankie_chu.cpp.yml b/tests/cluecode/data/authors/author_frankie_chu.cpp.yml new file mode 100644 index 00000000000..c9585400317 --- /dev/null +++ b/tests/cluecode/data/authors/author_frankie_chu.cpp.yml @@ -0,0 +1,8 @@ +what: + - authors + - authors_summary +authors: + - Frankie.Chu +authors_summary: + - value: Frankie.Chu + count: 1 From 0151af760cc9a94c2f544a16de740ab052f3bcc7 Mon Sep 17 00:00:00 2001 From: Topu Kumar Mondol Date: Thu, 24 Sep 2026 16:31:32 +0600 Subject: [PATCH 2/3] Limit dotted names to author detection Signed-off-by: Topu Kumar Mondol --- src/cluecode/copyrights.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cluecode/copyrights.py b/src/cluecode/copyrights.py index a910198434d..7272871abb0 100644 --- a/src/cluecode/copyrights.py +++ b/src/cluecode/copyrights.py @@ -431,9 +431,6 @@ def get_tokens(numbered_lines, splitter=re.compile(r'[\t =;]+').split): # space before in some cases: exclude (digit , (s , (c , (- # this allows to recover from words like KISA(Korean line = re.sub(pattern=r'(\([^rsc\-\d])', repl=r' \g<1>', string=line) - - line = re.sub(r'\bAuthor:(?=\S)', 'Author ', line) - for tok in splitter(line): # strip trailing quotes+comma if tok.endswith("',"): @@ -2045,6 +2042,8 @@ def build_detection_from_node( ############################################################################ # "authors" or "contributors" is interesting, and so a tag of its own + # Author:Frankie.Chu + (r'^[Aa]uthor:[A-Z][a-z]+\.[A-Z][a-z]+,?$', 'AUTH-DOTTED'), (r'^[Aa]uthors,$', 'AUTHDOT'), (r'^[Aa]uthor$', 'AUTH'), (r'^[Aa]uthor\.$', 'AUTHDOT'), @@ -2257,9 +2256,6 @@ def build_detection_from_node( # Uppercase dotted name, ie. P. or DMTF. (r'^([A-Z]+\.)+$', 'PN'), - # proper noun with a dotted first and last name, ie. Frankie.Chu - (r'^[A-Z][a-z]+\.[A-Z][a-z]+,?$', 'NAME'), - # proper noun with some separator and trailing comma (r'^[A-Z]+\.[A-Z][a-z]+,?$', 'NNP'), @@ -3533,6 +3529,9 @@ def build_detection_from_node( # Author not attributable AUTHOR: { } #not attributable + # Author:Frankie.Chu + AUTHOR: {} + # author (Panagiotis Tsirigotis) AUTHOR: { +} #author Foo Bar @@ -3681,6 +3680,8 @@ def refine_author(a): """ if not a: return + + a = re.sub(r'^[Aa]uthor:\s*', '', a) # FIXME: we could consider to split comma separated lists such as # gthomas, sorin@netappi.com, andrew.lunn@ascom.che.g. a = remove_some_extra_words_and_punct(a) From 9640752f1a9270a8a147d00763dad97cc6202991 Mon Sep 17 00:00:00 2001 From: Topu Kumar Mondol Date: Thu, 24 Sep 2026 17:44:25 +0600 Subject: [PATCH 3/3] Restore changelog entry Signed-off-by: Topu Kumar Mondol --- CHANGELOG.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4caafa78770..d66cedc22f3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,12 @@ Next release - Improve copyright detection for statements with parens or trailing "authors" +- Add experimental option for using cached results during scan time. When the + ``--use-cached-results`` option is enabled in the ScanCode CLI, during scan + time for a given Resource, we iterate through the active scanners and see if we + have cached results for those already. If we do, we update our results with the + cached data. If not, we add those scanners to a list of scanners to be run. + After scanning, the cache is updated. - Improve author detection for dotted names such as ``Frankie.Chu``. https://github.com/aboutcode-org/scancode-toolkit/issues/4229