From 5e791d07f36f05767f5997823cce5a7b8a2ef2e9 Mon Sep 17 00:00:00 2001 From: Philipp Ahmann Date: Fri, 30 Jan 2026 11:33:51 +0100 Subject: [PATCH 1/5] Fix failing cr check for year 2026 Signed-off-by: Philipp Ahmann --- cr_checker/tool/cr_checker.py | 38 +++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/cr_checker/tool/cr_checker.py b/cr_checker/tool/cr_checker.py index ef27eb9..78e6d4c 100644 --- a/cr_checker/tool/cr_checker.py +++ b/cr_checker/tool/cr_checker.py @@ -124,17 +124,33 @@ def get_author_from_config(config_path: Path = None) -> str: def convert_bre_to_regex(template: str) -> str: """ - Convert BRE-style template (literal by default) to standard regex. - In the template: * is literal, \\* is a metacharacter. + Convert a BRE-like template into a regex: + - '\' escapes one character into a regex meta character + - '*' is literal unless escaped as '\*' (implicitly covered) + - everything else is taken literally """ - # First, escape all regex metacharacters to make them literal - escaped = re.escape(template) - # Now, find escaped backslashes followed by escaped metacharacters - # and convert them back to actual regex metacharacters - metacharacters = r"\\.*+-?[]{}()^$|" - for char in metacharacters: - escaped = escaped.replace(re.escape("\\" + char), char) - return escaped + + out = [] + i = 0 + L = len(template) + + while i < L: + ch = template[i] + + # Escape sequences + if ch == "\\" and i + 1 < L: + nxt = template[i + 1] + + # Next char becomes regex meta character + out.append(nxt) + i += 2 + continue + + # Literal characters → re.escape + out.append(re.escape(ch)) + i += 1 + + return "".join(out) def load_templates(path): @@ -194,7 +210,7 @@ def load_exclusion(path): path (str): Path to the exclusion file. Returns: - tuple(list, bool): a list of files that are excluded from the coypright check and a boolean indicating whether + tuple(list, bool): a list of files that are excluded from the copyright check and a boolean indicating whether all paths listed in the exclusion file exist and are files. """ From ce293b0a5f4dca7d2f3ffb174a20c8f7c94ec74d Mon Sep 17 00:00:00 2001 From: Philipp Ahmann Date: Fri, 30 Jan 2026 14:05:08 +0100 Subject: [PATCH 2/5] break to test checker Signed-off-by: Philipp Ahmann --- cr_checker/tool/cr_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cr_checker/tool/cr_checker.py b/cr_checker/tool/cr_checker.py index 78e6d4c..5b52172 100644 --- a/cr_checker/tool/cr_checker.py +++ b/cr_checker/tool/cr_checker.py @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 202 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. From 181a30d64c6b160381a3bdb68d4fb4330f3006a5 Mon Sep 17 00:00:00 2001 From: Philipp Ahmann Date: Fri, 30 Jan 2026 14:11:53 +0100 Subject: [PATCH 3/5] Modify to 2026 for testing Signed-off-by: Philipp Ahmann --- cr_checker/tool/cr_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cr_checker/tool/cr_checker.py b/cr_checker/tool/cr_checker.py index 5b52172..cbee025 100644 --- a/cr_checker/tool/cr_checker.py +++ b/cr_checker/tool/cr_checker.py @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 202 Contributors to the Eclipse Foundation +# Copyright (c) 2026 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. From 7e6506e97cf477d255f36001578e3098a509a739 Mon Sep 17 00:00:00 2001 From: Philipp Ahmann Date: Fri, 30 Jan 2026 14:31:46 +0100 Subject: [PATCH 4/5] Add statement for AI supported in commit Signed-off-by: Philipp Ahmann --- cr_checker/tool/cr_checker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cr_checker/tool/cr_checker.py b/cr_checker/tool/cr_checker.py index cbee025..bbb29f3 100644 --- a/cr_checker/tool/cr_checker.py +++ b/cr_checker/tool/cr_checker.py @@ -10,6 +10,9 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* + +# Some portions generated by Copilot + """The tool for checking if artifacts have proper copyright.""" import argparse From 5ea029eed8d06a2713bc2abe706b241da2e5e42b Mon Sep 17 00:00:00 2001 From: Philipp Ahmann Date: Fri, 30 Jan 2026 17:36:35 +0100 Subject: [PATCH 5/5] Fix CoPilot findings Signed-off-by: Philipp Ahmann --- cr_checker/tool/cr_checker.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cr_checker/tool/cr_checker.py b/cr_checker/tool/cr_checker.py index bbb29f3..66ad73d 100644 --- a/cr_checker/tool/cr_checker.py +++ b/cr_checker/tool/cr_checker.py @@ -128,32 +128,33 @@ def get_author_from_config(config_path: Path = None) -> str: def convert_bre_to_regex(template: str) -> str: """ Convert a BRE-like template into a regex: - - '\' escapes one character into a regex meta character - - '*' is literal unless escaped as '\*' (implicitly covered) - - everything else is taken literally + - '\' escapes the following character and inserts it as a regex meta character + - '*' is treated as a literal asterisk character + - '\*' in the template yields the regex meta character '*' (zero or more of the preceding element) + - everything else is taken literally (escaped with re.escape) """ - out = [] + escaped = [] i = 0 - L = len(template) + template_len = len(template) - while i < L: - ch = template[i] + while i < template_len: + current_ch = template[i] # Escape sequences - if ch == "\\" and i + 1 < L: + if current_ch == "\\" and i + 1 < template_len: nxt = template[i + 1] # Next char becomes regex meta character - out.append(nxt) + escaped.append(nxt) i += 2 continue # Literal characters → re.escape - out.append(re.escape(ch)) + escaped.append(re.escape(current_ch)) i += 1 - return "".join(out) + return "".join(escaped) def load_templates(path):