Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ The following organizations or individuals have contributed to ScanCode:
- Nisha Kumar @nishakm
- Nishchith Shetty @inishchith
- Nitish Sharma @nitish81299
- Wonjae Park @JustinWonjaePark
- Paul Gier @pgier
- Philippe Ombredanne @pombredanne
- Pi Delport @PiDelport
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog
Next release
--------------

- Improve copyright holder detection for lower camel case names.

- Fix the optional ``licenses`` extra dependency typo to install
``licensedcode-data``.
https://github.com/aboutcode-org/scancode-toolkit/pull/5056
Expand Down
11 changes: 11 additions & 0 deletions src/cluecode/copyrights.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,17 @@ def detect(self,
# first, POS tag each token using token regexes
lexed_text = list(self.lexer.lex_tokens(tokens, trace=TRACE_TOK))


for index, token in enumerate(lexed_text):
if (
index
and token.label == 'JUNK'
and lexed_text[index - 1].label == 'YR'
and token.start_line == lexed_text[index - 1].start_line
and re.match(r'^[a-z]{2,}[A-Z][a-z]+(?:[A-Z][a-z]+)*[\.,]?$', token.value)
):
token.label = 'MIXEDCAP'

if TRACE or TRACE_DEEP:
logger_debug(f'CopyrightDetector: lexed tokens:')
for l in lexed_text:
Expand Down
2 changes: 2 additions & 0 deletions tests/cluecode/data/copyrights/lower_camel_case_holder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright (c) 2021, drGlennPierce
Copyright (c) 2022, myCompany
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
what:
- copyrights
- holders
copyrights:
- Copyright (c) 2021, drGlennPierce
- Copyright (c) 2022, myCompany
holders:
- drGlennPierce
- myCompany
Loading