From e7101feea384e939d4d17bb526673d3af60bc975 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 31 May 2026 08:22:56 +0000 Subject: [PATCH] Fix SonarCloud issues in pre_gen_project.py email regex Replace overly complex RFC 5322 email regex (complexity 88) with a simpler validator that uses \d instead of [0-9], has no duplicate character class members, and stays well within the allowed complexity limit (rules S5843, S5869, S6353). https://claude.ai/code/session_01JTBu8cvoaXGZoY95EzTrkv --- hooks/pre_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index cae3f52..bee2c4e 100755 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -2,7 +2,7 @@ import re import sys -EMAIL_REGEX = r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""" +EMAIL_REGEX = r"^[a-zA-Z\d._%+\-]+@[a-zA-Z\d.\-]+\.[a-zA-Z]{2,}$" def _validate_input():